vfork.S 750 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * June 3, 2003 Erik Andersen
  3. *
  4. */
  5. #define _ERRNO_H 1
  6. #include <bits/errno.h>
  7. #include <sys/syscall.h>
  8. #ifndef __NR_vfork
  9. /* No vfork so use fork instead */
  10. .weak vfork ; vfork = __libc_fork
  11. #else
  12. .text
  13. .globl __vfork;
  14. .type __vfork,@function;
  15. .align 1<<4;
  16. __vfork:
  17. popl %ecx
  18. movl $__NR_vfork,%eax
  19. int $0x80
  20. pushl %ecx
  21. cmpl $-4095,%eax
  22. jae __syscall_error
  23. ret
  24. __syscall_error:
  25. negl %eax
  26. pushl %eax
  27. #ifdef __PIC__
  28. call .Lthere
  29. .Lthere:
  30. popl %ebx
  31. addl $_GLOBAL_OFFSET_TABLE_+[.- .Lthere ], %ebx
  32. call __errno_location@PLT
  33. #else
  34. call __errno_location
  35. #endif
  36. popl %ecx
  37. movl %ecx, (%eax)
  38. xorl %eax, %eax
  39. decl %eax
  40. .Lsize:
  41. .size __vfork,.Lsize-__vfork
  42. .weak vfork ; vfork = __vfork
  43. #endif