aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9pfuse
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-07-27 05:14:16 +0000
committerrsc <devnull@localhost>2006-07-27 05:14:16 +0000
commita83ccf38d72b708bb7aa69416a9fe9b090e2e97f (patch)
tree22b8084acfba01e0de7a373fa8fbc079df905043 /src/cmd/9pfuse
parent143cdf575889feef82ed98a19df8761002d3895f (diff)
downloadplan9port-a83ccf38d72b708bb7aa69416a9fe9b090e2e97f.tar.gz
plan9port-a83ccf38d72b708bb7aa69416a9fe9b090e2e97f.tar.bz2
plan9port-a83ccf38d72b708bb7aa69416a9fe9b090e2e97f.zip
wait for mount to complete before exiting
Diffstat (limited to 'src/cmd/9pfuse')
-rw-r--r--src/cmd/9pfuse/a.h1
-rw-r--r--src/cmd/9pfuse/fuse.c8
-rw-r--r--src/cmd/9pfuse/main.c5
3 files changed, 12 insertions, 2 deletions
diff --git a/src/cmd/9pfuse/a.h b/src/cmd/9pfuse/a.h
index 26319e2e..aaec3ef0 100644
--- 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
index 5c071ab4..9918994d 100644
--- 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
index 5a2ef8f6..db79a5ea 100644
--- 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);
}