diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-01-03 01:35:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-01-03 01:35:14 +0000 |
commit | bf293afeca043b28fd1d07e179106f337aa9ec58 (patch) | |
tree | cbd15671dfeef397742c9b34a136ac8345d13a54 /linuxthreads | |
parent | b0c9067d7b93d240363167e0778a86eae939eb4d (diff) | |
download | glibc-bf293afeca043b28fd1d07e179106f337aa9ec58.tar.gz glibc-bf293afeca043b28fd1d07e179106f337aa9ec58.tar.xz glibc-bf293afeca043b28fd1d07e179106f337aa9ec58.zip |
Update.
2003-01-02 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/arm/sigaction.c (__sigaction, sigaction): Protect weak_alias and libc_hidden_weak with #ifndef LIBC_SIGACTION. * sysdeps/unix/sysv/linux/ia64/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/mips/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/x86_64/sigaction.c (__sigaction, sigaction): Likewise. * sysdeps/unix/sysv/linux/i386/sigaction.c (__sigaction, sigaction): Likewise. Remove SIGCANCEL handling here. * sysdeps/unix/sysv/linux/sigaction.c (__sigaction, sigaction): Likewise.
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 61 | ||||
-rw-r--r-- | linuxthreads/Makefile | 8 | ||||
-rw-r--r-- | linuxthreads/Versions | 6 | ||||
-rw-r--r-- | linuxthreads/forward.c | 45 | ||||
-rw-r--r-- | linuxthreads/internals.h | 21 | ||||
-rw-r--r-- | linuxthreads/libc-cancellation.c | 1 | ||||
-rw-r--r-- | linuxthreads/ptfork.c | 2 | ||||
-rw-r--r-- | linuxthreads/pthread.c | 21 | ||||
-rw-r--r-- | linuxthreads/ptlongjmp.c | 2 | ||||
-rw-r--r-- | linuxthreads/signals.c | 19 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/bits/libc-lock.h | 4 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/bits/pthreadtypes.h | 10 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/pthread.h | 2 | ||||
-rw-r--r-- | linuxthreads/sysdeps/pthread/sigaction.c | 55 | ||||
-rw-r--r-- | linuxthreads/sysdeps/unix/sysv/linux/fork.c | 4 | ||||
-rw-r--r-- | linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c | 4 | ||||
-rw-r--r-- | linuxthreads/sysdeps/unix/sysv/linux/raise.c | 36 | ||||
-rw-r--r-- | linuxthreads/sysdeps/unix/sysv/linux/sigwait.c | 84 | ||||
-rw-r--r-- | linuxthreads/tst-cancel-static.c | 1 | ||||
-rw-r--r-- | linuxthreads/tst-cancel-wrappers.sh | 7 |
20 files changed, 353 insertions, 40 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index a667e22ede..ad38286577 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,5 +1,66 @@ 2003-01-02 Ulrich Drepper <drepper@redhat.com> + * tst-cancel-wrappers.sh: Exclude sigwait.c as well, it does not have + cancellation tests. + +2003-01-02 Jakub Jelinek <jakub@redhat.com> + + * internals.h (struct pthread_functions): Rename + ptr_pthread_cond_* fields to ptr___pthread_cond_*. + * pthread.c (pthread_functions): Adjust. + * forward.c: Export both pthread_cond_*@@GLIBC_2.3.2 and + pthread_cond_*@GLIBC_2.0 compatibility symbols. + * Versions [libc] (GLIBC_2.3.2): Export pthread_cond_broadcast, + pthread_cond_destroy, pthread_cond_init, pthread_cond_signal + and pthread_cond_wait. + + * sysdeps/pthread/bits/pthreadtypes.h (__pthread_cond_align_t): New + type. + (pthread_cond_t): Add __align member, shorten __padding. + * sysdeps/pthread/pthread.h (PHTREAD_COND_INITIALIZER): Initialize + __padding and __align too. + + * sysdeps/pthread/bits/libc-lock.h (__libc_maybe_call2): Add + __builtin_expect. + * sysdeps/pthread/sigaction.c: New file. + * sysdeps/unix/sysv/linux/raise.c: New file. + * sysdeps/unix/sysv/linux/sigwait.c: New file. + * sysdeps/unix/sysv/linux/fork.c (__pthread_fork): Protect + weak_extern with #ifndef SHARED. + * sysdeps/unix/sysv/linux/jmp-unwind.c (__pthread_cleanup_upto): + Likewise. + * signals.c (__sigaction): Renamed to... + (__pthread_sigaction): ... this. + (__sigaction): New strong alias, #ifdef SHARED only. + (sigaction): Protect with #ifdef SHARED. + (sigwait): Renamed to... + (__pthread_sigwait): ... this. + (sigwait): New strong alias, #ifdef SHARED only. + (raise): Renamed to... + (__pthread_raise): ... this. + (raise): New strong alias, #ifdef SHARED only. + * internals.h (__pthread_sigaction, __pthread_sigwait, + __pthread_raise): New prototypes. + (struct pthread_functions): Add ptr_pthread_sigaction, + ptr_pthread_sigwait, ptr_pthread_raise. + * pthread.c (pthread_functions): Renamed to... + (__pthread_functions): ... this. No longer static, no longer + SHARED only. Initialize ptr_pthread_sigaction, ptr_pthread_sigwait + and ptr_pthread_raise. + [SHARED] (ptr_pthread_functions): Change to &__pthread_functions. + * libc-cancellation.c (__pthread_thread_self): Remove weak_extern. + * ptfork.c (__fork, __vfork): Protect with #ifdef SHARED. + * ptlongjmp.c (siglongjmp, longjmp): Protect with #ifdef SHARED. + + * Makefile (tests, tests-static): Add tst-cancel-static. + * tst-cancel-static.c: New test. + +2003-01-02 Jakub Jelinek <jakub@redhat.com> + + * Makefile (CFLAGS-pthread_atfork.c): Add -DNOT_IN_libc. + +2003-01-02 Ulrich Drepper <drepper@redhat.com> + * sysdeps/pthread/bits/pthreadtypes.h (pthread_cond_t): Add padding. * condvar.c: Add symbol versioning. The compatibility versions are the same as the change in the interface does not effect this diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile index 9a6745fe17..b9edd40031 100644 --- a/linuxthreads/Makefile +++ b/linuxthreads/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc. +# Copyright (C) 1996-2002, 2003 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -54,6 +54,8 @@ libpthread-shared-only-routines = pt-allocrtsig libpthread-nonshared = pthread_atfork +CFLAGS-pthread_atfork.c = -DNOT_IN_libc + nodelete-yes = -Wl,--enable-new-dtags,-z,nodelete initfirst-yes = -Wl,--enable-new-dtags,-z,initfirst LDFLAGS-pthread.so = $(nodelete-$(have-z-nodelete)) \ @@ -92,8 +94,8 @@ test-srcs = tst-signal tests-reverse += tst-cancel5 ifeq ($(build-static),yes) -tests += tststatic tst-static-locale -tests-static += tststatic tst-static-locale +tests += tststatic tst-static-locale tst-cancel-static +tests-static += tststatic tst-static-locale tst-cancel-static endif ifeq (yes,$(build-shared)) diff --git a/linuxthreads/Versions b/linuxthreads/Versions index 8dd40eec28..0facfbc4c7 100644 --- a/linuxthreads/Versions +++ b/linuxthreads/Versions @@ -16,6 +16,12 @@ libc { GLIBC_2.1 { pthread_attr_init; } + GLIBC_2.3.2 { + # Changed pthread_cond_t. + pthread_cond_init; pthread_cond_destroy; + pthread_cond_wait; pthread_cond_signal; + pthread_cond_broadcast; + } GLIBC_PRIVATE { # Internal libc interface to libpthread __libc_dl_error_tsd; diff --git a/linuxthreads/forward.c b/linuxthreads/forward.c index b8f54f4f51..6cc2f99aac 100644 --- a/linuxthreads/forward.c +++ b/linuxthreads/forward.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -84,18 +84,49 @@ FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) -FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) +FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +strong_alias (__pthread_cond_broadcast, __pthread_cond_broadcast_2_0) +compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast, + GLIBC_2_0); +#endif +versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast, + GLIBC_2_3_2); + +FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +strong_alias (__pthread_cond_destroy, __pthread_cond_destroy_2_0) +compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy, + GLIBC_2_0); +#endif +versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy, + GLIBC_2_3_2); -FORWARD (pthread_cond_init, +FORWARD (__pthread_cond_init, (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), (cond, cond_attr), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +strong_alias (__pthread_cond_init, __pthread_cond_init_2_0) +compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0); +#endif +versioned_symbol (libc, __pthread_cond_init, pthread_cond_init, GLIBC_2_3_2); -FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) +FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +strong_alias (__pthread_cond_signal, __pthread_cond_signal_2_0) +compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal, + GLIBC_2_0); +#endif +versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal, + GLIBC_2_3_2); -FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), +FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), (cond, mutex), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +strong_alias (__pthread_cond_wait, __pthread_cond_wait_2_0) +compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait, GLIBC_2_0); +#endif +versioned_symbol (libc, __pthread_cond_wait, pthread_cond_wait, GLIBC_2_3_2); FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h index 872bc5c047..6241e9397e 100644 --- a/linuxthreads/internals.h +++ b/linuxthreads/internals.h @@ -452,6 +452,10 @@ extern void __pthread_sighandler(int signo, SIGCONTEXT ctx); extern void __pthread_sighandler_rt(int signo, struct siginfo *si, struct ucontext *uc); extern void __pthread_null_sighandler(int sig); +extern int __pthread_sigaction (int sig, const struct sigaction *act, + struct sigaction *oact); +extern int __pthread_sigwait (const sigset_t *set, int *sig); +extern int __pthread_raise (int sig); /* Cancellation. */ extern int __pthread_enable_asynccancel (void) attribute_hidden; @@ -505,11 +509,12 @@ struct pthread_functions int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int); int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *); int (*ptr_pthread_condattr_init) (pthread_condattr_t *); - int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); - int (*ptr_pthread_cond_destroy) (pthread_cond_t *); - int (*ptr_pthread_cond_init) (pthread_cond_t *, const pthread_condattr_t *); - int (*ptr_pthread_cond_signal) (pthread_cond_t *); - int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); + int (*ptr___pthread_cond_broadcast) (pthread_cond_t *); + int (*ptr___pthread_cond_destroy) (pthread_cond_t *); + int (*ptr___pthread_cond_init) (pthread_cond_t *, + const pthread_condattr_t *); + int (*ptr___pthread_cond_signal) (pthread_cond_t *); + int (*ptr___pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); int (*ptr_pthread_equal) (pthread_t, pthread_t); void (*ptr___pthread_exit) (void *); int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); @@ -528,10 +533,14 @@ struct pthread_functions void (*ptr_pthread_cleanup_upto) (__jmp_buf target, char *targetframe); pthread_descr (*ptr_pthread_thread_self) (void); - int (*ptr_pthread_internal_tsd_set) (int key, const void * pointer); + int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer); void * (*ptr_pthread_internal_tsd_get) (int key); void ** __attribute__ ((__const__)) (*ptr_pthread_internal_tsd_address) (int key); + int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act, + struct sigaction *oact); + int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig); + int (*ptr_pthread_raise) (int sig); }; /* Variable in libc.so. */ diff --git a/linuxthreads/libc-cancellation.c b/linuxthreads/libc-cancellation.c index 18feddbf3a..b301d9174c 100644 --- a/linuxthreads/libc-cancellation.c +++ b/linuxthreads/libc-cancellation.c @@ -29,7 +29,6 @@ # ifndef SHARED weak_extern (__pthread_do_exit) -weak_extern (__pthread_thread_self) # endif int __libc_multiple_threads attribute_hidden; diff --git a/linuxthreads/ptfork.c b/linuxthreads/ptfork.c index 195ffcd1b0..9cdbb54361 100644 --- a/linuxthreads/ptfork.c +++ b/linuxthreads/ptfork.c @@ -78,6 +78,7 @@ pid_t __pthread_fork (struct fork_block *b) return pid; } +#ifdef SHARED pid_t __fork (void) { return __libc_fork (); @@ -89,3 +90,4 @@ pid_t __vfork(void) return __libc_fork (); } weak_alias (__vfork, vfork); +#endif diff --git a/linuxthreads/pthread.c b/linuxthreads/pthread.c index 444c0a0ed2..432336258c 100644 --- a/linuxthreads/pthread.c +++ b/linuxthreads/pthread.c @@ -230,8 +230,7 @@ extern void *__dso_handle __attribute__ ((weak)); extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign); #endif -#ifdef SHARED -static struct pthread_functions pthread_functions = +struct pthread_functions __pthread_functions = { #if !(USE_TLS && HAVE___THREAD) .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set, @@ -256,11 +255,11 @@ static struct pthread_functions pthread_functions = .ptr_pthread_attr_setscope = __pthread_attr_setscope, .ptr_pthread_condattr_destroy = __pthread_condattr_destroy, .ptr_pthread_condattr_init = __pthread_condattr_init, - .ptr_pthread_cond_broadcast = __pthread_cond_broadcast, - .ptr_pthread_cond_destroy = __pthread_cond_destroy, - .ptr_pthread_cond_init = __pthread_cond_init, - .ptr_pthread_cond_signal = __pthread_cond_signal, - .ptr_pthread_cond_wait = __pthread_cond_wait, + .ptr___pthread_cond_broadcast = __pthread_cond_broadcast, + .ptr___pthread_cond_destroy = __pthread_cond_destroy, + .ptr___pthread_cond_init = __pthread_cond_init, + .ptr___pthread_cond_signal = __pthread_cond_signal, + .ptr___pthread_cond_wait = __pthread_cond_wait, .ptr_pthread_equal = __pthread_equal, .ptr___pthread_exit = __pthread_exit, .ptr_pthread_getschedparam = __pthread_getschedparam, @@ -275,9 +274,13 @@ static struct pthread_functions pthread_functions = .ptr_pthread_setcanceltype = __pthread_setcanceltype, .ptr_pthread_do_exit = __pthread_do_exit, .ptr_pthread_thread_self = __pthread_thread_self, - .ptr_pthread_cleanup_upto = __pthread_cleanup_upto + .ptr_pthread_cleanup_upto = __pthread_cleanup_upto, + .ptr_pthread_sigaction = __pthread_sigaction, + .ptr_pthread_sigwait = __pthread_sigwait, + .ptr_pthread_raise = __pthread_raise }; -# define ptr_pthread_functions &pthread_functions +#ifdef SHARED +# define ptr_pthread_functions &__pthread_functions #else # define ptr_pthread_functions NULL #endif diff --git a/linuxthreads/ptlongjmp.c b/linuxthreads/ptlongjmp.c index ece553141f..c89d28bccd 100644 --- a/linuxthreads/ptlongjmp.c +++ b/linuxthreads/ptlongjmp.c @@ -59,6 +59,7 @@ void __pthread_cleanup_upto (__jmp_buf target, char *targetframe) THREAD_SETMEM(self, p_in_sighandler, NULL); } +#ifdef SHARED void siglongjmp (sigjmp_buf env, int val) { __libc_siglongjmp (env, val); @@ -68,3 +69,4 @@ void longjmp (jmp_buf env, int val) { __libc_longjmp (env, val); } +#endif diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c index a11f865e73..d0087d9fab 100644 --- a/linuxthreads/signals.c +++ b/linuxthreads/signals.c @@ -73,8 +73,8 @@ union sighandler __sighandler[NSIG] = /* The wrapper around sigaction. Install our own signal handler around the signal. */ -int __sigaction(int sig, const struct sigaction * act, - struct sigaction * oact) +int __pthread_sigaction(int sig, const struct sigaction * act, + struct sigaction * oact) { struct sigaction newact; struct sigaction *newactp; @@ -118,10 +118,13 @@ int __sigaction(int sig, const struct sigaction * act, } return 0; } -strong_alias(__sigaction, sigaction) +#ifdef SHARED +strong_alias(__pthread_sigaction, __sigaction) +strong_alias(__pthread_sigaction, sigaction) +#endif /* sigwait -- synchronously wait for a signal */ -int sigwait(const sigset_t * set, int * sig) +int __pthread_sigwait(const sigset_t * set, int * sig) { volatile pthread_descr self = thread_self(); sigset_t mask; @@ -173,10 +176,13 @@ int sigwait(const sigset_t * set, int * sig) *sig = THREAD_GETMEM(self, p_signal); return 0; } +#ifdef SHARED +strong_alias (__pthread_sigwait, sigwait) +#endif /* Redefine raise() to send signal to calling thread only, as per POSIX 1003.1c */ -int raise (int sig) +int __pthread_raise (int sig) { int retcode = pthread_kill(pthread_self(), sig); if (retcode == 0) @@ -186,3 +192,6 @@ int raise (int sig) return -1; } } +#ifdef SHARED +strong_alias (__pthread_raise, raise) +#endif diff --git a/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/linuxthreads/sysdeps/pthread/bits/libc-lock.h index cb839fa42e..bb0472d453 100644 --- a/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -1,5 +1,5 @@ /* libc-internal interface for mutex locks. LinuxThreads version. - Copyright (C) 1996,1997,1998,1999,2000,2001,2002 + Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -108,7 +108,7 @@ typedef pthread_key_t __libc_key_t; #endif #if defined _LIBC && !defined NOT_IN_libc && defined SHARED # define __libc_maybe_call2(FUNC, ARGS, ELSE) \ - ({__libc_pthread_functions.ptr_##FUNC != NULL \ + ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \ ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; }) #else # define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) diff --git a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h index 43d4f7dc00..d97e134eec 100644 --- a/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h +++ b/linuxthreads/sysdeps/pthread/bits/pthreadtypes.h @@ -53,12 +53,20 @@ typedef struct __pthread_attr_s /* Conditions (not abstract because of PTHREAD_COND_INITIALIZER */ + +#ifdef __GLIBC_HAVE_LONG_LONG +__extension__ typedef long long __pthread_cond_align_t; +#else +typedef long __pthread_cond_align_t; +#endif + typedef struct { struct _pthread_fastlock __c_lock; /* Protect against concurrent access */ _pthread_descr __c_waiting; /* Threads waiting on this condition */ char __padding[48 - sizeof (struct _pthread_fastlock) - - sizeof (_pthread_descr)]; + - sizeof (_pthread_descr) - sizeof (__pthread_cond_align_t)]; + __pthread_cond_align_t __align; } pthread_cond_t; diff --git a/linuxthreads/sysdeps/pthread/pthread.h b/linuxthreads/sysdeps/pthread/pthread.h index bc399185e1..efeaad576a 100644 --- a/linuxthreads/sysdeps/pthread/pthread.h +++ b/linuxthreads/sysdeps/pthread/pthread.h @@ -41,7 +41,7 @@ __BEGIN_DECLS {0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __LOCK_INITIALIZER} #endif -#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0} +#define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER, 0, "", 0} #ifdef __USE_UNIX98 # define PTHREAD_RWLOCK_INITIALIZER \ diff --git a/linuxthreads/sysdeps/pthread/sigaction.c b/linuxthreads/sysdeps/pthread/sigaction.c new file mode 100644 index 0000000000..f4e20790d9 --- /dev/null +++ b/linuxthreads/sysdeps/pthread/sigaction.c @@ -0,0 +1,55 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2003. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This is tricky. GCC doesn't like #include_next in the primary + source file and even if it did, the first #include_next is this + exact file anyway. */ +#ifndef LIBC_SIGACTION + +# include <bits/libc-lock.h> + +# define LIBC_SIGACTION 1 + +# include <linuxthreads/sysdeps/pthread/sigaction.c> + +# ifndef NOT_IN_libc +# ifndef SHARED +weak_extern (__pthread_sigaction) +# endif + +int +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + return __libc_maybe_call2 (pthread_sigaction, (sig, act, oact), + __libc_sigaction (sig, act, oact)); +} +# else +weak_alias (__libc_sigaction, __sigaction) +# endif +libc_hidden_weak (__sigaction) +weak_alias (__sigaction, sigaction) + +#else + +# include_next <sigaction.c> + +#endif /* LIBC_SIGACTION */ diff --git a/linuxthreads/sysdeps/unix/sysv/linux/fork.c b/linuxthreads/sysdeps/unix/sysv/linux/fork.c index 49f1b088c5..443fb2b168 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/fork.c +++ b/linuxthreads/sysdeps/unix/sysv/linux/fork.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. @@ -21,7 +21,9 @@ #include <fork.h> #include <bits/libc-lock.h> +#ifndef SHARED weak_extern (__pthread_fork); +#endif struct fork_block __fork_block = { diff --git a/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c b/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c index 37cc4c2c0b..4b90315707 100644 --- a/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c +++ b/linuxthreads/sysdeps/unix/sysv/linux/jmp-unwind.c @@ -1,5 +1,5 @@ /* _longjmp_unwind -- Clean up stack frames unwound by longjmp. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -21,7 +21,9 @@ #include <stddef.h> #include <bits/libc-lock.h> +#ifndef SHARED weak_extern (__pthread_cleanup_upto); +#endif void _longjmp_unwind (jmp_buf env, int val) diff --git a/linuxthreads/sysdeps/unix/sysv/linux/raise.c b/linuxthreads/sysdeps/unix/sysv/linux/raise.c new file mode 100644 index 0000000000..9dad2b2697 --- /dev/null +++ b/linuxthreads/sysdeps/unix/sysv/linux/raise.c @@ -0,0 +1,36 @@ +/* Copyright (C) 1991, 1996, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <signal.h> +#include <unistd.h> +#include <bits/libc-lock.h> + +#ifndef SHARED +weak_extern (__pthread_raise) +#endif + +/* Raise the signal SIG. */ +int +raise (sig) + int sig; +{ + return __libc_maybe_call2 (pthread_raise, (sig), + __kill (__getpid (), sig)); +} +libc_hidden_def (raise) +weak_alias (raise, gsignal) diff --git a/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c b/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c new file mode 100644 index 0000000000..460d3d56a7 --- /dev/null +++ b/linuxthreads/sysdeps/unix/sysv/linux/sigwait.c @@ -0,0 +1,84 @@ +/* Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <errno.h> +#include <signal.h> +#define __need_NULL +#include <stddef.h> + +#include <sysdep-cancel.h> +#include <sys/syscall.h> +#include <bp-checks.h> +#include <bits/libc-lock.h> + +extern int __syscall_rt_sigtimedwait (const sigset_t *__unbounded, siginfo_t *__unbounded, + const struct timespec *__unbounded, size_t); + + +/* Return any pending signal or wait for one for the given time. */ +static inline int +do_sigwait (const sigset_t *set, int *sig) +{ + int ret; + + /* XXX The size argument hopefully will have to be changed to the + real size of the user-level sigset_t. */ +#ifdef INTERNAL_SYSCALL + ret = INTERNAL_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), + NULL, NULL, _NSIG / 8); + if (! INTERNAL_SYSCALL_ERROR_P (ret)) + { + *sig = ret; + ret = 0; + } + else + ret = INTERNAL_SYSCALL_ERRNO (ret); +#else + ret = INLINE_SYSCALL (rt_sigtimedwait, 4, CHECK_SIGSET (set), + NULL, NULL, _NSIG / 8); + if (ret != -1) + { + *sig = ret; + ret = 0; + } + else + ret = errno; +#endif + + return ret; +} + +#ifndef SHARED +weak_extern (__pthread_sigwait) +#endif + +int +__sigwait (set, sig) + const sigset_t *set; + int *sig; +{ +#ifndef NOT_IN_libc + return __libc_maybe_call2 (pthread_sigwait, (set, sig), + do_sigwait (set, sig)); +#else + return do_sigwait (set, sig); +#endif +} +libc_hidden_def (__sigwait) +weak_alias (__sigwait, sigwait) +strong_alias (__sigwait, __libc_sigwait) diff --git a/linuxthreads/tst-cancel-static.c b/linuxthreads/tst-cancel-static.c new file mode 100644 index 0000000000..1c879eba8b --- /dev/null +++ b/linuxthreads/tst-cancel-static.c @@ -0,0 +1 @@ +#include "tst-cancel4.c" diff --git a/linuxthreads/tst-cancel-wrappers.sh b/linuxthreads/tst-cancel-wrappers.sh index 2de0238cfa..4daf109a05 100644 --- a/linuxthreads/tst-cancel-wrappers.sh +++ b/linuxthreads/tst-cancel-wrappers.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test whether all cancellable functions are cancellable. -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. @@ -67,11 +67,12 @@ C["__xpg_sigpause"]=1 /:$/ { if (seen) { - # signals.c in linuxthreads does the cancellation checks not using - # *_{enable,disable}_asynccancel. + # signals.c and sigwait.c in linuxthreads do the cancellation checks + # not using *_{enable,disable}_asynccancel. # Similarly pt-system.o* is allowed to call __libc_system directly. if ((!seen_enable || !seen_disable) \ && !(object ~ /^signals.o/) \ + && !(object ~ /^sigwait.o/) \ && !(object ~ /^pt-system.o/)) { printf "in '$1'(%s) %s'\''s cancellation missing\n", object, seen |