commit a83ccf38d72b708bb7aa69416a9fe9b090e2e97f
parent 143cdf575889feef82ed98a19df8761002d3895f
Author: rsc <devnull@localhost>
Date: Thu, 27 Jul 2006 05:14:16 +0000
wait for mount to complete before exiting
Diffstat:
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/cmd/9pfuse/a.h b/src/cmd/9pfuse/a.h
@@ -37,6 +37,7 @@ extern char *fusemtpt;
void freefusemsg(FuseMsg *m);
int fusefmt(Fmt*);
void initfuse(char *mtpt);
+void waitfuse(void);
FuseMsg* readfusemsg(void);
void replyfuse(FuseMsg *m, void *arg, int narg);
void replyfuseerrno(FuseMsg *m, int e);
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
@@ -763,7 +763,6 @@ mountfuse(char *mtpt)
close(p[0]);
fd = recvfd(p[1]);
close(p[1]);
- waitpid();
return fd;
#elif defined(__FreeBSD__)
int pid, fd;
@@ -781,7 +780,6 @@ mountfuse(char *mtpt)
fprint(2, "exec mount_fusefs: %r\n");
_exit(1);
}
- waitpid();
return fd;
#else
werrstr("cannot mount fuse on this system");
@@ -790,6 +788,12 @@ mountfuse(char *mtpt)
}
void
+waitfuse(void)
+{
+ waitpid();
+}
+
+void
unmountfuse(char *mtpt)
{
int pid;
diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
@@ -97,6 +97,11 @@ threadmain(int argc, char **argv)
sendp(fusechan, nil); /* sync */
proccreate(fusereader, nil, STACK);
+ /*
+ * Now that we're serving FUSE, we can wait
+ * for the mount to finish and exit back to the user.
+ */
+ waitfuse();
threadexits(0);
}