diff options
Diffstat (limited to 'sys/dev/streams')
-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); } |