diff options
author | glebius <glebius@FreeBSD.org> | 2014-08-26 14:44:08 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2014-08-26 14:44:08 +0000 |
commit | 1ac724b05e688dc4ddb61cf32a78e861ceab2383 (patch) | |
tree | 091e87922983a38d32f70ff0988157d6c09066f5 /sys/dev | |
parent | f2499d908c3a9f081bcc7e1dd9843e34d38b07b8 (diff) | |
download | FreeBSD-src-1ac724b05e688dc4ddb61cf32a78e861ceab2383.zip FreeBSD-src-1ac724b05e688dc4ddb61cf32a78e861ceab2383.tar.gz |
- Remove socket file operations declaration from sys/file.h.
- Make them static in sys_socket.c.
- Provide generic invfo_truncate() instead of soo_truncate().
Sponsored by: Netflix
Sponsored by: Nginx, Inc.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/streams/streams.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index 3ddbcc7..42265a4 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -87,20 +87,8 @@ enum { static struct cdev *dt_ptm, *dt_arp, *dt_icmp, *dt_ip, *dt_tcp, *dt_udp, *dt_rawip, *dt_unix_dgram, *dt_unix_stream, *dt_unix_ord_stream; -static struct fileops svr4_netops = { - .fo_read = soo_read, - .fo_write = soo_write, - .fo_truncate = soo_truncate, - .fo_ioctl = soo_ioctl, - .fo_poll = soo_poll, - .fo_kqfilter = soo_kqfilter, - .fo_stat = soo_stat, - .fo_close = svr4_soo_close, - .fo_chmod = invfo_chmod, - .fo_chown = invfo_chown, - .fo_sendfile = invfo_sendfile, -}; - +static struct fileops svr4_netops; + static struct cdevsw streams_cdevsw = { .d_version = D_VERSION, .d_open = streamsopen, @@ -147,6 +135,11 @@ streams_modevent(module_t mod, int type, void *unused) printf("WARNING: device config for STREAMS failed\n"); printf("Suggest unloading streams KLD\n"); } + + /* Inherit generic socket file operations, except close(2). */ + bcopy(&socketops, &svr4_netops, sizeof(struct fileops)); + svr4_netops.fo_close = svr4_soo_close; + return 0; case MOD_UNLOAD: /* XXX should check to see if it's busy first */ @@ -345,11 +338,15 @@ svr4_stream_get(fp) static int svr4_soo_close(struct file *fp, struct thread *td) { - struct socket *so = fp->f_data; + struct socket *so = fp->f_data; /* CHECKUNIT_DIAG(ENXIO);*/ svr4_delete_socket(td->td_proc, fp); free(so->so_emuldata, M_TEMP); - return soo_close(fp, td); + + fp->f_ops = &badfileops; + fp->f_data = NULL; + + return soclose(so); } |