vfork.S 808 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* vi: set sw=4 ts=4: */
  2. /* vfork for uClibc
  3. *
  4. * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
  5. * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
  6. * Written by Erik Andersen <andersen@uclibc.org>
  7. *
  8. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  9. */
  10. #define _ERRNO_H
  11. #include <bits/errno.h>
  12. #include <sys/syscall.h>
  13. #ifdef __NR_fork
  14. .text
  15. .global vfork
  16. .type vfork,%function
  17. .align 4
  18. vfork:
  19. #ifdef __NR_vfork
  20. swi __NR_vfork
  21. cmn r0, #4096
  22. movcc pc, lr
  23. /* Check if vfork even exists. */
  24. ldr r1, =-ENOSYS
  25. teq r0, r1
  26. bne __error
  27. #endif
  28. /* If we don't have vfork, use fork. */
  29. swi __NR_fork
  30. cmn r0, #4096
  31. /* Syscal worked. Return to child/parent */
  32. movcc pc, lr
  33. __error:
  34. b __syscall_error
  35. .size vfork,.-vfork
  36. #endif