vfork.c 297 B

1234567891011121314151617
  1. #define _GNU_SOURCE
  2. #include <unistd.h>
  3. #include <signal.h>
  4. #include "syscall.h"
  5. #include "libc.h"
  6. pid_t __vfork(void)
  7. {
  8. /* vfork syscall cannot be made from C code */
  9. #ifdef SYS_fork
  10. return syscall(SYS_fork);
  11. #else
  12. return syscall(SYS_clone, SIGCHLD, 0);
  13. #endif
  14. }
  15. weak_alias(__vfork, vfork);