|
|
1.1 ! root 1: #include "mgr.h" ! 2: #include <stdio.h> ! 3: #include <signal.h> ! 4: #include <libc.h> ! 5: ! 6: main(ac, av) ! 7: int ac; ! 8: char *av[]; ! 9: { ! 10: chdir("/cs"); ! 11: if (ac==1 || strcmp(av[1], "-d")!=0) ! 12: init(0); ! 13: else ! 14: init(1); ! 15: logevent("started\n"); ! 16: calls(); ! 17: } ! 18: ! 19: deadbabies() ! 20: { ! 21: checkkids(); ! 22: signal(SIGCHLD, deadbabies); ! 23: } ! 24: ! 25: init(debug) ! 26: { ! 27: register char **e; ! 28: extern char **environ; ! 29: extern char **newep; ! 30: extern char *newenv[]; ! 31: ! 32: if (!debug) ! 33: detach("svc"); ! 34: statfiles(); ! 35: readfiles(); ! 36: signal(SIGCHLD, deadbabies); ! 37: e = environ; ! 38: newep = newenv; ! 39: for (; *e; e++) ! 40: if (strncmp(*e, "TZ=", 3) == 0) ! 41: *newep++ = *e; ! 42: *newep = NULL; ! 43: } ! 44: ! 45: calls() ! 46: { ! 47: register Request *rp; ! 48: Request *listen(); ! 49: ! 50: for (;;) { ! 51: rp = listen(); ! 52: if (newproc(rp) == 0) ! 53: continue; ! 54: doreq(rp); ! 55: exit(1); /* we shouldn't get here if the request works */ ! 56: } ! 57: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.