fork.c 571 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * fork() for Xtensa uClibc
  3. *
  4. * Copyright (C) 2007 Tensilica Inc.
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. /* Xtensa doesn't provide a 'fork' system call, so we use 'clone'. */
  9. #include <sys/syscall.h>
  10. #if defined __NR_clone && defined __ARCH_USE_MMU__
  11. # include <unistd.h>
  12. # include <signal.h>
  13. # include <cancel.h>
  14. pid_t fork(void)
  15. {
  16. return (pid_t) INLINE_SYSCALL(clone, 2, SIGCHLD, 0);
  17. }
  18. # ifdef __UCLIBC_HAS_THREADS__
  19. strong_alias(fork,__libc_fork)
  20. libc_hidden_weak(fork)
  21. # else
  22. libc_hidden_def(fork)
  23. # endif
  24. #endif