From owner-svn-src-head@FreeBSD.ORG Thu Jun 14 12:37:43 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6558C106566C; Thu, 14 Jun 2012 12:37:42 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id 506528FC12; Thu, 14 Jun 2012 12:37:42 +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 q5ECbg99094522; Thu, 14 Jun 2012 12:37:42 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5ECbgVX094520; Thu, 14 Jun 2012 12:37:42 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206141237.q5ECbgVX094520@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 14 Jun 2012 12:37:42 +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: r237063 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 14 Jun 2012 12:37:43 -0000 Author: pjd Date: Thu Jun 14 12:37:41 2012 New Revision: 237063 URL: http://svn.freebsd.org/changeset/base/237063 Log: Style. MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Jun 14 12:31:50 2012 (r237062) +++ head/sys/kern/kern_descrip.c Thu Jun 14 12:37:41 2012 (r237063) @@ -686,7 +686,7 @@ kern_fcntl(struct thread *td, int fd, in flp->l_type = F_UNLCK; vfslocked = VFS_LOCK_GIANT(vp->v_mount); (void) VOP_ADVLOCK(vp, (caddr_t)p->p_leader, - F_UNLCK, flp, F_POSIX); + F_UNLCK, flp, F_POSIX); VFS_UNLOCK_GIANT(vfslocked); vfslocked = 0; } else @@ -1370,6 +1370,7 @@ sys_fpathconf(struct thread *td, struct vp = fp->f_vnode; if (vp != NULL) { int vfslocked; + vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); error = VOP_PATHCONF(vp, uap->name, td->td_retval); @@ -1380,7 +1381,7 @@ sys_fpathconf(struct thread *td, struct error = EINVAL; } else { td->td_retval[0] = PIPE_BUF; - error = 0; + error = 0; } } else { error = EOPNOTSUPP; @@ -1834,11 +1835,8 @@ fdfree(struct thread *td) vp = fp->f_vnode; locked = VFS_LOCK_GIANT(vp->v_mount); (void) VOP_ADVLOCK(vp, - (caddr_t)td->td_proc-> - p_leader, - F_UNLCK, - &lf, - F_POSIX); + (caddr_t)td->td_proc->p_leader, F_UNLCK, + &lf, F_POSIX); VFS_UNLOCK_GIANT(locked); FILEDESC_XLOCK(fdp); fdrop(fp, td); @@ -2027,6 +2025,7 @@ void fdcloseexec(struct thread *td) { struct filedesc *fdp; + struct file *fp; int i; /* Certain daemons might not have file descriptors. */ @@ -2034,27 +2033,23 @@ fdcloseexec(struct thread *td) if (fdp == NULL) return; - FILEDESC_XLOCK(fdp); - /* * We cannot cache fd_ofiles or fd_ofileflags since operations * may block and rip them out from under us. */ + FILEDESC_XLOCK(fdp); for (i = 0; i <= fdp->fd_lastfile; i++) { - if (fdp->fd_ofiles[i] != NULL && - (fdp->fd_ofiles[i]->f_type == DTYPE_MQUEUE || + fp = fdp->fd_ofiles[i]; + if (fp != NULL && (fp->f_type == DTYPE_MQUEUE || (fdp->fd_ofileflags[i] & UF_EXCLOSE))) { - struct file *fp; - - knote_fdclose(td, i); /* * NULL-out descriptor prior to close to avoid * a race while close blocks. */ - fp = fdp->fd_ofiles[i]; fdp->fd_ofiles[i] = NULL; fdp->fd_ofileflags[i] = 0; fdunused(fdp, i); + knote_fdclose(td, i); if (fp->f_type == DTYPE_MQUEUE) mq_fdclose(td, i, fp); FILEDESC_XUNLOCK(fdp); @@ -2139,7 +2134,7 @@ closef(struct file *fp, struct thread *t * node, not the capability itself. */ (void)cap_funwrap(fp, 0, &fp_object); - if ((fp_object->f_type == DTYPE_VNODE) && (td != NULL)) { + if (fp_object->f_type == DTYPE_VNODE && td != NULL) { int vfslocked; vp = fp_object->f_vnode; @@ -2150,7 +2145,7 @@ closef(struct file *fp, struct thread *t lf.l_len = 0; lf.l_type = F_UNLCK; (void) VOP_ADVLOCK(vp, (caddr_t)td->td_proc->p_leader, - F_UNLCK, &lf, F_POSIX); + F_UNLCK, &lf, F_POSIX); } fdtol = td->td_proc->p_fdtol; if (fdtol != NULL) { @@ -2174,8 +2169,8 @@ closef(struct file *fp, struct thread *t lf.l_type = F_UNLCK; vp = fp_object->f_vnode; (void) VOP_ADVLOCK(vp, - (caddr_t)fdtol->fdl_leader, - F_UNLCK, &lf, F_POSIX); + (caddr_t)fdtol->fdl_leader, F_UNLCK, &lf, + F_POSIX); FILEDESC_XLOCK(fdp); fdtol->fdl_holdcount--; if (fdtol->fdl_holdcount == 0 &&