glibc-arch-fork.patch 700 B

1234567891011121314151617181920
  1. diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  2. index a036b92..40a1eaf 100644
  3. --- a/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  4. +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/fork.c
  5. @@ -21,9 +21,12 @@
  6. #include <sysdep.h>
  7. #include <tls.h>
  8. #define ARCH_FORK() \
  9. - INLINE_SYSCALL (clone, 4, \
  10. - CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
  11. - NULL, &THREAD_SELF->tid)
  12. + ({ unsigned long ret = INLINE_SYSCALL (fork, 0); \
  13. + if (!ret) { \
  14. + pid_t pid = INLINE_SYSCALL (getpid, 0); \
  15. + THREAD_SETMEM (THREAD_SELF, pid, pid); \
  16. + THREAD_SETMEM (THREAD_SELF, tid, pid); \
  17. + } ret; })
  18. #include "../fork.c"