code: mafs

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