vfork.c 629 B

12345678910111213141516171819202122232425
  1. /*
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <sys/syscall.h>
  7. #if (defined __NR_vfork || (defined __ARCH_USE_MMU__ && defined __NR_fork)) && (defined __USE_BSD || defined __USE_XOPEN_EXTENDED)
  8. # include <unistd.h>
  9. extern __typeof(vfork) __vfork attribute_hidden;
  10. # ifdef __NR_vfork
  11. # define __NR___vfork __NR_vfork
  12. _syscall0(pid_t, __vfork)
  13. # else
  14. /* Trivial implementation for arches that lack vfork */
  15. pid_t __vfork(void)
  16. {
  17. return fork();
  18. }
  19. # endif
  20. strong_alias(__vfork,vfork)
  21. libc_hidden_weak(vfork)
  22. #endif