diff options
author | green <green@FreeBSD.org> | 1999-09-19 17:00:25 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-09-19 17:00:25 +0000 |
commit | 140cb4ff83b0061eeba0756f708f3f7c117e76e5 (patch) | |
tree | dbfb58e46547ab96401ba9719626c5b12448fbfd /sys/kern/sys_socket.c | |
parent | c171f3b18205ec5324a32cba54aff58ae5594701 (diff) | |
download | FreeBSD-src-140cb4ff83b0061eeba0756f708f3f7c117e76e5.zip FreeBSD-src-140cb4ff83b0061eeba0756f708f3f7c117e76e5.tar.gz |
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r-- | sys/kern/sys_socket.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index 6ad4383..aa892e3 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -54,10 +54,11 @@ struct fileops socketops = /* ARGSUSED */ int -soo_read(fp, uio, cred, flags) +soo_read(fp, uio, cred, flags, p) struct file *fp; struct uio *uio; struct ucred *cred; + struct proc *p; int flags; { struct socket *so = (struct socket *)fp->f_data; @@ -66,10 +67,11 @@ soo_read(fp, uio, cred, flags) /* ARGSUSED */ int -soo_write(fp, uio, cred, flags) +soo_write(fp, uio, cred, flags, p) struct file *fp; struct uio *uio; struct ucred *cred; + struct proc *p; int flags; { struct socket *so = (struct socket *)fp->f_data; |