fork.c - 9base - revived minimalist port of Plan 9 userland to Unix
(HTM) git clone git://git.suckless.org/9base
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
fork.c (311B)
---
1 #include <u.h>
2 #include <signal.h>
3 #include <libc.h>
4 #include "9proc.h"
5 #undef fork
6
7 int
8 p9fork(void)
9 {
10 int pid;
11 sigset_t all, old;
12
13 sigfillset(&all);
14 sigprocmask(SIG_SETMASK, &all, &old);
15 pid = fork();
16 if(pid == 0){
17 _clearuproc();
18 _p9uproc(0);
19 }
20 sigprocmask(SIG_SETMASK, &old, nil);
21 return pid;
22 }