summaryrefslogtreecommitdiffstats
path: root/sys/dev/streams
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>1999-08-04 18:53:50 +0000
committergreen <green@FreeBSD.org>1999-08-04 18:53:50 +0000
commitc03366a55d4ace981b016ae999ae67675c486cdd (patch)
tree12cd9e195ff9e1b516242767963c6e156b837539 /sys/dev/streams
parent0ab4dad80912358b49a3cee9e433dbd909334d19 (diff)
downloadFreeBSD-src-c03366a55d4ace981b016ae999ae67675c486cdd.zip
FreeBSD-src-c03366a55d4ace981b016ae999ae67675c486cdd.tar.gz
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
Diffstat (limited to 'sys/dev/streams')
-rw-r--r--sys/dev/streams/streams.c8
1 files changed, 4 insertions, 4 deletions
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;
}
OpenPOWER on IntegriCloud