diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sys_generic.c | 13 | ||||
-rw-r--r-- | sys/kern/sys_socket.c | 2 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 3 |
3 files changed, 5 insertions, 13 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c index 6f2d551..c90ce5c 100644 --- a/sys/kern/sys_generic.c +++ b/sys/kern/sys_generic.c @@ -625,11 +625,7 @@ kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, if (nd < 0) return (EINVAL); fdp = td->td_proc->p_fd; - /* - * XXX: kern_select() currently requires that we acquire Giant - * even if none of the file descriptors we poll requires Giant. - */ - mtx_lock(&Giant); + FILEDESC_LOCK_FAST(fdp); if (nd > td->td_proc->p_fd->fd_nfiles) @@ -764,7 +760,6 @@ done_nosellock: if (selbits != &s_selbits[0]) free(selbits, M_SELECT); - mtx_unlock(&Giant); return (error); } @@ -838,11 +833,6 @@ poll(td, uap) nfds = uap->nfds; /* - * XXX: poll() currently requires that we acquire Giant even if - * none of the file descriptors we poll requires Giant. - */ - mtx_lock(&Giant); - /* * This is kinda bogus. We have fd limits, but that is not * really related to the size of the pollfd array. Make sure * we let the process use at least FD_SETSIZE entries and at @@ -943,7 +933,6 @@ out: if (ni > sizeof(smallbits)) free(bits, M_TEMP); done2: - mtx_unlock(&Giant); return (error); } diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index f40d230..4a7911d 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -223,8 +223,10 @@ soo_poll(fp, events, active_cred, td) struct socket *so = fp->f_data; int error; + NET_LOCK_GIANT(); error = (so->so_proto->pr_usrreqs->pru_sopoll) (so, events, fp->f_cred, td); + NET_UNLOCK_GIANT(); return (error); } diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 37204f3..cd5e669 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -850,7 +850,7 @@ vn_poll(fp, events, active_cred, td) struct vnode *vp; int error; - GIANT_REQUIRED; + mtx_lock(&Giant); vp = fp->f_vnode; #ifdef MAC @@ -861,6 +861,7 @@ vn_poll(fp, events, active_cred, td) #endif error = VOP_POLL(vp, events, fp->f_cred, td); + mtx_unlock(&Giant); return (error); } |