Date: Fri, 31 Oct 2014 05:41:27 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273878 - head/sys/kern Message-ID: <201410310541.s9V5fRll001796@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410310541.s9V5fRll001796>