From c03366a55d4ace981b016ae999ae67675c486cdd Mon Sep 17 00:00:00 2001 From: green Date: Wed, 4 Aug 1999 18:53:50 +0000 Subject: Fix fd race conditions (during shared fd table usage.) Badfileops is now used in f_ops in place of NULL, and modifications to the files are more carefully ordered. f_ops should also be set to &badfileops upon "close" of a file. This does not fix other problems mentioned in this PR than the first one. PR: 11629 Reviewed by: peter --- sys/dev/streams/streams.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev/streams/streams.c') diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index cd5a6fa..07717d5 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -30,7 +30,7 @@ * skeleton produced from /usr/share/examples/drivers/make_pseudo_driver.sh * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-). * - * $Id$ + * $Id: streams.c,v 1.8 1999/08/01 12:51:06 newton Exp $ */ #include "streams.h" /* generated file.. defines NSTREAMS */ @@ -251,11 +251,11 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) return error; } + fp->f_data = (caddr_t)so; fp->f_flag = FREAD|FWRITE; - fp->f_type = DTYPE_SOCKET; fp->f_ops = &svr4_netops; + fp->f_type = DTYPE_SOCKET; - fp->f_data = (caddr_t)so; (void)svr4_stream_get(fp); p->p_dupfd = fd; return ENXIO; @@ -334,13 +334,13 @@ svr4_stream_get(fp) return so->so_emuldata; /* Allocate a new one. */ - fp->f_ops = &svr4_netops; st = malloc(sizeof(struct svr4_strm), M_TEMP, M_WAITOK); st->s_family = so->so_proto->pr_domain->dom_family; st->s_cmd = ~0; st->s_afd = -1; st->s_eventmask = 0; so->so_emuldata = st; + fp->f_ops = &svr4_netops; return st; } -- cgit v1.1