Date: Mon, 3 Nov 2014 05:12:18 +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: r274007 - head/sys/kern Message-ID: <201411030512.sA35CIpU065744@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon Nov 3 05:12:17 2014 New Revision: 274007 URL: https://svnweb.freebsd.org/changeset/base/274007 Log: filedesc: plug unnecessary fdp NULL checks in fdescfreee and fdcopy Anything reaching these functions has fd table. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Nov 3 04:41:29 2014 (r274006) +++ head/sys/kern/kern_descrip.c Mon Nov 3 05:12:17 2014 (r274007) @@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$"); #include <sys/unistd.h> #include <sys/user.h> #include <sys/vnode.h> +#include <sys/kdb.h> #ifdef KTRACE #include <sys/ktrace.h> #endif @@ -1910,9 +1911,7 @@ fdcopy(struct filedesc *fdp) struct filedescent *nfde, *ofde; int i; - /* Certain daemons might not have file descriptors. */ - if (fdp == NULL) - return (NULL); + MPASS(fdp != NULL); newfdp = fdinit(fdp); /* copy all passable descriptors (i.e. not kqueue) */ @@ -2034,10 +2033,8 @@ fdescfree(struct thread *td) struct vnode *cdir, *jdir, *rdir; int i; - /* Certain daemons might not have file descriptors. */ fdp = td->td_proc->p_fd; - if (fdp == NULL) - return; + MPASS(fdp != NULL); #ifdef RACCT PROC_LOCK(td->td_proc);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411030512.sA35CIpU065744>