code: mafs

ref: 80e6c118c65b013bde24f8b9c95881c0e3a73d3e
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);
	}
}