From bbde852717f9db0b39190ab5774204522569239b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 17 Jun 2003 08:58:31 +0000 Subject: Update. 2003-06-17 Ulrich Drepper * sysdeps/unix/sysv/linux/sleep.c: Use CANCELLATION_P if defined before returning because seconds==0. --- nptl/sysdeps/pthread/createthread.c | 4 --- nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h | 7 ++++- nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h | 7 ++++- .../sysv/linux/powerpc/powerpc32/sysdep-cancel.h | 7 ++++- .../sysv/linux/powerpc/powerpc64/sysdep-cancel.h | 7 ++++- .../unix/sysv/linux/s390/s390-32/sysdep-cancel.h | 7 ++++- .../unix/sysv/linux/s390/s390-64/sysdep-cancel.h | 32 ++++++++++++++++++---- .../sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h | 24 ++++++++++++++-- nptl/sysdeps/x86_64/tcb-offsets.sym | 1 + nptl/sysdeps/x86_64/tls.h | 2 ++ 10 files changed, 81 insertions(+), 17 deletions(-) (limited to 'nptl/sysdeps') diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c index ea1213896e..7563a2b71c 100644 --- a/nptl/sysdeps/pthread/createthread.c +++ b/nptl/sysdeps/pthread/createthread.c @@ -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; } diff --git a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h index e4df0ae2df..e932359327 100644 --- a/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h @@ -342,9 +342,14 @@ # 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): diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h index cf116a7885..00662e9d6b 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h @@ -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 */ diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h index 0f4401203a..7c669bfb3e 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h @@ -79,9 +79,14 @@ # 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__ diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h index 09a612ee25..35adb1f39d 100644 --- a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h @@ -79,9 +79,14 @@ # 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__ diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h index 613a5590db..80671df08a 100644 --- a/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h @@ -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 */ diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h index 0c650bff23..f3722a0d8f 100644 --- a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h @@ -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__ diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h b/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h index 5e85376049..8081d72468 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h @@ -94,18 +94,36 @@ # 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__ diff --git a/nptl/sysdeps/x86_64/tcb-offsets.sym b/nptl/sysdeps/x86_64/tcb-offsets.sym index dc6e5c4504..f91dd39703 100644 --- a/nptl/sysdeps/x86_64/tcb-offsets.sym +++ b/nptl/sysdeps/x86_64/tcb-offsets.sym @@ -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) diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h index 074eb64a8c..973b242b4e 100644 --- a/nptl/sysdeps/x86_64/tls.h +++ b/nptl/sysdeps/x86_64/tls.h @@ -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 #endif -- cgit 1.4.1