aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/plumb/fsys.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/plumb/fsys.c')
-rw-r--r--src/cmd/plumb/fsys.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/cmd/plumb/fsys.c b/src/cmd/plumb/fsys.c
index 0ffd5053..e9be1eb6 100644
--- a/src/cmd/plumb/fsys.c
+++ b/src/cmd/plumb/fsys.c
@@ -199,7 +199,7 @@ startfsys(void)
if(post9pservice(p[1], "plumb") < 0)
sysfatal("post9pservice plumb: %r");
close(p[1]);
- threadcreate(fsysproc, nil, Stack);
+ proccreate(fsysproc, nil, Stack);
}
static void
@@ -218,14 +218,19 @@ fsysproc(void *v)
if(buf == nil)
error("malloc failed: %r");
qlock(&readlock);
- n = threadread9pmsg(srvfd, buf, messagesize);
+ n = read9pmsg(srvfd, buf, messagesize);
if(n <= 0){
if(n < 0)
error("i/o error on server channel");
threadexitsall("unmounted");
}
- if(readlock.head == nil) /* no other processes waiting to read; start one */
- threadcreate(fsysproc, nil, Stack);
+ /*
+ * can give false positive (create an extra fsysproc) once in a while,
+ * but no false negatives, so good enough. once we have one extra
+ * we'll never have more.
+ */
+ if(readlock.waiting.head == nil) /* no other processes waiting to read; start one */
+ proccreate(fsysproc, nil, Stack);
qunlock(&readlock);
if(t == nil)
t = emalloc(sizeof(Fcall));