diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-06-17 08:58:31 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-06-17 08:58:31 +0000 |
commit | bbde852717f9db0b39190ab5774204522569239b (patch) | |
tree | fed5fa0d3f6d466fab513f87ee3338d5149519d4 | |
parent | 2667645020a4322a2730e340302748f1b0c1a1ce (diff) | |
download | glibc-bbde852717f9db0b39190ab5774204522569239b.tar.gz glibc-bbde852717f9db0b39190ab5774204522569239b.tar.xz glibc-bbde852717f9db0b39190ab5774204522569239b.zip |
Update.
2003-06-17 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/sleep.c: Use CANCELLATION_P if defined before returning because seconds==0.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | nptl/ChangeLog | 25 | ||||
-rw-r--r-- | nptl/allocatestack.c | 6 | ||||
-rw-r--r-- | nptl/descr.h | 2 | ||||
-rw-r--r-- | nptl/sysdeps/pthread/createthread.c | 4 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/i386/sysdep-cancel.h | 7 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h | 7 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h | 7 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep-cancel.h | 7 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/s390/s390-32/sysdep-cancel.h | 7 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/s390/s390-64/sysdep-cancel.h | 32 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86_64/sysdep-cancel.h | 24 | ||||
-rw-r--r-- | nptl/sysdeps/x86_64/tcb-offsets.sym | 1 | ||||
-rw-r--r-- | nptl/sysdeps/x86_64/tls.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sleep.c | 9 |
15 files changed, 121 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog index ac5917ac5b..3d7f4e1ecd 100644 --- 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. diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 371cf9e3f2..29aeaf7134 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -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. diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index bfa5ea1160..48a47205f8 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -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 diff --git a/nptl/descr.h b/nptl/descr.h index 6004a26a83..26ee42d7c3 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -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; 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 <tcb-offsets.h> #endif diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c index ae24afe1ae..ac92f6eced 100644 --- a/sysdeps/unix/sysv/linux/sleep.c +++ b/sysdeps/unix/sysv/linux/sleep.c @@ -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 |