From owner-svn-src-head@FreeBSD.ORG Fri Oct 31 05:41:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E51F95; Fri, 31 Oct 2014 05:41:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A5F0919; Fri, 31 Oct 2014 05:41:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9V5fRRn001797; Fri, 31 Oct 2014 05:41:27 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9V5fRll001796; Fri, 31 Oct 2014 05:41:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410310541.s9V5fRll001796@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 31 Oct 2014 05:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273878 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Oct 2014 05:41:28 -0000 Author: mjg Date: Fri Oct 31 05:41:27 2014 New Revision: 273878 URL: https://svnweb.freebsd.org/changeset/base/273878 Log: filedesc: tidy up fdcopy a little bit Test for file availability by fde_file != NULL instead of fdisused, this is consistent with similar checks later. Drop badfileops check. badfileops don't have DFLAG_PASSABLE set, so it was never reached in practice. fdiused is now only used in some KASSERTS, so ifdef it under INVARIANTS. No functional changes. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Oct 31 04:01:10 2014 (r273877) +++ head/sys/kern/kern_descrip.c Fri Oct 31 05:41:27 2014 (r273878) @@ -233,6 +233,7 @@ fd_last_used(struct filedesc *fdp, int s return (-1); } +#ifdef INVARIANTS static int fdisused(struct filedesc *fdp, int fd) { @@ -244,6 +245,7 @@ fdisused(struct filedesc *fdp, int fd) return ((fdp->fd_map[NDSLOT(fd)] & NDBIT(fd)) != 0); } +#endif /* * Mark a file descriptor as used. @@ -1920,9 +1922,8 @@ fdcopy(struct filedesc *fdp) newfdp->fd_freefile = -1; for (i = 0; i <= fdp->fd_lastfile; ++i) { ofde = &fdp->fd_ofiles[i]; - if (fdisused(fdp, i) && - (ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) && - ofde->fde_file->f_ops != &badfileops) { + if (ofde->fde_file != NULL && + ofde->fde_file->f_ops->fo_flags & DFLAG_PASSABLE) { nfde = &newfdp->fd_ofiles[i]; *nfde = *ofde; filecaps_copy(&ofde->fde_caps, &nfde->fde_caps);