diff options
Diffstat (limited to 'src/cmd/plumb/plumber.c')
-rw-r--r-- | src/cmd/plumb/plumber.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/cmd/plumb/plumber.c b/src/cmd/plumb/plumber.c index 424469f2..ae45f933 100644 --- a/src/cmd/plumb/plumber.c +++ b/src/cmd/plumb/plumber.c @@ -26,23 +26,10 @@ makeports(Ruleset *rules[]) } void -mainproc(void *v) -{ - Channel *c; - - c = v; - printerrors = 0; - makeports(rules); - startfsys(); - sendp(c, nil); -} - -void threadmain(int argc, char *argv[]) { char buf[512]; int fd; - Channel *c; progname = "plumber"; @@ -79,11 +66,18 @@ threadmain(int argc, char *argv[]) * Start all processes and threads from other proc * so we (main pid) can return to user. */ - c = chancreate(sizeof(void*), 0); - proccreate(mainproc, c, 8192); - recvp(c); - chanfree(c); - threadexits(nil); + switch(fork()){ + case -1: + sysfatal("fork: %r"); + case 0: + break; + default: + _exit(0); + } + + printerrors = 0; + makeports(rules); + startfsys(); } void |