]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 17 Jun 2003 08:58:31 +0000 (08:58 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 17 Jun 2003 08:58:31 +0000 (08:58 +0000)
2003-06-17  Ulrich Drepper  <drepper@redhat.com>

* sysdeps/unix/sysv/linux/sleep.c: Use CANCELLATION_P if defined before
returning because seconds==0.

15 files changed:
ChangeLog
nptl/ChangeLog
nptl/allocatestack.c
nptl/descr.h
nptl/sysdeps/pthread/createthread.c
nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h
nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h
nptl/sysdeps/x86_64/tcb-offsets.sym
nptl/sysdeps/x86_64/tls.h
sysdeps/unix/sysv/linux/sleep.c

index ac5917ac5b15ceedc265ff0e9c58a713f736aa4b..3d7f4e1ecd5c4d17552371844c7643cfc55dd3d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-06-17  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/unix/sysv/linux/sleep.c: Use CANCELLATION_P if defined before
+       returning because seconds==0.
+
 2003-06-16  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/i386/socket.S: Add unwind information.
index 371cf9e3f2d6c5a7fb895e97572bd247506992e4..29aeaf7134b825e936396dc07547c9b29281ad09 100644 (file)
@@ -1,3 +1,28 @@
+2003-06-16  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/pthread/createthread.c (create_thread): Set
+       header.multiple_threads unconditionally.
+       * allocatestack.c (allocate_stack): Likewise.
+       * descr.h (struct pthread): Add header.multiple_threads
+       unconditionally.
+       * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h (CENABLE, CDISABLE):
+       Define for librt.  #error if neither libpthread, libc nor librt.
+       * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h (CENABLE, CDISABLE):
+       Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h (CENABLE,
+       CDISABLE): Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h (CENABLE,
+       CDISABLE): Likewise.
+       * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h (CENABLE,
+       CDISABLE): Likewise.
+       * sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h (CENABLE,
+       CDISABLE): Likewise.  Access header.multiple_threads outside of
+       libc and libpthread.
+       * sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h (CENABLE, CDISABLE):
+       Likewise.
+       * sysdeps/x86_64/tls.h (tcbhead_t): Add multiple_threads.
+       * sysdeps/x86_64/tcb-offsets.sym (MULTIPLE_THREADS_OFFSET): Define.
+
 2003-06-17  Ulrich Drepper  <drepper@redhat.com>
 
        * tst-cancel4.c: Add tests for the socket and signal functions, pause.
index bfa5ea1160b4e5e57e84ca3e090d266c30cf9c57..48a47205f886a3d36cb4e09a0a96ce4ac3231e59 100644 (file)
@@ -321,10 +321,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
         stack cache nor will the memory (except the TLS memory) be freed.  */
       pd->user_stack = true;
 
-#ifdef TLS_MULTIPLE_THREADS_IN_TCB
       /* This is at least the second thread.  */
       pd->header.multiple_threads = 1;
-#else
+#ifndef TLS_MULTIPLE_THREADS_IN_TCB
       __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
@@ -454,10 +453,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
          pd->lock = LLL_LOCK_INITIALIZER;
 #endif
 
-#ifdef TLS_MULTIPLE_THREADS_IN_TCB
          /* This is at least the second thread.  */
          pd->header.multiple_threads = 1;
-#else
+#ifndef TLS_MULTIPLE_THREADS_IN_TCB
          __pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
 #endif
 
index 6004a26a839d551baf71d100bfb320534a448e6f..26ee42d7c3aa5b82aa1aa33f3e5ed5b5431485c8 100644 (file)
@@ -99,7 +99,7 @@ struct pthread
 #if !TLS_DTV_AT_TP
     /* This overlaps the TCB as used for TLS without threads (see tls.h).  */
     tcbhead_t header;
-#elif TLS_MULTIPLE_THREADS_IN_TCB
+#else
     struct
     {
       int multiple_threads;
index ea1213896ef51f0132024e8b9e27a021ffd383e9..7563a2b71c06917e5cb296180832b9a358b775ad 100644 (file)
@@ -87,9 +87,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
          /* We now have for sure more than one thread.  The main
             thread might not yet have the flag set.  No need to set
             the global variable again if this is what we use.  */
-#ifdef TLS_MULTIPLE_THREADS_IN_TCB
          THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
-#endif
 
          /* Now fill in the information about the new thread in
             the newly created thread's data structure.  We cannot let
@@ -160,9 +158,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
   /* We now have for sure more than one thread.  The main thread might
      not yet have the flag set.  No need to set the global variable
      again if this is what we use.  */
-#ifdef TLS_MULTIPLE_THREADS_IN_TCB
   THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
-#endif
 
   return 0;
 }
index e4df0ae2dfe444f6c962a97aa9433f51dbc2e445..e93235932769c5f74611440320f35e0523f9098b 100644 (file)
 # ifdef IS_IN_libpthread
 #  define CENABLE      call __pthread_enable_asynccancel;
 #  define CDISABLE     call __pthread_disable_asynccancel
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      call __libc_enable_asynccancel;
 #  define CDISABLE     call __libc_disable_asynccancel
+# elif defined IS_IN_librt
+#  define CENABLE      call __librt_enable_asynccancel;
+#  define CDISABLE     call __librt_disable_asynccancel
+# else
+#  error Unsupported library
 # endif
 # define POPSTATE_0 \
  pushl %eax; L(PUSHSTATE): movl %ecx, %eax; CDISABLE; popl %eax; L(POPSTATE):
index cf116a788546f43d13ced9406ee59fd41886e1b1..00662e9d6b584e9a8832c48f415bd36a12fa6315 100644 (file)
@@ -85,9 +85,14 @@ __syscall_error_##args:                                                            \
 # ifdef IS_IN_libpthread
 #  define CENABLE      br.call.sptk.many b0 = __pthread_enable_asynccancel
 #  define CDISABLE     br.call.sptk.many b0 = __pthread_disable_asynccancel
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      br.call.sptk.many b0 = __libc_enable_asynccancel
 #  define CDISABLE     br.call.sptk.many b0 = __libc_disable_asynccancel
+# elif defined IS_IN_librt
+#  define CENABLE      br.call.sptk.many b0 = __librt_enable_asynccancel
+#  define CDISABLE     br.call.sptk.many b0 = __librt_disable_asynccancel
+# else
+#  error Unsupported library
 # endif
 
 #define COPY_ARGS_0    /* Nothing */
index 0f4401203a8a602453e47a77809bc03ae8a428e8..7c669bfb3efb2f4bac8efa26771d8415df09bee5 100644 (file)
 # ifdef IS_IN_libpthread
 #  define CENABLE      bl JUMPTARGET(__pthread_enable_asynccancel)
 #  define CDISABLE     bl JUMPTARGET(__pthread_disable_asynccancel)
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      bl JUMPTARGET(__libc_enable_asynccancel)
 #  define CDISABLE     bl JUMPTARGET(__libc_disable_asynccancel)
+# elif defined IS_IN_librt
+#  define CENABLE      bl JUMPTARGET(__librt_enable_asynccancel)
+#  define CDISABLE     bl JUMPTARGET(__librt_disable_asynccancel)
+# else
+#  error Unsupported library
 # endif
 
 # ifndef __ASSEMBLER__
index 09a612ee25baf3028354f9c17069fd4f9414a1d5..35adb1f39daa4b13f1b6ea944aace98f1d423bf5 100644 (file)
 # ifdef IS_IN_libpthread
 #  define CENABLE      bl JUMPTARGET(__pthread_enable_asynccancel)
 #  define CDISABLE     bl JUMPTARGET(__pthread_disable_asynccancel)
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      bl JUMPTARGET(__libc_enable_asynccancel)
 #  define CDISABLE     bl JUMPTARGET(__libc_disable_asynccancel)
+# elif defined IS_IN_librt
+#  define CENABLE      bl JUMPTARGET(__librt_enable_asynccancel)
+#  define CDISABLE     bl JUMPTARGET(__librt_disable_asynccancel)
+# else
+#  error Unsupported library
 # endif
 
 # ifndef __ASSEMBLER__
index 613a5590dba66c19b958ebc5a998a1deee472c67..80671df08adbaab1e5b0a3e3a356b9f12b2668da 100644 (file)
@@ -62,9 +62,14 @@ L(pseudo_end):
 # ifdef IS_IN_libpthread
 #  define CENABLE      __pthread_enable_asynccancel
 #  define CDISABLE     __pthread_disable_asynccancel
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      __libc_enable_asynccancel
 #  define CDISABLE     __libc_disable_asynccancel
+# elif defined IS_IN_librt
+#  define CENABLE      __librt_enable_asynccancel
+#  define CDISABLE     __librt_disable_asynccancel
+# else
+#  error Unsupported library
 # endif
 
 #define STM_0          /* Nothing */
index 0c650bff232b321814bc52260164eac68f85959f..f3722a0d8f817784757fe4e5da0c46293cce7551 100644 (file)
@@ -58,10 +58,15 @@ L(pseudo_end):
 #  define CENABLE      __pthread_enable_asynccancel
 #  define CDISABLE     __pthread_disable_asynccancel
 #  define __local_multiple_threads     __pthread_multiple_threads
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      __libc_enable_asynccancel
 #  define CDISABLE     __libc_disable_asynccancel
 #  define __local_multiple_threads     __libc_multiple_threads
+# elif defined IS_IN_librt
+#  define CENABLE      __librt_enable_asynccancel
+#  define CDISABLE     __librt_disable_asynccancel
+# else
+#  error Unsupported library
 # endif
 
 #define STM_0          /* Nothing */
@@ -78,14 +83,31 @@ L(pseudo_end):
 #define LM_4           lmg %r2,%r5,16+160(%r15);
 #define LM_5           lmg %r2,%r5,16+160(%r15);
 
-# ifndef __ASSEMBLER__
+# if defined IS_IN_libpthread || !defined NOT_IN_libc
+#  ifndef __ASSEMBLER__
 extern int __local_multiple_threads attribute_hidden;
-#  define SINGLE_THREAD_P \
+#   define SINGLE_THREAD_P \
   __builtin_expect (__local_multiple_threads == 0, 1)
-# else
-#  define SINGLE_THREAD_P \
+#  else
+#   define SINGLE_THREAD_P \
        larl    %r1,__local_multiple_threads;                                 \
        icm     %r0,15,0(%r1);
+#  endif
+
+# else
+
+#  ifndef __ASSEMBLER__
+#   define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF,                                      \
+                                  header.multiple_threads) == 0, 1)
+#  else
+#   define SINGLE_THREAD_P \
+       ear     %r1,%a0;                                                      \
+       sllg    %r1,%r1,32;                                                   \
+       ear     %r1,%a1;                                                      \
+       icm     %r1,15,MULTIPLE_THREADS_OFFSET(%r1);
+#  endif
+
 # endif
 
 #elif !defined __ASSEMBLER__
