shithub: riscv

ref: c45766fb054e3c82fe7be6cd5da2e6ff58e534e3
dir: /sys/src/ape/lib/ap/plan9/fork.c/

View raw version
#include "lib.h"
#include <errno.h>
#include <unistd.h>
#include "sys9.h"

pid_t
fork(void)
{
	int n;

	n = _RFORK(RFENVG|RFFDG|RFPROC);
	if(n < 0)
		_syserrno();
	if(n == 0) {
		_detachbuf();
		_sessleader = 0;
	}
	return n;
}