From owner-svn-src-all@FreeBSD.ORG Mon Jun 11 19:51:28 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 046A8106566B; Mon, 11 Jun 2012 19:51:28 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E41E58FC1E; Mon, 11 Jun 2012 19:51:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5BJpRw2006441; Mon, 11 Jun 2012 19:51:27 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5BJpRDP006439; Mon, 11 Jun 2012 19:51:27 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206111951.q5BJpRDP006439@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Mon, 11 Jun 2012 19:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236911 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jun 2012 19:51:28 -0000 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).