vfork.c 610 B

123456789101112131415161718192021222324252627282930313233
  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 <unistd.h>
  7. #include <sys/types.h>
  8. #include <sys/syscall.h>
  9. extern __typeof(vfork) __vfork attribute_hidden;
  10. #ifdef __NR_vfork
  11. # define __NR___vfork __NR_vfork
  12. _syscall0(pid_t, __vfork)
  13. weak_alias(__vfork,vfork)
  14. libc_hidden_weak(vfork)
  15. #elif defined __ARCH_USE_MMU__ && defined __NR_fork
  16. /* Trivial implementation for arches that lack vfork */
  17. pid_t __vfork(void)
  18. {
  19. return fork();
  20. }
  21. weak_alias(__vfork,vfork)
  22. libc_hidden_weak(vfork)
  23. #endif