prepare cancellation syscall asm for possibility of __cancel returning
[musl] / src / process / vfork.c
index 32a7a6e..ac95465 100644 (file)
@@ -1,8 +1,17 @@
+#define _GNU_SOURCE
 #include <unistd.h>
+#include <signal.h>
 #include "syscall.h"
+#include "libc.h"
 
-pid_t vfork(void)
+pid_t __vfork(void)
 {
        /* vfork syscall cannot be made from C code */
-       return syscall0(__NR_fork);
+#ifdef SYS_fork
+       return syscall(SYS_fork);
+#else
+       return syscall(SYS_clone, SIGCHLD, 0);
+#endif
 }
+
+weak_alias(__vfork, vfork);