ref: 56bd332994102b4e194819abb5e087a8895452f9
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); } }