index 5e85376049e7e2ed5823154659bf173ec580f80a..8081d72468ea9f5bd8d6cbf97a9642528888f0a6 100644 (file)
 #  define CENABLE      call __pthread_enable_asynccancel;
 #  define CDISABLE     call __pthread_disable_asynccancel;
 #  define __local_multiple_threads __pthread_multiple_threads
-# else
+# elif !defined NOT_IN_libc
 #  define CENABLE      call __libc_enable_asynccancel;
 #  define CDISABLE     call __libc_disable_asynccancel;
 #  define __local_multiple_threads __libc_multiple_threads
+# elif defined IS_IN_librt
+#  define CENABLE      call __librt_enable_asynccancel;
+#  define CDISABLE     call __librt_disable_asynccancel;
+# else
+#  error Unsupported library
 # endif
 
-# ifndef __ASSEMBLER__
+# if defined IS_IN_libpthread || !defined NOT_IN_libc
+#  ifndef __ASSEMBLER__
 extern int __local_multiple_threads attribute_hidden;
 #   define SINGLE_THREAD_P \
   __builtin_expect (__local_multiple_threads == 0, 1)
+#  else
+#   define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
+#  endif
+
 # else
-#  define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
+
+#  ifndef __ASSEMBLER__
+#   define SINGLE_THREAD_P \
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+                                  header.multiple_threads) == 0, 1)
+#  else
+#   define SINGLE_THREAD_P cmpl $0, %fs:MULTIPLE_THREADS_OFFSET
+#  endif
+
 # endif
 
 #elif !defined __ASSEMBLER__
