vfork.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* Copyright (C) 1999-2017 Free Software Foundation, Inc.
  2. The GNU C Library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public License as
  4. published by the Free Software Foundation; either version 2.1 of the
  5. License, or (at your option) any later version.
  6. The GNU C Library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with the GNU C Library; if not, see
  12. <http://www.gnu.org/licenses/>. */
  13. #include <sysdep.h>
  14. #define _ERRNO_H 1
  15. #include <bits/errno.h>
  16. /* Clone the calling process, but without copying the whole address space.
  17. The calling process is suspended until the new process exits or is
  18. replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
  19. and the process ID of the new process to the old process. */
  20. ENTRY (__vfork)
  21. mov x0, #0x4111 /* CLONE_VM | CLONE_VFORK | SIGCHLD */
  22. mov x1, sp
  23. DO_CALL (clone, 2)
  24. cmn x0, #4095
  25. b.cs .Lsyscall_error
  26. RET
  27. PSEUDO_END (__vfork)
  28. libc_hidden_def(vfork)
  29. weak_alias (__vfork, vfork)