twait for mount to complete before exiting - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit a83ccf38d72b708bb7aa69416a9fe9b090e2e97f
 (DIR) parent 143cdf575889feef82ed98a19df8761002d3895f
 (HTM) Author: rsc <devnull@localhost>
       Date:   Thu, 27 Jul 2006 05:14:16 +0000
       
       wait for mount to complete before exiting
       
       Diffstat:
         M src/cmd/9pfuse/a.h                  |       1 +
         M src/cmd/9pfuse/fuse.c               |       8 ++++++--
         M src/cmd/9pfuse/main.c               |       5 +++++
       
       3 files changed, 12 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/9pfuse/a.h b/src/cmd/9pfuse/a.h
       t@@ -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);
 (DIR) diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
       t@@ -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;
       t@@ -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");
       t@@ -790,6 +788,12 @@ mountfuse(char *mtpt)
        }
        
        void
       +waitfuse(void)
       +{
       +        waitpid();
       +}
       +
       +void
        unmountfuse(char *mtpt)
        {
                int pid;
 (DIR) diff --git a/src/cmd/9pfuse/main.c b/src/cmd/9pfuse/main.c
       t@@ -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);
        }