vfork.S 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (C) 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <sysdep-cancel.h>
  16. #define _ERRNO_H 1
  17. #include <bits/errno.h>
  18. /* Clone the calling process, but without copying the whole address space.
  19. The calling process is suspended until the new process exits or is
  20. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  21. and the process ID of the new process to the old process. */
  22. ENTRY (__vfork)
  23. #ifdef SHARED
  24. larl %r1,__libc_pthread_functions
  25. lg %r1,0(%r1)
  26. #else
  27. .weak pthread_create
  28. larl %r1,pthread_create
  29. #endif
  30. ltgr %r1,%r1
  31. jgne HIDDEN_JUMPTARGET(fork)
  32. /* Do vfork system call. */
  33. svc SYS_ify (vfork)
  34. /* Check for error. */
  35. lghi %r4,-4095
  36. clgr %r2,%r4
  37. jgnl SYSCALL_ERROR_LABEL
  38. /* Normal return. */
  39. br %r14
  40. PSEUDO_END(__vfork)
  41. libc_hidden_def (__vfork)
  42. weak_alias (__vfork, vfork)