wait for mount to complete before exiting

This commit is contained in:
rsc 2006-07-27 05:14:16 +00:00
parent 143cdf5758
commit a83ccf38d7
3 changed files with 12 additions and 2 deletions

View file

@ -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);

View file

@ -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");
@ -789,6 +787,12 @@ mountfuse(char *mtpt)
#endif
}
void
waitfuse(void)
{
waitpid();
}
void
unmountfuse(char *mtpt)
{

View file

@ -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);
}