be like plan 9 plumber
This commit is contained in:
parent
ddd8916a0e
commit
df49b30343
1 changed files with 22 additions and 3 deletions
|
|
@ -25,12 +25,25 @@ makeports(Ruleset *rules[])
|
||||||
addport(rules[i]->port);
|
addport(rules[i]->port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mainproc(void *v)
|
||||||
|
{
|
||||||
|
Channel *c;
|
||||||
|
|
||||||
|
c = v;
|
||||||
|
printerrors = 0;
|
||||||
|
makeports(rules);
|
||||||
|
startfsys();
|
||||||
|
sendp(c, nil);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
threadmain(int argc, char *argv[])
|
threadmain(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
int fd;
|
int fd;
|
||||||
int volatile dofork;
|
int volatile dofork;
|
||||||
|
Channel *c;
|
||||||
|
|
||||||
progname = "plumber";
|
progname = "plumber";
|
||||||
dofork = 1;
|
dofork = 1;
|
||||||
|
|
@ -73,9 +86,15 @@ threadmain(int argc, char *argv[])
|
||||||
if(dofork)
|
if(dofork)
|
||||||
threaddaemonize();
|
threaddaemonize();
|
||||||
|
|
||||||
printerrors = 0;
|
/*
|
||||||
makeports(rules);
|
* Start all processes and threads from other proc
|
||||||
startfsys();
|
* so we (main pid) can return to user.
|
||||||
|
*/
|
||||||
|
c = chancreate(sizeof(void*), 0);
|
||||||
|
proccreate(mainproc, c, 8192);
|
||||||
|
recvp(c);
|
||||||
|
chanfree(c);
|
||||||
|
threadexits(nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue