aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/fork.c
blob: 841d2c2d7a18711b1bfc6c71446975b3e252f4dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <u.h>
#include <signal.h>
#include <libc.h>
#include "9proc.h"
#undef fork

int
p9fork(void)
{
	int pid;
	sigset_t all, old;

	sigfillset(&all);
	sigprocmask(SIG_SETMASK, &all, &old);
	pid = fork();
	if(pid == 0){
		_clearuproc();
		_p9uproc(0);
	}
	sigprocmask(SIG_SETMASK, &old, nil);
	return pid;
}