]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
* sysdeps/unix/sysv/linux/ia64/clone2.S (__clone2): Add support for
authorJakub Jelinek <jakub@redhat.com>
Tue, 7 Dec 2004 14:20:59 +0000 (14:20 +0000)
committerJakub Jelinek <jakub@redhat.com>
Tue, 7 Dec 2004 14:20:59 +0000 (14:20 +0000)
NPTL where the PID is stored at userlevel and needs to be reset when
CLONE_THREAD is not used.
nptl/
* sysdeps/ia64/tcb-offsets.sym (TID): Add.
* sysdeps/unix/sysv/linux/ia64/clone2.S: New file.

* Makefile (tests): Add tst-getpid2.c.
* tst-getpid1.c (TEST_CLONE_FLAGS): Define.
(do_test): Use it.  Use __clone2 instead of clone on ia64.
* tst-getpid2.c: New test.

ChangeLog
nptl/ChangeLog
nptl/Makefile
nptl/sysdeps/ia64/tcb-offsets.sym
nptl/sysdeps/unix/sysv/linux/ia64/clone2.S [new file with mode: 0644]
nptl/tst-getpid1.c
nptl/tst-getpid2.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/ia64/clone2.S

index f21175ea063943ac8a1d708f8f976c06df156e13..b6da86d3b5778efc93bf895d8357347bd6d1fea1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2004-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/unix/sysv/linux/ia64/clone2.S (__clone2): Add support for
+       NPTL where the PID is stored at userlevel and needs to be reset when
+       CLONE_THREAD is not used.
+
 2004-12-01  Jakub Jelinek  <jakub@redhat.com>
 
        * elf/rtld.c (process_envvars): Don't consider LD_SHOW_AUXV
index 1cd8b6214247c5b3e0f1f4879793dc9c17a576bd..89a98aeff03eb32847ebe8d49e8d69f94cfc4fd8 100644 (file)
@@ -1,3 +1,13 @@
+2004-12-07  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/ia64/tcb-offsets.sym (TID): Add.
+       * sysdeps/unix/sysv/linux/ia64/clone2.S: New file.
+
+       * Makefile (tests): Add tst-getpid2.c.
+       * tst-getpid1.c (TEST_CLONE_FLAGS): Define.
+       (do_test): Use it.  Use __clone2 instead of clone on ia64.
+       * tst-getpid2.c: New test.
+
 2004-12-04  Ulrich Drepper  <drepper@redhat.com>
 
        * Makefile (tests): Add tst-getpid1.
index 9eb61927e3bed0a6807b4751b4841cedc3ef10eb..d42f356131a451f71e46c067516de42288018b2e 100644 (file)
@@ -241,7 +241,7 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
        tst-backtrace1 \
        tst-oddstacklimit \
        tst-vfork1 tst-vfork2 tst-vfork1x tst-vfork2x \
-       tst-getpid1
+       tst-getpid1 tst-getpid2
 xtests = tst-setuid1 tst-setuid1-static
 
 # Files which must not be linked with libpthread.
index 09ea70ddc75b38132c3dbb8286e3076d36f35da4..f5108e0a9eb6938a9440fc705dd3a8beca3d3039 100644 (file)
@@ -2,5 +2,6 @@
 #include <tls.h>
 
 PID                    offsetof (struct pthread, pid) - sizeof (struct pthread)
+TID                    offsetof (struct pthread, tid) - sizeof (struct pthread)
 MULTIPLE_THREADS_OFFSET offsetof (struct pthread, header.multiple_threads) - sizeof (struct pthread)
 SYSINFO_OFFSET         offsetof (tcbhead_t, private)
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S b/nptl/sysdeps/unix/sysv/linux/ia64/clone2.S
new file mode 100644 (file)
index 0000000..8664056
--- /dev/null
@@ -0,0 +1,2 @@
+#define RESET_PID
+#include <sysdeps/unix/sysv/linux/ia64/clone2.S>
index 9d637159c40c1a3913835972a3f9949b821e6893..945dcbeb647723002fb5ba818651294df87a2a7d 100644 (file)
@@ -5,6 +5,10 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#ifndef TEST_CLONE_FLAGS
+#define TEST_CLONE_FLAGS 0
+#endif
+
 static int sig;
 
 static int
@@ -35,8 +39,15 @@ do_test (void)
       return 1;
     }
 
+#ifdef __ia64__
+  extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+                       size_t __child_stack_size, int __flags, void *__arg);
+  char st[256 * 1024];
+  pid_t p = __clone2 (f, st, sizeof (st), TEST_CLONE_FLAGS, 0);
+#else
   char st[128 * 1024];
-  pid_t p = clone (f, st + sizeof (st), 0, 0);
+  pid_t p = clone (f, st + sizeof (st), TEST_CLONE_FLAGS, 0);
+#endif
   if (p == -1)
     {
       printf("clone failed: %m\n");
diff --git a/nptl/tst-getpid2.c b/nptl/tst-getpid2.c
new file mode 100644 (file)
index 0000000..fc98cb6
--- /dev/null
@@ -0,0 +1,2 @@
+#define TEST_CLONE_FLAGS CLONE_VM
+#include "tst-getpid1.c"
index af5e009be4edfe3d7247029b65a879766f385ecd..136bb5591a89a7900c21b11ffb9d6f7e78bb0cd4 100644 (file)
@@ -67,7 +67,23 @@ ENTRY(__clone2)
 (CHILD)        mov out0=in4            /* Pass proper argument to fn */
 (PARENT) ret
        ;;
-       ld8 gp=[in0]            /* Load function gp.            */
+#ifdef RESET_PID
+       tbit.nz p6,p0=in3,16    /* CLONE_THREAD */
+       tbit.z p7,p10=in3,8     /* CLONE_VM */
+(p6)   br.cond.dptk 1f
+       ;;
+       mov r15=SYS_ify (getpid)
+(p10)  addl r8=-1,r0
+(p7)   break __BREAK_SYSCALL
+       ;;
+       add r9=PID,r13
+       add r10=TID,r13
+       ;;
+       st4 [r9]=r8
+       st4 [r10]=r8
+       ;;
+#endif
+1:     ld8 gp=[in0]            /* Load function gp.            */
        mov b6=out1
        br.call.dptk.many rp=b6 /* Call fn(arg) in the child    */
        ;;