summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index a979368..21590d3 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1516,7 +1516,7 @@ fdavail(struct thread *td, int n)
* release the FILEDESC lock.
*/
int
-falloc(struct thread *td, struct file **resultfp, int *resultfd)
+fallocf(struct thread *td, struct file **resultfp, int *resultfd, int flags)
{
struct proc *p = td->td_proc;
struct file *fp;
@@ -1559,6 +1559,8 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd)
return (error);
}
p->p_fd->fd_ofiles[i] = fp;
+ if ((flags & O_CLOEXEC) != 0)
+ p->p_fd->fd_ofileflags[i] |= UF_EXCLOSE;
FILEDESC_XUNLOCK(p->p_fd);
if (resultfp)
*resultfp = fp;
@@ -1567,6 +1569,13 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd)
return (0);
}
+int
+falloc(struct thread *td, struct file **resultfp, int *resultfd)
+{
+
+ return (fallocf(td, resultfp, resultfd, 0));
+}
+
/*
* Build a new filedesc structure from another.
* Copy the current, root, and jail root vnode references.
OpenPOWER on IntegriCloud