svn commit: r236911 - head/sys/kern
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon Jun 11 19:51:28 UTC 2012
Author: pjd
Date: Mon Jun 11 19:51:27 2012
New Revision: 236911
URL: http://svn.freebsd.org/changeset/base/236911
Log:
Move the code around a bit to move two parts of code duplicated from
kern_close() close together.
Discussed with: kib
Tested by: pho
MFC after: 1 month
Modified:
head/sys/kern/kern_descrip.c
Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c Mon Jun 11 19:48:55 2012 (r236910)
+++ head/sys/kern/kern_descrip.c Mon Jun 11 19:51:27 2012 (r236911)
@@ -874,6 +874,17 @@ do_dup(struct thread *td, int flags, int
KASSERT(fp == fdp->fd_ofiles[old], ("old fd has been modified"));
KASSERT(old != new, ("new fd is same as old"));
+ delfp = fdp->fd_ofiles[new];
+
+ /*
+ * Duplicate the source descriptor.
+ */
+ fdp->fd_ofiles[new] = fp;
+ fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE;
+ if (new > fdp->fd_lastfile)
+ fdp->fd_lastfile = new;
+ *retval = new;
+
/*
* Save info on the descriptor being overwritten. We cannot close
* it without introducing an ownership race for the slot, since we
@@ -881,7 +892,6 @@ do_dup(struct thread *td, int flags, int
*
* XXX this duplicates parts of close().
*/
- delfp = fdp->fd_ofiles[new];
holdleaders = 0;
if (delfp != NULL && td->td_proc->p_fdtol != NULL) {
/*
@@ -893,15 +903,6 @@ do_dup(struct thread *td, int flags, int
}
/*
- * Duplicate the source descriptor.
- */
- fdp->fd_ofiles[new] = fp;
- fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE;
- if (new > fdp->fd_lastfile)
- fdp->fd_lastfile = new;
- *retval = new;
-
- /*
* If we dup'd over a valid file, we now own the reference to it
* and must dispose of it using closef() semantics (as if a
* close() were performed on it).
More information about the svn-src-all
mailing list