Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / basis / Posix / Process / fork.c
1 #include "platform.h"
2
3 extern struct GC_state gcState;
4
5 C_Errno_t(C_PId_t) Posix_Process_fork (void) {
6 pid_t pid = fork ();
7 #if (defined (__Darwin__))
8 /* Contrary to the documentation, a forked process does not inherit
9 * the alternate signal stack; re-install the alternate signal
10 * stack.
11 */
12 if (pid == 0) {
13 GC_initSignalStack(&gcState);
14 }
15 #endif
16 return pid;
17 }