code: mafs

ref: b3e875d7db45fca0cde9f4efa12872f61afc54d7
dir: /tests/testfork.c/

View raw version
#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);
	}
}