svn commit: r223866 - head/sys/kern
Jonathan Anderson
jonathan at FreeBSD.org
Fri Jul 8 12:19:25 UTC 2011
Author: jonathan
Date: Fri Jul 8 12:19:25 2011
New Revision: 223866
URL: http://svn.freebsd.org/changeset/base/223866
Log:
Fix the "passability" test in fdcopy().
Rather than checking to see if a descriptor is a kqueue, check to see if
its fileops flags include DFLAG_PASSABLE.
At the moment, these two tests are equivalent, but this will change with
the addition of capabilities that wrap kqueues but are themselves of type
DTYPE_CAPABILITY. We already have the DFLAG_PASSABLE abstraction, so let's
use it.
This change has been tested with [the newly improved] tools/regression/kqueue.
Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
Modified:
head/sys/kern/kern_descrip.c
Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c Fri Jul 8 12:16:30 2011 (r223865)
+++ head/sys/kern/kern_descrip.c Fri Jul 8 12:19:25 2011 (r223866)
@@ -1780,11 +1780,11 @@ fdcopy(struct filedesc *fdp)
FILEDESC_XUNLOCK(newfdp);
FILEDESC_SLOCK(fdp);
}
- /* copy everything except kqueue descriptors */
+ /* copy all passable descriptors (i.e. not kqueue) */
newfdp->fd_freefile = -1;
for (i = 0; i <= fdp->fd_lastfile; ++i) {
if (fdisused(fdp, i) &&
- fdp->fd_ofiles[i]->f_type != DTYPE_KQUEUE &&
+ (fdp->fd_ofiles[i]->f_ops->fo_flags & DFLAG_PASSABLE) &&
fdp->fd_ofiles[i]->f_ops != &badfileops) {
newfdp->fd_ofiles[i] = fdp->fd_ofiles[i];
newfdp->fd_ofileflags[i] = fdp->fd_ofileflags[i];
More information about the svn-src-head
mailing list