Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/kern Pull up following revision(s) (requested by chri...



details:   https://anonhg.NetBSD.org/src/rev/6cdb2d95a7aa
branches:  netbsd-7
changeset: 799534:6cdb2d95a7aa
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Aug 04 17:24:59 2015 +0000

description:
Pull up following revision(s) (requested by christos in ticket #933):
        sys/kern/kern_descrip.c: revision 1.229
1. mask fflags so we don't tack on whateve oflags were passed from userland
2. honor O_CLOEXEC, so the children of daemons that use cloning devices, don't
   end up with the parents descriptors
fd_clone and in general the fd approach of 'allocate' > 'play with guts' >
'attach' should be converted to be more constructor like.

diffstat:

 sys/kern/kern_descrip.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r dcc6457ce6f8 -r 6cdb2d95a7aa sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c   Tue Aug 04 17:20:58 2015 +0000
+++ b/sys/kern/kern_descrip.c   Tue Aug 04 17:24:59 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_descrip.c,v 1.225 2014/07/25 08:10:40 dholland Exp $      */
+/*     $NetBSD: kern_descrip.c,v 1.225.2.1 2015/08/04 17:24:59 snj Exp $       */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.225 2014/07/25 08:10:40 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.225.2.1 2015/08/04 17:24:59 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1861,8 +1861,14 @@
 fd_clone(file_t *fp, unsigned fd, int flag, const struct fileops *fops,
         void *data)
 {
+       fdfile_t *ff;
+       filedesc_t *fdp;
 
-       fp->f_flag = flag;
+       fp->f_flag |= flag & FMASK;
+       fdp = curproc->p_fd;
+       ff = fdp->fd_dt->dt_ff[fd];
+       KASSERT(ff != NULL);
+       ff->ff_exclose = (flag & O_CLOEXEC) != 0;
        fp->f_type = DTYPE_MISC;
        fp->f_ops = fops;
        fp->f_data = data;



Home | Main Index | Thread Index | Old Index