diff options
author | alfred <alfred@FreeBSD.org> | 2002-03-15 08:03:46 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2002-03-15 08:03:46 +0000 |
commit | b0fd50345a3289e9bb8d558d427d688f80e93c0b (patch) | |
tree | 79b2481021420dbb65f469bde8de9f78a99e15a3 /sys/kern/sys_socket.c | |
parent | 2609492c806a011026054da1d551410de94ea04c (diff) | |
download | FreeBSD-src-b0fd50345a3289e9bb8d558d427d688f80e93c0b.zip FreeBSD-src-b0fd50345a3289e9bb8d558d427d688f80e93c0b.tar.gz |
Giant pushdown for read/write/pread/pwrite syscalls.
kern/kern_descrip.c:
Aquire Giant in fdrop_locked when file refcount hits zero, this removes
the requirement for the caller to own Giant for the most part.
kern/kern_ktrace.c:
Aquire Giant in ktrgenio, simplifies locking in upper read/write syscalls.
kern/vfs_bio.c:
Aquire Giant in bwillwrite if needed.
kern/sys_generic.c
Giant pushdown, remove Giant for:
read, pread, write and pwrite.
readv and writev aren't done yet because of the possible malloc calls
for iov to uio processing.
kern/sys_socket.c
Grab giant in the socket fo_read/write functions.
kern/vfs_vnops.c
Grab giant in the vnode fo_read/write functions.
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r-- | sys/kern/sys_socket.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 13f4000..c8a6198 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -65,7 +65,12 @@ soo_read(fp, uio, cred, flags, td) int flags; { struct socket *so = (struct socket *)fp->f_data; - return so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0); + int error; + + mtx_lock(&Giant); + error = so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0); + mtx_unlock(&Giant); + return (error); } /* ARGSUSED */ @@ -78,8 +83,13 @@ soo_write(fp, uio, cred, flags, td) int flags; { struct socket *so = (struct socket *)fp->f_data; - return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0, + int error; + + mtx_lock(&Giant); + error = so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0, uio->uio_td); + mtx_unlock(&Giant); + return (error); } int |