vfork.c 248 B

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