diff options
44 files changed, 601 insertions, 133 deletions
@@ -1,3 +1,25 @@ +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. + 2003-01-02 Art Haas <ahaas@airmail.net> * login/tst-utmp.c: Convert GCC extension initializer syntax to C99. 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 diff --git a/nptl/ChangeLog b/nptl/ChangeLog index ec44dffa21..ab4702f08a 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,56 @@ +2003-01-02 Jakub Jelinek <jakub@redhat.com> + + * Versions [libc] (GLIBC_2.3.2): Export pthread_cond_broadcast, + pthread_cond_destroy, pthread_cond_init, pthread_cond_signal + and pthread_cond_wait. + * old_pthread_cond_broadcast.c (__old_pthread_cond_broadcast): + Renamed to... + (__pthread_cond_broadcast_2_0): ... this. + * old_pthread_cond_destroy.c (__old_pthread_cond_destroy): + Renamed to... + (__pthread_cond_destroy_2_0): ... this. + * old_pthread_cond_init.c (__old_pthread_cond_init): + Renamed to... + (__pthread_cond_init_2_0): ... this. + * old_pthread_cond_signal.c (__old_pthread_cond_signal): + Renamed to... + (__pthread_cond_signal_2_0): ... this. + * old_pthread_cond_wait.c (__old_pthread_cond_wait): + Renamed to... + (__pthread_cond_wait_2_0): ... this. + * pthread_cond_destroy.c: Include shlib-compat.h. + (pthread_cond_destroy): Change strong_alias into versioned_symbol. + * pthread_cond_init.c: Include shlib-compat.h. + (pthread_cond_init): Change strong_alias into versioned_symbol. + * pthreadP.h (struct pthread_functions): Rename ptr_pthread_cond_* + fields to ptr___pthread_cond_* and add ptr___pthread_cond_*_2_0 + fields. + (__pthread_cond_broadcast_2_0, __pthread_cond_destroy_2_0, + __pthread_cond_init_2_0, __pthread_cond_signal_2_0, + __pthread_cond_wait_2_0): New prototypes. + (__old_pthread_cond_broadcast, __old_pthread_cond_destroy, + __old_pthread_cond_init, __old_pthread_cond_signal, + __old_pthread_cond_wait): Removed. + * init.c: Include shlib-compat.h. + (pthread_functions): Guard ptr___pthread_attr_init_2_0 + initialization with SHLIB_COMPAT (GLIBC_2_0, GLIBC_2_1). + Rename ptr_pthread_cond_* to ptr___pthread_cond_*, initialize + ptr___pthread_cond_*_2_0 fields. + * forward.c: Export both pthread_cond_*@@GLIBC_2.3.2 and + pthread_cond_*@GLIBC_2.0 compatibility symbols. + + * sysdeps/pthread/sigaction.c (SIGCANCEL): Only define if + LIBC_SIGACTION was not yet defined. + [!defined LIBC_SIGACTION]: Define LIBC_SIGACTION, #include self. + [!defined LIBC_SIGACTION] (__sigaction): New function and + libc_hidden_weak. + [!defined LIBC_SIGACTION] (sigaction): New weak_alias. + [defined LIBC_SIGACTION]: #include_next <sigaction.c>. + +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/unix/sysv/linux/i386/bits/pthreadtypes.h (pthread_cond_t): diff --git a/nptl/Makefile b/nptl/Makefile index 274b1b2930..2a68c2e566 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -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. # The GNU C Library is free software; you can redistribute it and/or @@ -113,6 +113,8 @@ libpthread-shared-only-routines = pt-allocrtsig libpthread-nonshared = pthread_atfork +CFLAGS-pthread_atfork.c = -DNOT_IN_libc + # Don't generate deps for calls with no sources. See sysdeps/unix/Makefile. omit-deps = $(unix-syscalls:%=ptw-%) diff --git a/nptl/Versions b/nptl/Versions index 26655f37c1..436234a62d 100644 --- a/nptl/Versions +++ b/nptl/Versions @@ -19,6 +19,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; + } } libpthread { diff --git a/nptl/forward.c b/nptl/forward.c index a167bc1027..038eae8684 100644 --- a/nptl/forward.c +++ b/nptl/forward.c @@ -85,19 +85,54 @@ FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +FORWARD (__pthread_cond_broadcast_2_0, (pthread_cond_t *cond), (cond), 0) +compat_symbol (libc, __pthread_cond_broadcast_2_0, pthread_cond_broadcast, + GLIBC_2_0); +#endif +FORWARD (__pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) +versioned_symbol (libc, __pthread_cond_broadcast, pthread_cond_broadcast, + GLIBC_2_3_2); + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +FORWARD (__pthread_cond_destroy_2_0, (pthread_cond_t *cond), (cond), 0) +compat_symbol (libc, __pthread_cond_destroy_2_0, pthread_cond_destroy, + GLIBC_2_0); +#endif +FORWARD (__pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) +versioned_symbol (libc, __pthread_cond_destroy, pthread_cond_destroy, + GLIBC_2_3_2); -FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_init, +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +FORWARD (__pthread_cond_init_2_0, (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), (cond, cond_attr), 0) +compat_symbol (libc, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0); +#endif +FORWARD (__pthread_cond_init, + (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), + (cond, cond_attr), 0) +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_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +FORWARD (__pthread_cond_signal_2_0, (pthread_cond_t *cond), (cond), 0) +compat_symbol (libc, __pthread_cond_signal_2_0, pthread_cond_signal, + GLIBC_2_0); +#endif +FORWARD (__pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) +versioned_symbol (libc, __pthread_cond_signal, pthread_cond_signal, + GLIBC_2_3_2); + +#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2) +FORWARD (__pthread_cond_wait_2_0, + (pthread_cond_t *cond, pthread_mutex_t *mutex), (cond, mutex), 0) +compat_symbol (libc, __pthread_cond_wait_2_0, pthread_cond_wait, + GLIBC_2_0); +#endif +FORWARD (__pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), (cond, mutex), 0) +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/nptl/init.c b/nptl/init.c index b1d9a8a938..9a0c4fadcd 100644 --- a/nptl/init.c +++ b/nptl/init.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. @@ -30,6 +30,7 @@ #include <tls.h> #include <fork.h> #include <version.h> +#include <shlib-compat.h> /* XXX For the time being... */ @@ -56,7 +57,9 @@ extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign); static struct pthread_functions pthread_functions = { .ptr_pthread_attr_destroy = __pthread_attr_destroy, +#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1) .ptr___pthread_attr_init_2_0 = __pthread_attr_init_2_0, +#endif .ptr___pthread_attr_init_2_1 = __pthread_attr_init_2_1, .ptr_pthread_attr_getdetachstate = __pthread_attr_getdetachstate, .ptr_pthread_attr_setdetachstate = __pthread_attr_setdetachstate, @@ -70,11 +73,18 @@ 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, +#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) + .ptr___pthread_cond_broadcast_2_0 = __pthread_cond_broadcast_2_0, + .ptr___pthread_cond_destroy_2_0 = __pthread_cond_destroy_2_0, + .ptr___pthread_cond_init_2_0 = __pthread_cond_init_2_0, + .ptr___pthread_cond_signal_2_0 = __pthread_cond_signal_2_0, + .ptr___pthread_cond_wait_2_0 = __pthread_cond_wait_2_0, +#endif .ptr_pthread_equal = __pthread_equal, .ptr___pthread_exit = __pthread_exit, .ptr_pthread_getschedparam = __pthread_getschedparam, diff --git a/nptl/old_pthread_cond_broadcast.c b/nptl/old_pthread_cond_broadcast.c index 9d63af9a1d..86f8d5d4b7 100644 --- a/nptl/old_pthread_cond_broadcast.c +++ b/nptl/old_pthread_cond_broadcast.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. @@ -25,7 +25,7 @@ #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) int -__old_pthread_cond_broadcast (cond) +__pthread_cond_broadcast_2_0 (cond) pthread_cond_t *cond; { pthread_cond_t **realp = (pthread_cond_t **) cond; @@ -41,6 +41,6 @@ __old_pthread_cond_broadcast (cond) return __pthread_cond_broadcast (*realp); } -compat_symbol (libpthread, __old_pthread_cond_broadcast, +compat_symbol (libpthread, __pthread_cond_broadcast_2_0, pthread_cond_broadcast, GLIBC_2_0); #endif diff --git a/nptl/old_pthread_cond_destroy.c b/nptl/old_pthread_cond_destroy.c index 9afe7d323b..6f73f7cc57 100644 --- a/nptl/old_pthread_cond_destroy.c +++ b/nptl/old_pthread_cond_destroy.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. @@ -24,7 +24,7 @@ #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) int -__old_pthread_cond_destroy (cond) +__pthread_cond_destroy_2_0 (cond) pthread_cond_t *cond; { /* Free the memory which was eventually allocated. */ @@ -32,6 +32,6 @@ __old_pthread_cond_destroy (cond) return 0; } -compat_symbol (libpthread, __old_pthread_cond_destroy, pthread_cond_destroy, +compat_symbol (libpthread, __pthread_cond_destroy_2_0, pthread_cond_destroy, GLIBC_2_0); #endif diff --git a/nptl/old_pthread_cond_init.c b/nptl/old_pthread_cond_init.c index 70275d94df..309136eaab 100644 --- a/nptl/old_pthread_cond_init.c +++ b/nptl/old_pthread_cond_init.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. @@ -23,7 +23,7 @@ #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) int -__old_pthread_cond_init (cond, cond_attr) +__pthread_cond_init_2_0 (cond, cond_attr) pthread_cond_t *cond; const pthread_condattr_t *cond_attr; { @@ -38,6 +38,6 @@ __old_pthread_cond_init (cond, cond_attr) return 0; } -compat_symbol (libpthread, __old_pthread_cond_init, pthread_cond_init, +compat_symbol (libpthread, __pthread_cond_init_2_0, pthread_cond_init, GLIBC_2_0); #endif diff --git a/nptl/old_pthread_cond_signal.c b/nptl/old_pthread_cond_signal.c index 467812eb4b..869ac4d235 100644 --- a/nptl/old_pthread_cond_signal.c +++ b/nptl/old_pthread_cond_signal.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. @@ -25,7 +25,7 @@ #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) int -__old_pthread_cond_signal (cond) +__pthread_cond_signal_2_0 (cond) pthread_cond_t *cond; { pthread_cond_t **realp = (pthread_cond_t **) cond; @@ -41,6 +41,6 @@ __old_pthread_cond_signal (cond) return __pthread_cond_signal (*realp); } -compat_symbol (libpthread, __old_pthread_cond_signal, pthread_cond_signal, +compat_symbol (libpthread, __pthread_cond_signal_2_0, pthread_cond_signal, GLIBC_2_0); #endif diff --git a/nptl/old_pthread_cond_wait.c b/nptl/old_pthread_cond_wait.c index 4a7282f15f..4d4f9431d5 100644 --- a/nptl/old_pthread_cond_wait.c +++ b/nptl/old_pthread_cond_wait.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. @@ -25,7 +25,7 @@ #if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2) int -__old_pthread_cond_wait (cond, mutex) +__pthread_cond_wait_2_0 (cond, mutex) pthread_cond_t *cond; pthread_mutex_t *mutex; { @@ -42,6 +42,6 @@ __old_pthread_cond_wait (cond, mutex) return __pthread_cond_wait (*realp, mutex); } -compat_symbol (libpthread, __old_pthread_cond_wait, pthread_cond_wait, +compat_symbol (libpthread, __pthread_cond_wait_2_0, pthread_cond_wait, GLIBC_2_0); #endif diff --git a/nptl/pthreadP.h b/nptl/pthreadP.h index e4a90131d9..0a0e332f1c 100644 --- a/nptl/pthreadP.h +++ b/nptl/pthreadP.h @@ -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. @@ -88,11 +88,18 @@ 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_cond_broadcast_2_0) (pthread_cond_t *); + int (*ptr___pthread_cond_destroy_2_0) (pthread_cond_t *); + int (*ptr___pthread_cond_init_2_0) (pthread_cond_t *, + const pthread_condattr_t *); + int (*ptr___pthread_cond_signal_2_0) (pthread_cond_t *); + int (*ptr___pthread_cond_wait_2_0) (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 *); @@ -315,15 +322,15 @@ extern int __pthread_enable_asynccancel (void) attribute_hidden; extern void __pthread_disable_asynccancel (int oldtype) internal_function attribute_hidden; -extern int __old_pthread_cond_broadcast (pthread_cond_t *cond); -extern int __old_pthread_cond_destroy (pthread_cond_t *cond); -extern int __old_pthread_cond_init (pthread_cond_t *cond, +extern int __pthread_cond_broadcast_2_0 (pthread_cond_t *cond); +extern int __pthread_cond_destroy_2_0 (pthread_cond_t *cond); +extern int __pthread_cond_init_2_0 (pthread_cond_t *cond, const pthread_condattr_t *cond_attr); -extern int __old_pthread_cond_signal (pthread_cond_t *cond); +extern int __pthread_cond_signal_2_0 (pthread_cond_t *cond); extern int __old_pthread_cond_timedwait (pthread_cond_t *cond, pthread_mutex_t *mutex, const struct timespec *abstime); -extern int __old_pthread_cond_wait (pthread_cond_t *cond, +extern int __pthread_cond_wait_2_0 (pthread_cond_t *cond, pthread_mutex_t *mutex); /* The two functions are in libc.so and not exported. */ diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c index 130cb21402..5ade3e63db 100644 --- a/nptl/pthread_cond_destroy.c +++ b/nptl/pthread_cond_destroy.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. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <shlib-compat.h> #include "pthreadP.h" @@ -26,4 +27,5 @@ __pthread_cond_destroy (cond) { return 0; } -strong_alias (__pthread_cond_destroy, pthread_cond_destroy) +versioned_symbol (libpthread, __pthread_cond_destroy, + pthread_cond_destroy, GLIBC_2_3_2); diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c index cd762f2222..e079ae9235 100644 --- a/nptl/pthread_cond_init.c +++ b/nptl/pthread_cond_init.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. @@ -17,6 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <shlib-compat.h> #include "pthreadP.h" @@ -36,4 +37,5 @@ __pthread_cond_init (cond, cond_attr) return 0; } -strong_alias (__pthread_cond_init, pthread_cond_init) +versioned_symbol (libpthread, __pthread_cond_init, + pthread_cond_init, GLIBC_2_3_2); diff --git a/nptl/sysdeps/pthread/sigaction.c b/nptl/sysdeps/pthread/sigaction.c index c3f6f435dd..e3554ddb44 100644 --- a/nptl/sysdeps/pthread/sigaction.c +++ b/nptl/sysdeps/pthread/sigaction.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. @@ -17,8 +17,37 @@ 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 + /* We use the libc implementation but we tell it to not allow SIGCANCEL to be handled. */ -#define SIGCANCEL __SIGRTMIN +# define SIGCANCEL __SIGRTMIN +# define LIBC_SIGACTION 1 + +# include <nptl/sysdeps/pthread/sigaction.c> + +int +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; +{ + if (sig == SIGCANCEL) + { + __set_errno (EINVAL); + return -1; + } + + return __libc_sigaction (sig, act, oact); +} +libc_hidden_weak (__sigaction) +weak_alias (__sigaction, sigaction) + +#else + +# include_next <sigaction.c> -#include_next <sigaction.c> +#endif /* LIBC_SIGACTION */ diff --git a/sysdeps/unix/sysv/linux/arm/sigaction.c b/sysdeps/unix/sysv/linux/arm/sigaction.c index 40ecb3224e..46ff2b1599 100644 --- a/sysdeps/unix/sysv/linux/arm/sigaction.c +++ b/sysdeps/unix/sysv/linux/arm/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,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 @@ -149,6 +149,9 @@ __libc_sigaction (sig, act, oact) return result; } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) +#endif diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 361afbafcb..18a5f1ee65 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/i386. - Copyright (C) 1991,95,96,97,98,99,2000,02 Free Software Foundation, Inc. + Copyright (C) 1991,95,96,97,98,99,2000,02,03 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 @@ -154,27 +154,10 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) } libc_hidden_def (__libc_sigaction) -#ifndef SIGCANCEL +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) -#else -int -__sigaction (sig, act, oact) - int sig; - const struct sigaction *act; - struct sigaction *oact; -{ - if (sig == SIGCANCEL) - { - __set_errno (EINVAL); - return -1; - } - - return __libc_sigaction (sig, act, oact); -} -libc_hidden_weak (__sigaction) -weak_alias (__sigaction, sigaction) #endif /* NOTE: Please think twice before making any changes to the bits of diff --git a/sysdeps/unix/sysv/linux/ia64/sigaction.c b/sysdeps/unix/sysv/linux/ia64/sigaction.c index 21180d5c95..86558a588d 100644 --- a/sysdeps/unix/sysv/linux/ia64/sigaction.c +++ b/sysdeps/unix/sysv/linux/ia64/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Linux/IA64 specific sigaction Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999. @@ -50,6 +50,9 @@ __libc_sigaction (sig, act, oact) CHECK_1_NULL_OK (act), CHECK_1_NULL_OK (oact), _NSIG / 8); } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_def (__sigaction) weak_alias (__libc_sigaction, sigaction) +#endif diff --git a/sysdeps/unix/sysv/linux/mips/sigaction.c b/sysdeps/unix/sysv/linux/mips/sigaction.c index 0e5cfb7569..0dee8ccc7e 100644 --- a/sysdeps/unix/sysv/linux/mips/sigaction.c +++ b/sysdeps/unix/sysv/linux/mips/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,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 @@ -135,6 +135,9 @@ __libc_sigaction (sig, act, oact) #endif } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) +#endif diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c index 05ee189758..cba9f677e0 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 2001, 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 @@ -46,6 +46,9 @@ __libc_sigaction (sig, act, oact) return INLINE_SYSCALL (rt_sigaction, 4, sig, act, oact, _NSIG / 8); } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) +#endif diff --git a/sysdeps/unix/sysv/linux/sigaction.c b/sysdeps/unix/sysv/linux/sigaction.c index 0d07469e2a..2395abefb3 100644 --- a/sysdeps/unix/sysv/linux/sigaction.c +++ b/sysdeps/unix/sysv/linux/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1997,1998,1999,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 @@ -134,25 +134,8 @@ __libc_sigaction (sig, act, oact) } libc_hidden_def (__libc_sigaction) -#ifndef SIGCANCEL +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) -#else -int -__sigaction (sig, act, oact) - int sig; - const struct sigaction *act; - struct sigaction *oact; -{ - if (sig == SIGCANCEL) - { - __set_errno (EINVAL); - return -1; - } - - return __libc_sigaction (sig, act, oact); -} -libc_hidden_weak (__sigaction) -weak_alias (__sigaction, sigaction) #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c index a7a5bfda92..af34740e19 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 sigaction call for Linux/SPARC. - Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx), 1997. @@ -135,9 +135,12 @@ __libc_sigaction (int sig, __const struct sigaction *act, return -1; } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction); libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction); +#endif static void __rt_sigreturn_stub (void) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c index d69e1b3352..0a2d2c3dde 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 sigaction call for Linux/SPARC64. - Copyright (C) 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999,2000,2002,2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza (miguel@nuclecu.unam.mx) and Jakub Jelinek (jj@ultra.linux.cz). @@ -64,9 +64,12 @@ __libc_sigaction (int sig, __const struct sigaction *act, return ret; } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction); libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction); +#endif static void __rt_sigreturn_stub (void) diff --git a/sysdeps/unix/sysv/linux/x86_64/sigaction.c b/sysdeps/unix/sysv/linux/x86_64/sigaction.c index 36424bd31c..1d8ef6f34f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sigaction.c +++ b/sysdeps/unix/sysv/linux/x86_64/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/x86-64. - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 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 @@ -81,9 +81,12 @@ __libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact) return result; } libc_hidden_def (__libc_sigaction) + +#ifndef LIBC_SIGACTION weak_alias (__libc_sigaction, __sigaction) libc_hidden_weak (__sigaction) weak_alias (__libc_sigaction, sigaction) +#endif /* NOTE: Please think twice before making any changes to the bits of code below. GDB needs some intimate knowledge about it to |