summaryrefslogtreecommitdiff
path: root/src/process
diff options
context:
space:
mode:
Diffstat (limited to 'src/process')
-rw-r--r--src/process/fork.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/process/fork.c b/src/process/fork.c
index 1213f0f5..0638ed67 100644
--- a/src/process/fork.c
+++ b/src/process/fork.c
@@ -1,9 +1,12 @@
#include <unistd.h>
#include "syscall.h"
-
-/* FIXME: add support for atfork stupidity */
+#include "libc.h"
pid_t fork(void)
{
- return syscall0(__NR_fork);
+ pid_t ret;
+ if (libc.fork_handler) libc.fork_handler(-1);
+ ret = syscall0(__NR_fork);
+ if (libc.fork_handler) libc.fork_handler(!ret);
+ return ret;
}