Date: Thu, 14 Jun 2012 12:37:42 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r237063 - head/sys/kern Message-ID: <201206141237.q5ECbgVX094520@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206141237.q5ECbgVX094520>