ref: 09e7da4a60625bfec9a93ef7222bb73d2a48b8c0
dir: /sys/src/lib9p/rfork.c/
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include <thread.h>
#include <9p.h>
void
srvforker(void (*fn)(void*), void *arg, int flag)
{
switch(rfork(RFPROC|RFMEM|RFNOWAIT|flag)){
case -1:
sysfatal("rfork: %r");
default:
return;
case 0:
fn(arg);
_exits(0);
}
}