mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
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.
This commit is contained in:
parent
2667645020
commit
bbde852717
@ -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>
|
2003-06-16 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/i386/socket.S: Add unwind information.
|
* sysdeps/unix/sysv/linux/i386/socket.S: Add unwind information.
|
||||||
|
@ -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>
|
2003-06-17 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* tst-cancel4.c: Add tests for the socket and signal functions, pause.
|
* tst-cancel4.c: Add tests for the socket and signal functions, pause.
|
||||||
|
@ -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. */
|
stack cache nor will the memory (except the TLS memory) be freed. */
|
||||||
pd->user_stack = true;
|
pd->user_stack = true;
|
||||||
|
|
||||||
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
|
|
||||||
/* This is at least the second thread. */
|
/* This is at least the second thread. */
|
||||||
pd->header.multiple_threads = 1;
|
pd->header.multiple_threads = 1;
|
||||||
#else
|
#ifndef TLS_MULTIPLE_THREADS_IN_TCB
|
||||||
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
|
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -454,10 +453,9 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
|
|||||||
pd->lock = LLL_LOCK_INITIALIZER;
|
pd->lock = LLL_LOCK_INITIALIZER;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
|
|
||||||
/* This is at least the second thread. */
|
/* This is at least the second thread. */
|
||||||
pd->header.multiple_threads = 1;
|
pd->header.multiple_threads = 1;
|
||||||
#else
|
#ifndef TLS_MULTIPLE_THREADS_IN_TCB
|
||||||
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
|
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ struct pthread
|
|||||||
#if !TLS_DTV_AT_TP
|
#if !TLS_DTV_AT_TP
|
||||||
/* This overlaps the TCB as used for TLS without threads (see tls.h). */
|
/* This overlaps the TCB as used for TLS without threads (see tls.h). */
|
||||||
tcbhead_t header;
|
tcbhead_t header;
|
||||||
#elif TLS_MULTIPLE_THREADS_IN_TCB
|
#else
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int multiple_threads;
|
int multiple_threads;
|
||||||
|
@ -87,9 +87,7 @@ create_thread (struct pthread *pd, STACK_VARIABLES_PARMS)
|
|||||||
/* We now have for sure more than one thread. The main
|
/* We now have for sure more than one thread. The main
|
||||||
thread might not yet have the flag set. No need to set
|
thread might not yet have the flag set. No need to set
|
||||||
the global variable again if this is what we use. */
|
the global variable again if this is what we use. */
|
||||||
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
|
|
||||||
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
|
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Now fill in the information about the new thread in
|
/* Now fill in the information about the new thread in
|
||||||
the newly created thread's data structure. We cannot let
|
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
|
/* 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
|
not yet have the flag set. No need to set the global variable
|
||||||
again if this is what we use. */
|
again if this is what we use. */
|
||||||
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
|
|
||||||
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
|
THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -342,9 +342,14 @@
|
|||||||
# ifdef IS_IN_libpthread
|
# ifdef IS_IN_libpthread
|
||||||
# define CENABLE call __pthread_enable_asynccancel;
|
# define CENABLE call __pthread_enable_asynccancel;
|
||||||
# define CDISABLE call __pthread_disable_asynccancel
|
# define CDISABLE call __pthread_disable_asynccancel
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE call __libc_enable_asynccancel;
|
# define CENABLE call __libc_enable_asynccancel;
|
||||||
# define CDISABLE call __libc_disable_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
|
# endif
|
||||||
# define POPSTATE_0 \
|
# define POPSTATE_0 \
|
||||||
pushl %eax; L(PUSHSTATE): movl %ecx, %eax; CDISABLE; popl %eax; L(POPSTATE):
|
pushl %eax; L(PUSHSTATE): movl %ecx, %eax; CDISABLE; popl %eax; L(POPSTATE):
|
||||||
|
@ -85,9 +85,14 @@ __syscall_error_##args: \
|
|||||||
# ifdef IS_IN_libpthread
|
# ifdef IS_IN_libpthread
|
||||||
# define CENABLE br.call.sptk.many b0 = __pthread_enable_asynccancel
|
# define CENABLE br.call.sptk.many b0 = __pthread_enable_asynccancel
|
||||||
# define CDISABLE br.call.sptk.many b0 = __pthread_disable_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 CENABLE br.call.sptk.many b0 = __libc_enable_asynccancel
|
||||||
# define CDISABLE br.call.sptk.many b0 = __libc_disable_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
|
# endif
|
||||||
|
|
||||||
#define COPY_ARGS_0 /* Nothing */
|
#define COPY_ARGS_0 /* Nothing */
|
||||||
|
@ -79,9 +79,14 @@
|
|||||||
# ifdef IS_IN_libpthread
|
# ifdef IS_IN_libpthread
|
||||||
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
|
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
|
||||||
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
|
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
|
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
|
||||||
# define CDISABLE bl JUMPTARGET(__libc_disable_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
|
# endif
|
||||||
|
|
||||||
# ifndef __ASSEMBLER__
|
# ifndef __ASSEMBLER__
|
||||||
|
@ -79,9 +79,14 @@
|
|||||||
# ifdef IS_IN_libpthread
|
# ifdef IS_IN_libpthread
|
||||||
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
|
# define CENABLE bl JUMPTARGET(__pthread_enable_asynccancel)
|
||||||
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
|
# define CDISABLE bl JUMPTARGET(__pthread_disable_asynccancel)
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
|
# define CENABLE bl JUMPTARGET(__libc_enable_asynccancel)
|
||||||
# define CDISABLE bl JUMPTARGET(__libc_disable_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
|
# endif
|
||||||
|
|
||||||
# ifndef __ASSEMBLER__
|
# ifndef __ASSEMBLER__
|
||||||
|
@ -62,9 +62,14 @@ L(pseudo_end):
|
|||||||
# ifdef IS_IN_libpthread
|
# ifdef IS_IN_libpthread
|
||||||
# define CENABLE __pthread_enable_asynccancel
|
# define CENABLE __pthread_enable_asynccancel
|
||||||
# define CDISABLE __pthread_disable_asynccancel
|
# define CDISABLE __pthread_disable_asynccancel
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE __libc_enable_asynccancel
|
# define CENABLE __libc_enable_asynccancel
|
||||||
# define CDISABLE __libc_disable_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
|
# endif
|
||||||
|
|
||||||
#define STM_0 /* Nothing */
|
#define STM_0 /* Nothing */
|
||||||
|
@ -58,10 +58,15 @@ L(pseudo_end):
|
|||||||
# define CENABLE __pthread_enable_asynccancel
|
# define CENABLE __pthread_enable_asynccancel
|
||||||
# define CDISABLE __pthread_disable_asynccancel
|
# define CDISABLE __pthread_disable_asynccancel
|
||||||
# define __local_multiple_threads __pthread_multiple_threads
|
# define __local_multiple_threads __pthread_multiple_threads
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE __libc_enable_asynccancel
|
# define CENABLE __libc_enable_asynccancel
|
||||||
# define CDISABLE __libc_disable_asynccancel
|
# define CDISABLE __libc_disable_asynccancel
|
||||||
# define __local_multiple_threads __libc_multiple_threads
|
# 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
|
# endif
|
||||||
|
|
||||||
#define STM_0 /* Nothing */
|
#define STM_0 /* Nothing */
|
||||||
@ -78,14 +83,31 @@ L(pseudo_end):
|
|||||||
#define LM_4 lmg %r2,%r5,16+160(%r15);
|
#define LM_4 lmg %r2,%r5,16+160(%r15);
|
||||||
#define LM_5 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;
|
extern int __local_multiple_threads attribute_hidden;
|
||||||
# define SINGLE_THREAD_P \
|
# define SINGLE_THREAD_P \
|
||||||
__builtin_expect (__local_multiple_threads == 0, 1)
|
__builtin_expect (__local_multiple_threads == 0, 1)
|
||||||
# else
|
# else
|
||||||
# define SINGLE_THREAD_P \
|
# define SINGLE_THREAD_P \
|
||||||
larl %r1,__local_multiple_threads; \
|
larl %r1,__local_multiple_threads; \
|
||||||
icm %r0,15,0(%r1);
|
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
|
# endif
|
||||||
|
|
||||||
#elif !defined __ASSEMBLER__
|
#elif !defined __ASSEMBLER__
|
||||||
|
@ -94,18 +94,36 @@
|
|||||||
# define CENABLE call __pthread_enable_asynccancel;
|
# define CENABLE call __pthread_enable_asynccancel;
|
||||||
# define CDISABLE call __pthread_disable_asynccancel;
|
# define CDISABLE call __pthread_disable_asynccancel;
|
||||||
# define __local_multiple_threads __pthread_multiple_threads
|
# define __local_multiple_threads __pthread_multiple_threads
|
||||||
# else
|
# elif !defined NOT_IN_libc
|
||||||
# define CENABLE call __libc_enable_asynccancel;
|
# define CENABLE call __libc_enable_asynccancel;
|
||||||
# define CDISABLE call __libc_disable_asynccancel;
|
# define CDISABLE call __libc_disable_asynccancel;
|
||||||
# define __local_multiple_threads __libc_multiple_threads
|
# 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
|
# endif
|
||||||
|
|
||||||
# ifndef __ASSEMBLER__
|
# if defined IS_IN_libpthread || !defined NOT_IN_libc
|
||||||
|
# ifndef __ASSEMBLER__
|
||||||
extern int __local_multiple_threads attribute_hidden;
|
extern int __local_multiple_threads attribute_hidden;
|
||||||
# define SINGLE_THREAD_P \
|
# define SINGLE_THREAD_P \
|
||||||
__builtin_expect (__local_multiple_threads == 0, 1)
|
__builtin_expect (__local_multiple_threads == 0, 1)
|
||||||
|
# else
|
||||||
|
# define SINGLE_THREAD_P cmpl $0, __local_multiple_threads(%rip)
|
||||||
|
# endif
|
||||||
|
|
||||||
# else
|
# 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
|
# endif
|
||||||
|
|
||||||
#elif !defined __ASSEMBLER__
|
#elif !defined __ASSEMBLER__
|
||||||
|
@ -8,3 +8,4 @@ CLEANUP_JMP_BUF offsetof (struct pthread, cleanup_jmp_buf)
|
|||||||
CLEANUP offsetof (struct pthread, cleanup)
|
CLEANUP offsetof (struct pthread, cleanup)
|
||||||
CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev)
|
CLEANUP_PREV offsetof (struct _pthread_cleanup_buffer, __prev)
|
||||||
MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock)
|
MUTEX_FUTEX offsetof (pthread_mutex_t, __data.__lock)
|
||||||
|
MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
|
||||||
|
@ -41,7 +41,9 @@ typedef struct
|
|||||||
thread descriptor used by libpthread. */
|
thread descriptor used by libpthread. */
|
||||||
dtv_t *dtv;
|
dtv_t *dtv;
|
||||||
void *self; /* Pointer to the thread descriptor. */
|
void *self; /* Pointer to the thread descriptor. */
|
||||||
|
int multiple_threads;
|
||||||
} tcbhead_t;
|
} tcbhead_t;
|
||||||
|
|
||||||
#else /* __ASSEMBLER__ */
|
#else /* __ASSEMBLER__ */
|
||||||
# include <tcb-offsets.h>
|
# include <tcb-offsets.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/* We are going to use the `nanosleep' syscall of the kernel. But the
|
/* 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. */
|
behaviour for this syscall. Therefore we have to emulate it here. */
|
||||||
unsigned int
|
unsigned int
|
||||||
__sleep (unsigned int seconds)
|
__sleep (unsigned int seconds)
|
||||||
@ -35,7 +35,12 @@ __sleep (unsigned int seconds)
|
|||||||
|
|
||||||
/* This is not necessary but some buggy programs depend on this. */
|
/* This is not necessary but some buggy programs depend on this. */
|
||||||
if (seconds == 0)
|
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
|
/* Linux will wake up the system call, nanosleep, when SIGCHLD
|
||||||
arrives even if SIGCHLD is ignored. We have to deal with it
|
arrives even if SIGCHLD is ignored. We have to deal with it
|
||||||
|
Loading…
Reference in New Issue
Block a user