index dc6e5c45046e259af24870684dd212550e46f706..f91dd39703ae9bad235db33efd3bb355b2bae484 100644 (file)
@@ -8,3 +8,4 @@ CLEANUP_JMP_BUF         offsetof (struct pthread, cleanup_jmp_buf)
 CLEANUP                        offsetof (struct pthread, cleanup)
 CLEANUP_PREV           offsetof (struct _pthread_cleanup_buffer, __prev)
 MUTEX_FUTEX            offsetof (pthread_mutex_t, __data.__lock)
+MULTIPLE_THREADS_OFFSET        offsetof (tcbhead_t, multiple_threads)
index 074eb64a8cf58c499bf63e69490e142b85e72441..973b242b4ef35b2a6d387efbac115d4b839cbf7a 100644 (file)
@@ -41,7 +41,9 @@ typedef struct
                           thread descriptor used by libpthread.  */
   dtv_t *dtv;
   void *self;          /* Pointer to the thread descriptor.  */
+  int multiple_threads;
 } tcbhead_t;
+
 #else /* __ASSEMBLER__ */
 # include <tcb-offsets.h>
 #endif
index ae24afe1aeb4735ada25eef0b4a78f75468eae54..ac92f6eced7ee43157b189ab3c5b75acd4cea504 100644 (file)
@@ -24,7 +24,7 @@
 #include <unistd.h>
 
 /* We are going to use the `nanosleep' syscall of the kernel.  But the
-   kernel does not implement the sstupid SysV SIGCHLD vs. SIG_IGN
+   kernel does not implement the stupid SysV SIGCHLD vs. SIG_IGN
    behaviour for this syscall.  Therefore we have to emulate it here.  */
 unsigned int
 __sleep (unsigned int seconds)
@@ -35,7 +35,12 @@ __sleep (unsigned int seconds)
 
   /* This is not necessary but some buggy programs depend on this.  */
   if (seconds == 0)
-    return 0;
+    {
+#ifdef CANCELLATION_P
+      CANCELLATION_P (THREAD_SELF);
+#endif
+      return 0;
+    }
 
   /* Linux will wake up the system call, nanosleep, when SIGCHLD
      arrives even if SIGCHLD is ignored.  We have to deal with it