ref: fb53d7e68bcb2108fb304c81dccb1d7ff50ffa1f
dir: /tests/testfork.c/
#include <u.h> #include <libc.h> void main(int, void**) { u32int pid; print("parent pid %ud\n", getpid()); switch((pid=rfork(RFPROC|RFMEM|RFNOWAIT|RFNAMEG|RFNOTEG))){ case -1: sysfatal("rfork: %r"); default: print("srvforker: I am the parent. child pid %ud. My pid is %d\n", pid, getpid()); return; case 0: print("srvforker i am the child. My pid is %ud\n", getpid()); _exits(0); } }