diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-03-25 20:41:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-03-25 20:41:26 +0000 |
commit | 09402f5bc1d87787c84dbf75d41777c87b1ce40e (patch) | |
tree | d5be40f068434405ba1554389d73460fea0a1a0a | |
parent | 2a9ae45c3f89b4069e75c53f6dd32e8174b5cfd1 (diff) | |
download | glibc-09402f5bc1d87787c84dbf75d41777c87b1ce40e.zip glibc-09402f5bc1d87787c84dbf75d41777c87b1ce40e.tar.gz glibc-09402f5bc1d87787c84dbf75d41777c87b1ce40e.tar.bz2 |
Update.
2003-03-25 Ulrich Drepper <drepper@redhat.com>
* csu/tst-atomic.c: Adjust tests to what atomic_add_negative and
atomic_add_zero were supposed to do.
* include/atomic.h: Adjust atomic_add_negative and atomic_add_zero
to x86 behavior.
* sysdeps/generic/bits/typesizes.h (__TIMER_T_TYPE): Define as void*.
This matches the new timer implementation.
* sysdeps/unix/sysv/linux/bits/siginfo.h (struct siginfo): Adjust
timer info for what the kernel provides these days.
(struct sigevent): Add _tid field.
Define SIGEV_THREAD_ID.
* Versions.def (librt): Add GLIBC_2.3.3.
* abilist/libpthread.abilist: Update for nptl.
58 files changed, 1272 insertions, 58 deletions
@@ -1,3 +1,21 @@ +2003-03-25 Ulrich Drepper <drepper@redhat.com> + + * csu/tst-atomic.c: Adjust tests to what atomic_add_negative and + atomic_add_zero were supposed to do. + * include/atomic.h: Adjust atomic_add_negative and atomic_add_zero + to x86 behavior. + + * sysdeps/generic/bits/typesizes.h (__TIMER_T_TYPE): Define as void*. + This matches the new timer implementation. + * sysdeps/unix/sysv/linux/bits/siginfo.h (struct siginfo): Adjust + timer info for what the kernel provides these days. + (struct sigevent): Add _tid field. + Define SIGEV_THREAD_ID. + + * Versions.def (librt): Add GLIBC_2.3.3. + + * abilist/libpthread.abilist: Update for nptl. + 2003-03-24 Jon Grimm <jgrimm@us.ibm.com> * inet/netinet/in.h: Add IPPROTO_SCTP. diff --git a/Versions.def b/Versions.def index e8728b1..50bb28d 100644 --- a/Versions.def +++ b/Versions.def @@ -85,6 +85,7 @@ librt { GLIBC_2.1 GLIBC_2.2 GLIBC_2.3 + GLIBC_2.3.3 } libutil { GLIBC_2.0 diff --git a/abilist/libpthread.abilist b/abilist/libpthread.abilist index b60ad56..8074988 100644 --- a/abilist/libpthread.abilist +++ b/abilist/libpthread.abilist @@ -232,3 +232,10 @@ GLIBC_2.2 i.86-.*-linux.* ia64-.*-linux.* powerpc-.*-linux.* s390-.*-linux.* sh[ GLIBC_2.2 A GLIBC_2.3.2 i.86-.*-linux.* ia64-.*-linux.* powerpc-.*-linux.* s390-.*-linux.* sh[34].*-.*-linux.* x86_64-.*-linux.* GLIBC_2.3.2 A +GLIBC_2.3.3 i.86-.*-linux.* ia64-.*-linux.* powerpc-.*-linux.* s390-.*-linux.* sh[34].*-.*-linux.* x86_64-.*-linux.* + GLIBC_2.3.3 A + pthread_barrierattr_getpshared F + pthread_condattr_getclock F + pthread_condattr_setclock F + pthread_timedjoin_np F + pthread_tryjoin_np F diff --git a/bits/typesizes.h b/bits/typesizes.h index 6d6de21..2b9bd38 100644 --- a/bits/typesizes.h +++ b/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Generic version. - 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 @@ -54,7 +54,7 @@ #define __SWBLK_T_TYPE __SLONGWORD_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE #define __FSID_T_TYPE struct { int __val[2]; } diff --git a/csu/tst-atomic.c b/csu/tst-atomic.c index 292f6e7..e5686e3 100644 --- a/csu/tst-atomic.c +++ b/csu/tst-atomic.c @@ -178,9 +178,9 @@ do_test (void) ret = 1; } - mem = -10; - if (! atomic_add_negative (&mem, 12) - || mem != 2) + mem = -12; + if (! atomic_add_negative (&mem, 10) + || mem != -2) { puts ("atomic_add_negative test 1 failed"); ret = 1; @@ -210,9 +210,9 @@ do_test (void) ret = 1; } - mem = 0; + mem = -36; if (! atomic_add_zero (&mem, 36) - || mem != 36) + || mem != 0) { puts ("atomic_add_zero test 2 failed"); ret = 1; diff --git a/include/atomic.h b/include/atomic.h index afebb78..3a0ec3a 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -189,13 +189,15 @@ #ifndef atomic_add_negative # define atomic_add_negative(mem, value) \ - (atomic_exchange_and_add ((mem), (value)) < 0) + ({ __typeof (value) __value = (value); \ + atomic_exchange_and_add ((mem), __value) < -__value); }) #endif #ifndef atomic_add_zero # define atomic_add_zero(mem, value) \ - (atomic_exchange_and_add ((mem), (value)) == 0) + ({ __typeof (value) __value = (value); \ + atomic_exchange_and_add ((mem), __value) == -__value; }) #endif diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index d741a1e..f7467ab 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +2003-03-25 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/pthread/bits/typesizes.h: New file. + 2003-03-24 Daniel Jacobowitz <drow@mvista.com> * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h diff --git a/linuxthreads/sysdeps/pthread/bits/typesizes.h b/linuxthreads/sysdeps/pthread/bits/typesizes.h new file mode 100644 index 0000000..a95c41d --- /dev/null +++ b/linuxthreads/sysdeps/pthread/bits/typesizes.h @@ -0,0 +1,65 @@ +/* bits/typesizes.h -- underlying types for *_t. Generic version. + 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 + 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. */ + +#ifndef _BITS_TYPES_H +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead." +#endif + +#ifndef _BITS_TYPESIZES_H +#define _BITS_TYPESIZES_H 1 + +/* See <bits/types.h> for the meaning of these macros. This file exists so + that <bits/types.h> need not vary across different GNU platforms. */ + +#define __DEV_T_TYPE __UQUAD_TYPE +#define __UID_T_TYPE __U32_TYPE +#define __GID_T_TYPE __U32_TYPE +#define __INO_T_TYPE __ULONGWORD_TYPE +#define __INO64_T_TYPE __UQUAD_TYPE +#define __MODE_T_TYPE __U32_TYPE +#define __NLINK_T_TYPE __UWORD_TYPE +#define __OFF_T_TYPE __SLONGWORD_TYPE +#define __OFF64_T_TYPE __SQUAD_TYPE +#define __PID_T_TYPE __S32_TYPE +#define __RLIM_T_TYPE __ULONGWORD_TYPE +#define __RLIM64_T_TYPE __UQUAD_TYPE +#define __BLKCNT_T_TYPE __SLONGWORD_TYPE +#define __BLKCNT64_T_TYPE __SQUAD_TYPE +#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE +#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE +#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE +#define __FSFILCNT64_T_TYPE __UQUAD_TYPE +#define __ID_T_TYPE __U32_TYPE +#define __CLOCK_T_TYPE __SLONGWORD_TYPE +#define __TIME_T_TYPE __SLONGWORD_TYPE +#define __USECONDS_T_TYPE __U32_TYPE +#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __DADDR_T_TYPE __S32_TYPE +#define __SWBLK_T_TYPE __SLONGWORD_TYPE +#define __KEY_T_TYPE __S32_TYPE +#define __CLOCKID_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE __S32_TYPE +#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE +#define __FSID_T_TYPE struct { int __val[2]; } + +/* Number of descriptors that can fit in an `fd_set'. */ +#define __FD_SETSIZE 1024 + + +#endif /* bits/typesizes.h */ diff --git a/nptl/ChangeLog b/nptl/ChangeLog index fe24582..3138047 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,63 @@ +2003-03-25 Ulrich Drepper <drepper@redhat.com> + + * pthreadP.h: Define SIGCANCEL and SIGTIMER. + * sysdeps/i386/pthreaddef.h: Remove SIGCANCEL definition. + * sysdeps/ia64/pthreaddef.h: Likewise. + * sysdeps/powerpc/pthreaddef.h: Likewise. + * sysdeps/s390/pthreaddef.h: Likewise. + * sysdeps/sh/pthreaddef.h: Likewise. + * sysdeps/x86_64/pthreaddef.h: Likewise. + * init.c (__pthread_initialize_minimal): Block SIGTIMER. + * sysdeps/pthread/sigaction.c: Also prevent SIGTIMER handler from + being changed. + * sysdeps/pthread/pthread_sigmask.c (pthread_sigmask): Make sure + SIGTIMER is not unblocked. + * sysdeps/unix/sysv/linux/allocrtsig.c (current_rtmin): One more + RT signal taken. + * sysdeps/unix/sysv/linux/pthread_kill.c: Do not allow SIGTIMER to + be send. + * sysdeps/pthread/posix-timer.h (timer_id2ptr, timer_ptr2id): Just + pass pointer through as ID. + * sysdeps/unix/sysv/linux/bits/local_lim.h (TIMER_MAX): Removed. + * sysdeps/unix/sysv/linux/kernel-posix-timers.h: New file. + * sysdeps/unix/sysv/linux/timer_create.c: New file. + * sysdeps/unix/sysv/linux/timer_delete.c: New file. + * sysdeps/unix/sysv/linux/timer_getoverr.c: New file. + * sysdeps/unix/sysv/linux/timer_gettime.c: New file. + * sysdeps/unix/sysv/linux/timer_routines.c: New file. + * sysdeps/unix/sysv/linux/timer_settime.c: New file. + * sysdeps/unix/sysv/linux/ia64/Versions: New file. + * sysdeps/unix/sysv/linux/ia64/timer_create.c: New file. + * sysdeps/unix/sysv/linux/ia64/timer_delete.c: New file. + * sysdeps/unix/sysv/linux/ia64/timer_getoverr.c: New file. + * sysdeps/unix/sysv/linux/ia64/timer_gettime.c: New file. + * sysdeps/unix/sysv/linux/ia64/timer_settime.c: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_create.c: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_delete.c: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_getoverr.c: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_gettime.c: New file. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_settime.c: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/Versions: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/timer_create.c: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/timer_delete.c: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/timer_getoverr.c: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/timer_gettime.c: New file. + * sysdeps/unix/sysv/linux/s390/s390-64/timer_settime.c: New file. + * sysdeps/unix/sysv/linux/x86_64/Versions: New file. + * sysdeps/unix/sysv/linux/x86_64/compat-timer.h: New file. + * sysdeps/unix/sysv/linux/x86_64/timer_create.c: New file. + * sysdeps/unix/sysv/linux/x86_64/timer_delete.c: New file. + * sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c: New file. + * sysdeps/unix/sysv/linux/x86_64/timer_gettime.c: New file. + * sysdeps/unix/sysv/linux/x86_64/timer_settime.c: New file. + + * pthreadP.h: Remove FRAME_LEFT definition. + * cleanup.c (_pthread_cleanup_push): Don't check for reference to + already left frame. Programs which have this problem are not POSIX + compliant. + * cleanup_defer.c (_pthread_cleanup_push_defer): Likewise. + 2003-03-24 Ulrich Drepper <drepper@redhat.com> * sysdeps/pthread/tst-timer.c: Check return values of the diff --git a/nptl/cleanup.c b/nptl/cleanup.c index fd372b6..a25b397 100644 --- a/nptl/cleanup.c +++ b/nptl/cleanup.c @@ -33,9 +33,6 @@ _pthread_cleanup_push (buffer, routine, arg) buffer->__arg = arg; buffer->__prev = THREAD_GETMEM (self, cleanup); - if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev)) - buffer->__prev = NULL; - THREAD_SETMEM (self, cleanup, buffer); } strong_alias (_pthread_cleanup_push, __pthread_cleanup_push) diff --git a/nptl/cleanup_defer.c b/nptl/cleanup_defer.c index b72553b..5d6ed03 100644 --- a/nptl/cleanup_defer.c +++ b/nptl/cleanup_defer.c @@ -33,9 +33,6 @@ _pthread_cleanup_push_defer (buffer, routine, arg) buffer->__arg = arg; buffer->__prev = THREAD_GETMEM (self, cleanup); - if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev)) - buffer->__prev = NULL; - int cancelhandling = THREAD_GETMEM (self, cancelhandling); /* Disable asynchronous cancellation for now. */ diff --git a/nptl/init.c b/nptl/init.c index 4237c6e..2c85d87 100644 --- a/nptl/init.c +++ b/nptl/init.c @@ -225,6 +225,16 @@ __pthread_initialize_minimal_internal (void) NULL, _NSIG / 8); + /* The kernel supported POSIX timer handling needs a signal to implement + SIGEV_THREAD. We block the signal everywhere but we have to make + sure it is not ignored. The signal is a realtime signal so using + the default handler is fine (this handler is already selected). */ + __sigdelset (&sa.sa_mask, SIGCANCEL); + __sigaddset (&sa.sa_mask, SIGTIMER); + (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &sa.sa_mask, + NULL, _NSIG / 8); + + /* Determine the default allowed stack size. This is the size used in case the user does not specify one. */ struct rlimit limit; diff --git a/nptl/sysdeps/i386/pthreaddef.h b/nptl/sysdeps/i386/pthreaddef.h index 1fe9455..43b771c 100644 --- a/nptl/sysdeps/i386/pthreaddef.h +++ b/nptl/sysdeps/i386/pthreaddef.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. @@ -30,9 +30,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 16 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. */ #define CURRENT_STACK_FRAME __builtin_frame_address (0) diff --git a/nptl/sysdeps/ia64/pthreaddef.h b/nptl/sysdeps/ia64/pthreaddef.h index 8fc58e0..f2539e2 100644 --- a/nptl/sysdeps/ia64/pthreaddef.h +++ b/nptl/sysdeps/ia64/pthreaddef.h @@ -31,9 +31,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 16 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. */ #define CURRENT_STACK_FRAME __stack_pointer diff --git a/nptl/sysdeps/powerpc/pthreaddef.h b/nptl/sysdeps/powerpc/pthreaddef.h index b28d0be..342c15c 100644 --- a/nptl/sysdeps/powerpc/pthreaddef.h +++ b/nptl/sysdeps/powerpc/pthreaddef.h @@ -29,9 +29,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 16 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. */ #define CURRENT_STACK_FRAME __builtin_frame_address (0) diff --git a/nptl/sysdeps/pthread/posix-timer.h b/nptl/sysdeps/pthread/posix-timer.h index 6710291..bc0c57f 100644 --- a/nptl/sysdeps/pthread/posix-timer.h +++ b/nptl/sysdeps/pthread/posix-timer.h @@ -1,5 +1,5 @@ /* Definitions for POSIX timer implementation on top of LinuxThreads. - Copyright (C) 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Kaz Kylheku <kaz@ashi.footprints.net>. @@ -94,6 +94,7 @@ extern struct thread_node __timer_signal_thread_tclk; /* Return pointer to timer structure corresponding to ID. */ +#if 0 static inline struct timer_node * timer_id2ptr (timer_t timerid) { @@ -109,6 +110,10 @@ timer_ptr2id (struct timer_node *timer) { return timer - __timer_array; } +#else +# define timer_id2ptr(timerid) ((struct timed_node *) timerid) +# define timer_ptr2id(timerid) ((void *) timerid) +#endif /* Check whether timer is valid; global mutex must be held. */ static inline int diff --git a/nptl/sysdeps/pthread/pthread_sigmask.c b/nptl/sysdeps/pthread/pthread_sigmask.c index 4114e0b..df6ac64 100644 --- a/nptl/sysdeps/pthread/pthread_sigmask.c +++ b/nptl/sysdeps/pthread/pthread_sigmask.c @@ -32,13 +32,36 @@ pthread_sigmask (how, newmask, oldmask) sigset_t local_newmask; /* The only thing we have to make sure here is that SIGCANCEL is not - blocked. */ - if (newmask != NULL - && __builtin_expect (__sigismember (newmask, SIGCANCEL), 0)) + blocked and that SIGTIMER is not unblocked. */ + if (newmask != NULL) { - local_newmask = *newmask; - sigdelset (&local_newmask, SIGCANCEL); - newmask = &local_newmask; + if (__builtin_expect (__sigismember (newmask, SIGCANCEL), 0)) + { + local_newmask = *newmask; + __sigdelset (&local_newmask, SIGCANCEL); + newmask = &local_newmask; + } + + if (__builtin_expect (__sigismember (newmask, SIGTIMER), 0)) + { + if (how == SIG_UNBLOCK) + { + if (newmask != &local_newmask) + local_newmask = *newmask; + __sigdelset (&local_newmask, SIGTIMER); + newmask = &local_newmask; + } + } + else + { + if (how == SIG_SETMASK) + { + if (newmask != &local_newmask) + local_newmask = *newmask; + __sigaddset (&local_newmask, SIGTIMER); + newmask = &local_newmask; + } + } } #ifdef INTERNAL_SYSCALL diff --git a/nptl/sysdeps/pthread/sigaction.c b/nptl/sysdeps/pthread/sigaction.c index e3554dd..d69abf0 100644 --- a/nptl/sysdeps/pthread/sigaction.c +++ b/nptl/sysdeps/pthread/sigaction.c @@ -22,9 +22,10 @@ exact file anyway. */ #ifndef LIBC_SIGACTION +#include <nptl/pthreadP.h> + /* We use the libc implementation but we tell it to not allow - SIGCANCEL to be handled. */ -# define SIGCANCEL __SIGRTMIN + SIGCANCEL or SIGTIMER to be handled. */ # define LIBC_SIGACTION 1 # include <nptl/sysdeps/pthread/sigaction.c> @@ -35,7 +36,7 @@ __sigaction (sig, act, oact) const struct sigaction *act; struct sigaction *oact; { - if (sig == SIGCANCEL) + if (sig == SIGCANCEL || sig == SIGTIMER) { __set_errno (EINVAL); return -1; diff --git a/nptl/sysdeps/s390/pthreaddef.h b/nptl/sysdeps/s390/pthreaddef.h index ff044a3..6569e2a 100644 --- a/nptl/sysdeps/s390/pthreaddef.h +++ b/nptl/sysdeps/s390/pthreaddef.h @@ -29,9 +29,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 16 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. */ #define CURRENT_STACK_FRAME __builtin_frame_address (0) diff --git a/nptl/sysdeps/sh/pthreaddef.h b/nptl/sysdeps/sh/pthreaddef.h index c66e838..70c6a85 100644 --- a/nptl/sysdeps/sh/pthreaddef.h +++ b/nptl/sysdeps/sh/pthreaddef.h @@ -30,9 +30,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 8 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. */ #define CURRENT_STACK_FRAME __builtin_frame_address (0) diff --git a/nptl/sysdeps/unix/sysv/linux/allocrtsig.c b/nptl/sysdeps/unix/sysv/linux/allocrtsig.c index e3622c6..2654169 100644 --- a/nptl/sysdeps/unix/sysv/linux/allocrtsig.c +++ b/nptl/sysdeps/unix/sysv/linux/allocrtsig.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. @@ -20,7 +20,7 @@ #include <signal.h> -static int current_rtmin = __SIGRTMIN + 1; +static int current_rtmin = __SIGRTMIN + 2; static int current_rtmax = __SIGRTMAX; diff --git a/nptl/sysdeps/unix/sysv/linux/bits/local_lim.h b/nptl/sysdeps/unix/sysv/linux/bits/local_lim.h index 90564cb..7f44549 100644 --- a/nptl/sysdeps/unix/sysv/linux/bits/local_lim.h +++ b/nptl/sysdeps/unix/sysv/linux/bits/local_lim.h @@ -73,9 +73,6 @@ /* Minimum size for a thread. We are free to choose a reasonable value. */ #define PTHREAD_STACK_MIN 16384 -/* Maximum number of POSIX timers available. */ -#define TIMER_MAX 256 - /* Maximum number of timer expiration overruns. */ #define DELAYTIMER_MAX 2147483647 diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/Versions b/nptl/sysdeps/unix/sysv/linux/ia64/Versions new file mode 100644 index 0000000..3b111dd --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/Versions @@ -0,0 +1,7 @@ +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/ia64/timer_create.c new file mode 100644 index 0000000..172223a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/timer_create.c @@ -0,0 +1 @@ +#include "../x86_64/timer_create.c" diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/timer_delete.c b/nptl/sysdeps/unix/sysv/linux/ia64/timer_delete.c new file mode 100644 index 0000000..537516e --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/timer_delete.c @@ -0,0 +1 @@ +#include "../x86_64/timer_delete.c" diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/timer_getoverr.c b/nptl/sysdeps/unix/sysv/linux/ia64/timer_getoverr.c new file mode 100644 index 0000000..3f21a73 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/timer_getoverr.c @@ -0,0 +1 @@ +#include "../x86_64/timer_getoverr.c" diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/timer_gettime.c b/nptl/sysdeps/unix/sysv/linux/ia64/timer_gettime.c new file mode 100644 index 0000000..a50143a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/timer_gettime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_gettime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/timer_settime.c b/nptl/sysdeps/unix/sysv/linux/ia64/timer_settime.c new file mode 100644 index 0000000..37baeff --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/ia64/timer_settime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_settime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h new file mode 100644 index 0000000..6e7e029 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h @@ -0,0 +1,62 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <pthread.h> +#include <setjmp.h> +#include <signal.h> + + +/* Nonzero if the system calls are not available. */ +extern int __no_posix_timers attribute_hidden; + +/* Helper function to implement SIGEV_THREAD. */ +extern void *__timer_helper_thread (void *arg) attribute_hidden; + + +/* Type of timers in the kernel. */ +typedef int kernel_timer_t; + + +/* Internal representation of timer. */ +struct timer +{ + /* Notification mechanism. */ + int sigev_notify; + + /* Timer ID returned by the kernel. */ + kernel_timer_t ktimerid; + + /* All new elements must be added after ktimerid. And if the thrfunc + element is not the third element anymore the memory allocation in + timer_create needs to be changed. */ + + /* Parameters for the thread to be started for SIGEV_THREAD. */ + void (*thrfunc) (sigval_t); + sigval_t sival; + pthread_attr_t attr; + + /* Id of the helper thread. */ + pthread_t th; + + /* Barrier used for synchronization. */ + pthread_barrier_t bar; +}; + +/* This is the signal the kernel will send to the helper thread. */ +#define TIMER_SIG 40 /* some RT signal */ diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions new file mode 100644 index 0000000..3b111dd --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions @@ -0,0 +1,7 @@ +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_create.c new file mode 100644 index 0000000..172223a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_create.c @@ -0,0 +1 @@ +#include "../x86_64/timer_create.c" diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_delete.c b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_delete.c new file mode 100644 index 0000000..537516e --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_delete.c @@ -0,0 +1 @@ +#include "../x86_64/timer_delete.c" diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_getoverr.c b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_getoverr.c new file mode 100644 index 0000000..3f21a73 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_getoverr.c @@ -0,0 +1 @@ +#include "../x86_64/timer_getoverr.c" diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_gettime.c b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_gettime.c new file mode 100644 index 0000000..a50143a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_gettime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_gettime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_settime.c b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_settime.c new file mode 100644 index 0000000..37baeff --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_settime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_settime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c index a35a3f0..8da195a 100644 --- a/nptl/sysdeps/unix/sysv/linux/pthread_kill.c +++ b/nptl/sysdeps/unix/sysv/linux/pthread_kill.c @@ -37,7 +37,7 @@ __pthread_kill (threadid, signo) return ESRCH; /* Disallow sending the signal we use for cancellation. */ - if (signo == SIGCANCEL) + if (signo == SIGCANCEL || signo == SIGTIMER) return EINVAL; /* We have a special syscall to do the work. */ diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/Versions b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/Versions new file mode 100644 index 0000000..3b111dd --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/Versions @@ -0,0 +1,7 @@ +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_create.c new file mode 100644 index 0000000..172223a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_create.c @@ -0,0 +1 @@ +#include "../x86_64/timer_create.c" diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_delete.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_delete.c new file mode 100644 index 0000000..537516e --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_delete.c @@ -0,0 +1 @@ +#include "../x86_64/timer_delete.c" diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_getoverr.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_getoverr.c new file mode 100644 index 0000000..3f21a73 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_getoverr.c @@ -0,0 +1 @@ +#include "../x86_64/timer_getoverr.c" diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_gettime.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_gettime.c new file mode 100644 index 0000000..a50143a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_gettime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_gettime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_settime.c b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_settime.c new file mode 100644 index 0000000..37baeff --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_settime.c @@ -0,0 +1 @@ +#include "../x86_64/timer_settime.c" diff --git a/nptl/sysdeps/unix/sysv/linux/timer_create.c b/nptl/sysdeps/unix/sysv/linux/timer_create.c new file mode 100644 index 0000000..637d925 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_create.c @@ -0,0 +1,235 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include <internaltypes.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_create +# ifndef __ASSUME_POSIX_TIMERS +# define timer_create static compat_timer_create +# include <nptl/sysdeps/pthread/timer_create.c> +# undef timer_create + +/* Nonzero if the system calls are not available. */ +int __no_posix_timers attribute_hidden; +# endif + +# ifdef timer_create_alias +# define timer_create timer_create_alias +# endif + + +int +timer_create (clock_id, evp, timerid) + clockid_t clock_id; + struct sigevent *evp; + timer_t *timerid; +{ +# undef timer_create +# ifndef __ASSUME_POSIX_TIMERS + if (__no_posix_timers >= 0) +# endif + { + /* If the user wants notification via a thread we need to handle + this special. */ + if (evp == NULL + || __builtin_expect (evp->sigev_notify != SIGEV_THREAD, 1)) + { + kernel_timer_t ktimerid; + int retval = INLINE_SYSCALL (timer_create, 3, clock_id, evp, + &ktimerid); + +# ifndef __ASSUME_POSIX_TIMERS + if (retval != -1 || errno != ENOSYS) +# endif + { +# ifndef __ASSUME_POSIX_TIMERS + __no_posix_timers = 1; +#endif + + if (retval != -1) + { + struct timer *newp; + + /* We avoid allocating too much memory by basically + using struct timer as a derived class with the + first two elements being in the superclass. We only + need these two elements here. */ + newp = (struct timer *) malloc (offsetof (struct timer, + thrfunc)); + if (newp != NULL) + { + newp->sigev_notify = (evp != NULL + ? evp->sigev_notify + : SIGEV_SIGNAL); + newp->ktimerid = ktimerid; + + *timerid = (timer_t) newp; + } + else + { + /* No memory. Free the kernel timer. */ + INTERNAL_SYSCALL_DECL (err); + (void) INTERNAL_SYSCALL (timer_delete, err, 1, ktimerid); + + retval = -1; + } + } + + return retval; + } + } + else + { +#ifndef __ASSUME_POSIX_TIMERS + /* Make sure we have the necessary kernel support. */ + if (__no_posix_timers == 0) + { + INTERNAL_SYSCALL_DECL (err); + struct timespec ts; + int res = INTERNAL_SYSCALL (clock_getres, err, 1, &ts); + __no_posix_timers = (INTERNAL_SYSCALL_ERROR_P (res, err) + ? -1 : 1); + } + + if (__no_posix_timers > 0) +#endif + { + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, TIMER_SIG); + pthread_sigmask (SIG_BLOCK, &ss, NULL); + struct timer *newp; + + newp = (struct timer *) malloc (sizeof (struct timer)); + if (newp == NULL) + return -1; + + /* Copy the thread parameters the user provided. */ + newp->sival = evp->sigev_value; + newp->thrfunc = evp->sigev_notify_function; + + /* We cannot simply copy the thread attributes since the + implementation might keep internal information for + each instance. */ + (void) pthread_attr_init (&newp->attr); + if (evp->sigev_notify_attributes != NULL) + { + struct pthread_attr *nattr; + struct pthread_attr *oattr; + + nattr = (struct pthread_attr *) &newp->attr; + oattr = (struct pthread_attr *) evp->sigev_notify_attributes; + + nattr->schedparam = oattr->schedparam; + nattr->schedpolicy = oattr->schedpolicy; + nattr->flags = oattr->flags; + nattr->guardsize = oattr->guardsize; + nattr->stackaddr = oattr->stackaddr; + nattr->stacksize = oattr->stacksize; + } + + /* In any case set the detach flag. */ + (void) pthread_attr_setdetachstate (&newp->attr, + PTHREAD_CREATE_DETACHED); + + /* Set up the barrier for sychronization. */ + (void) pthread_barrier_init (&newp->bar, NULL, 2); + + /* The helper thread needs only very little resources + and should go away automatically when canceled. */ + pthread_attr_t attr; + (void) pthread_attr_init (&attr); + (void) pthread_attr_setdetachstate (&attr, + PTHREAD_CREATE_DETACHED); + (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); + + /* Create the helper thread for this timer. */ + int res = pthread_create (&newp->th, &attr, + __timer_helper_thread, newp); + if (res != 0) + goto err_out; + + /* No need for the attribute anymore. */ + (void) pthread_attr_destroy (&attr); + + /* Create the event structure for the kernel timer. */ + struct sigevent sev; + sev.sigev_value.sival_ptr = newp; + sev.sigev_signo = TIMER_SIG; + sev.sigev_notify = SIGEV_SIGNAL | SIGEV_THREAD_ID; + /* This is the thread ID of the helper thread. */ + sev._sigev_un._pad[0] = ((struct pthread *) newp->th)->tid; + + /* Wait until the helper thread is set up. */ + (void) pthread_barrier_wait (&newp->bar); + + /* No need for the barrier anymore. */ + (void) pthread_barrier_destroy (&newp->bar); + + /* Create the timer. */ + INTERNAL_SYSCALL_DECL (err); + res = INTERNAL_SYSCALL (timer_create, err, 3, clock_id, &sev, + &newp->ktimerid); + if (! INTERNAL_SYSCALL_ERROR_P (res, err)) + { + *timerid = (timer_t) newp; + return 0; + } + + /* Something went wrong. Kill the thread. */ + pthread_cancel (newp->th); + /* Free the resources. */ + res = INTERNAL_SYSCALL_ERRNO (res, err); + err_out: + free (newp); + __set_errno (res); + return -1; + } + } + +# ifndef __ASSUME_POSIX_TIMERS + /* When we come here the syscall does not exist. Make sure we + do not try to use it again. */ + __no_posix_timers = -1; +# endif + } + +# ifndef __ASSUME_POSIX_TIMERS + /* Compatibility code. */ + return compat_timer_create (clock_id, evp, timerid); +# endif +} +#else +# ifdef timer_create_alias +# define timer_create timer_create_alias +# endif +/* The new system calls are not available. Use the userlevel + implementation. */ +# include <nptl/sysdeps/pthread/timer_create.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/timer_delete.c b/nptl/sysdeps/unix/sysv/linux/timer_delete.c new file mode 100644 index 0000000..cf63364 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_delete.c @@ -0,0 +1,94 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <stdlib.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_delete +# ifndef __ASSUME_POSIX_TIMERS +# define timer_delete static compat_timer_delete +# include <nptl/sysdeps/pthread/timer_delete.c> +# undef timer_delete +# endif + +# ifdef timer_delete_alias +# define timer_delete timer_delete_alias +# endif + + +int +timer_delete (timerid) + timer_t timerid; +{ +# undef timer_delete +# ifndef __ASSUME_POSIX_TIMERS + if (__no_posix_timers >= 0) +# endif + { + struct timer *kt = (struct timer *) timerid; + + /* Delete the kernel timer object. */ + int res = INLINE_SYSCALL (timer_delete, 1, kt->ktimerid); + + if (res == 0) + { +# ifndef __ASSUME_POSIX_TIMERS + /* We know the syscall support is available. */ + __no_posix_timers = 1; +# endif + + /* We have to get rid of the helper thread if we created one. */ + if (kt->sigev_notify == SIGEV_THREAD) + (void) pthread_cancel (kt->th); + + /* Free the memory. */ + (void) free (kt); + + return 0; + } + + /* The kernel timer is not known or something else bad happened. + Return the error. */ +# ifndef __ASSUME_POSIX_TIMERS + if (errno != ENOSYS) +# endif + return -1; + +# ifndef __ASSUME_POSIX_TIMERS + __no_posix_timers = -1; +# endif + } + +# ifndef __ASSUME_POSIX_TIMERS + return compat_timer_delete (timerid); +# endif +} +#else +# ifdef timer_delete_alias +# define timer_delete timer_delete_alias +# endif +/* The new system calls are not available. Use the userlevel + implementation. */ +# include <nptl/sysdeps/pthread/timer_delete.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/timer_getoverr.c b/nptl/sysdeps/unix/sysv/linux/timer_getoverr.c new file mode 100644 index 0000000..40b485f --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_getoverr.c @@ -0,0 +1,80 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_getoverrun +# ifndef __ASSUME_POSIX_TIMERS +# define timer_getoverrun static compat_timer_getoverrun +# include <nptl/sysdeps/pthread/timer_getoverrun.c> +# undef timer_getoverrun +# endif + +# ifdef timer_getoverrun_alias +# define timer_getoverrun timer_getoverrun_alias +# endif + + +int +timer_getoverrun (timerid) + timer_t timerid; +{ +# undef timer_getoverrun +# ifndef __ASSUME_POSIX_TIMERS + if (__no_posix_timers == 0) +# endif + { + struct timer *kt = (struct timer *) timerid; + + /* Get the information from the kernel. */ + int res = INLINE_SYSCALL (timer_getoverrun, 1, kt->ktimerid); + +# ifndef __ASSUME_POSIX_TIMERS + if (res != -1 || errno != ENOSYS) + { + /* We know the syscall support is available. */ + __no_posix_timers = 1; +# endif + return res; +# ifndef __ASSUME_POSIX_TIMERS + } +# endif + +# ifndef __ASSUME_POSIX_TIMERS + __no_posix_timers = -1; +# endif + } + +# ifndef __ASSUME_POSIX_TIMERS + return compat_timer_getoverrun (timerid); +# endif +} +#else +# ifdef timer_getoverrun_alias +# define timer_getoverrun timer_getoverrun_alias +# endif +/* The new system calls are not available. Use the userlevel + implementation. */ +# include <nptl/sysdeps/pthread/timer_getoverr.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/timer_gettime.c b/nptl/sysdeps/unix/sysv/linux/timer_gettime.c new file mode 100644 index 0000000..6da1571 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_gettime.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <stdlib.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_gettime +# ifndef __ASSUME_POSIX_TIMERS +# define timer_gettime static compat_timer_gettime +# include <nptl/sysdeps/pthread/timer_gettime.c> +# undef timer_gettime +# endif + +# ifdef timer_gettime_alias +# define timer_gettime timer_gettime_alias +# endif + + +int +timer_gettime (timerid, value) + timer_t timerid; + struct itimerspec *value; +{ +# undef timer_gettime +# ifndef __ASSUME_POSIX_TIMERS + if (__no_posix_timers == 0) +# endif + { + struct timer *kt = (struct timer *) timerid; + + /* Delete the kernel timer object. */ + int res = INLINE_SYSCALL (timer_gettime, 2, kt->ktimerid, value); + +# ifndef __ASSUME_POSIX_TIMERS + if (res != -1 || errno != ENOSYS) + { + /* We know the syscall support is available. */ + __no_posix_timers = 1; +# endif + return res; +# ifndef __ASSUME_POSIX_TIMERS + } +# endif + +# ifndef __ASSUME_POSIX_TIMERS + __no_posix_timers = -1; +# endif + } + +# ifndef __ASSUME_POSIX_TIMERS + return compat_timer_gettime (timerid, value); +# endif +} +#else +# ifdef timer_gettime_alias +# define timer_gettime timer_gettime_alias +# endif +/* The new system calls are not available. Use the userlevel + implementation. */ +# include <nptl/sysdeps/pthread/timer_gettime.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/nptl/sysdeps/unix/sysv/linux/timer_routines.c new file mode 100644 index 0000000..3f69aa6 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_routines.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <setjmp.h> +#include <signal.h> +#include <stdbool.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_create +/* Helper thread to call the user-provided function. */ +static void * +timer_sigev_thread (void *arg) +{ + struct timer *tk = (struct timer *) arg; + + /* Call the user-provided function. */ + tk->thrfunc (tk->sival); + + return NULL; +} + + +/* Helper function to support starting threads for SIGEV_THREAD. */ +void * +attribute_hidden +__timer_helper_thread (void *arg) +{ + /* Block all signals. */ + sigset_t ss; + + sigfillset (&ss); + (void) pthread_sigmask (SIG_BLOCK, &ss, NULL); + + struct timer *tk = (struct timer *) arg; + + /* Synchronize with the parent. */ + (void) pthread_barrier_wait (&tk->bar); + + /* We will only wait for the signal the kernel will send. */ + sigemptyset (&ss); + sigaddset (&ss, TIMER_SIG); + + /* Endless loop of waiting for signals. The loop is only ended when + the thread is canceled. */ + while (1) + { + siginfo_t si; + + if (sigwaitinfo (&ss, &si) > 0 && si.si_timerid == tk->ktimerid) + { + /* That the signal we are waiting for. */ + pthread_t th; + (void) pthread_create (&th, &tk->attr, timer_sigev_thread, arg); + } + } +} + +#endif + +#ifndef __ASSUME_POSIX_TIMERS +# include <nptl/sysdeps/pthread/timer_routines.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/timer_settime.c b/nptl/sysdeps/unix/sysv/linux/timer_settime.c new file mode 100644 index 0000000..7fc837c --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/timer_settime.c @@ -0,0 +1,85 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <errno.h> +#include <stdlib.h> +#include <time.h> +#include <sysdep.h> +#include <kernel-features.h> +#include "kernel-posix-timers.h" + + +#ifdef __NR_timer_settime +# ifndef __ASSUME_POSIX_TIMERS +# define timer_settime static compat_timer_settime +# include <nptl/sysdeps/pthread/timer_settime.c> +# undef timer_settime +# endif + +# ifdef timer_settime_alias +# define timer_settime timer_settime_alias +# endif + + +int +timer_settime (timerid, flags, value, ovalue) + timer_t timerid; + int flags; + const struct itimerspec *value; + struct itimerspec *ovalue; +{ +# undef timer_settime +# ifndef __ASSUME_POSIX_TIMERS + if (__no_posix_timers == 0) +# endif + { + struct timer *kt = (struct timer *) timerid; + + /* Delete the kernel timer object. */ + int res = INLINE_SYSCALL (timer_settime, 4, kt->ktimerid, flags, + value, ovalue); + +# ifndef __ASSUME_POSIX_TIMERS + if (res != -1 || errno != ENOSYS) + { + /* We know the syscall support is available. */ + __no_posix_timers = 1; +# endif + return res; +# ifndef __ASSUME_POSIX_TIMERS + } +# endif + +# ifndef __ASSUME_POSIX_TIMERS + __no_posix_timers = 1; +# endif + } + +# ifndef __ASSUME_POSIX_TIMERS + return compat_timer_settime (timerid, flags, value, ovalue); +# endif +} +#else +# ifdef timer_settime_alias +# define timer_settime timer_settime_alias +# endif +/* The new system calls are not available. Use the userlevel + implementation. */ +# include <nptl/sysdeps/pthread/timer_settime.c> +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/Versions b/nptl/sysdeps/unix/sysv/linux/x86_64/Versions new file mode 100644 index 0000000..3b111dd --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/Versions @@ -0,0 +1,7 @@ +librt { + GLIBC_2.3.3 { + # Changed timer_t. + timer_create; timer_delete; timer_getoverrun; timer_gettime; + timer_settime; + } +} diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/compat-timer.h b/nptl/sysdeps/unix/sysv/linux/x86_64/compat-timer.h new file mode 100644 index 0000000..02485da --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/compat-timer.h @@ -0,0 +1,46 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <signal.h> +#include <time.h> +#include <sys/types.h> + +#define OLD_TIMER_MAX 256 + +extern timer_t __compat_timer_list[OLD_TIMER_MAX] attribute_hidden; + + +extern int __timer_create_new (clockid_t clock_id, struct sigevent *evp, + timer_t *timerid); +extern int __timer_delete_new (timer_t timerid); +extern int __timer_getoverrun_new (timer_t timerid); +extern int __timer_gettime_new (timer_t timerid, struct itimerspec *value); +extern int __timer_settime_new (timer_t timerid, int flags, + const struct itimerspec *value, + struct itimerspec *ovalue); + + +extern int __timer_create_old (clockid_t clock_id, struct sigevent *evp, + int *timerid); +extern int __timer_delete_old (int timerid); +extern int __timer_getoverrun_old (int timerid); +extern int __timer_gettime_old (int timerid, struct itimerspec *value); +extern int __timer_settime_old (int timerid, int flags, + const struct itimerspec *value, + struct itimerspec *ovalue); diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c new file mode 100644 index 0000000..1849f72 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c @@ -0,0 +1,66 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <shlib-compat.h> +#include "compat-timer.h" +#include <atomic.h> + + +#define timer_create_alias __timer_create_new +#include "../timer_create.c" + +#undef timer_create +versioned_symbol (librt, __timer_create_new, timer_create, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +timer_t __compat_timer_list[OLD_TIMER_MAX] attribute_hidden; + + +int +__timer_create_old (clockid_t clock_id, struct sigevent *evp, int *timerid) +{ + timer_t newp; + + int res = __timer_create_new (clock_id, evp, &newp); + if (res == 0) + { + int i; + for (i = 0; i < OLD_TIMER_MAX; ++i) + if (__compat_timer_list[i] == NULL + && ! atomic_compare_and_exchange_bool_acq (&__compat_timer_list[i], + newp, NULL)) + { + *timerid = i; + break; + } + + if (__builtin_expect (i == OLD_TIMER_MAX, 0)) + { + /* No free slot. */ + (void) __timer_delete_new (newp); + __set_errno (EINVAL); + res = -1; + } + } + + return res; +} +compat_symbol (librt, __timer_create_old, timer_create, GLIBC_2_2); +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c new file mode 100644 index 0000000..6e0d9d0 --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c @@ -0,0 +1,45 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_delete_alias __timer_delete_new +#include "../timer_delete.c" + +#undef timer_delete +versioned_symbol (librt, __timer_delete_new, timer_delete, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_delete_old (int timerid) +{ + int res = __timer_delete_new (__compat_timer_list[timerid]); + + if (res == 0) + /* Successful timer deletion, now free the index. We only need to + store a word and that better be atomic. */ + __compat_timer_list[timerid] = NULL; + + return res; +} +compat_symbol (librt, __timer_delete_old, timer_delete, GLIBC_2_2); +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c new file mode 100644 index 0000000..d75636c --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c @@ -0,0 +1,39 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_getoverrun_alias __timer_getoverrun_new +#include "../timer_getoverr.c" + +#undef timer_getoverrun +versioned_symbol (librt, __timer_getoverrun_new, timer_getoverrun, + GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_getoverrun_old (int timerid) +{ + return __timer_getoverrun_new (__compat_timer_list[timerid]); +} +compat_symbol (librt, __timer_getoverrun_old, timer_getoverrun, GLIBC_2_2); +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c new file mode 100644 index 0000000..1f1253a --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c @@ -0,0 +1,38 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_gettime_alias __timer_gettime_new +#include "../timer_gettime.c" + +#undef timer_gettime +versioned_symbol (librt, __timer_gettime_new, timer_gettime, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_gettime_old (int timerid, struct itimerspec *value) +{ + return __timer_gettime_new (__compat_timer_list[timerid], value); +} +compat_symbol (librt, __timer_gettime_old, timer_gettime, GLIBC_2_2); +#endif diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c new file mode 100644 index 0000000..4c945ec --- /dev/null +++ b/nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c @@ -0,0 +1,40 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <shlib-compat.h> +#include "compat-timer.h" + + +#define timer_settime_alias __timer_settime_new +#include "../timer_settime.c" + +#undef timer_settime +versioned_symbol (librt, __timer_settime_new, timer_settime, GLIBC_2_3_3); + + +#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_3_3) +int +__timer_settime_old (int timerid, int flags, const struct itimerspec *value, + struct itimerspec *ovalue) +{ + return __timer_settime_new (__compat_timer_list[timerid], flags, + value, ovalue); +} +compat_symbol (librt, __timer_settime_old, timer_settime, GLIBC_2_2); +#endif diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h index 8fe6100..90a67f1 100644 --- a/nptl/sysdeps/x86_64/pthreaddef.h +++ b/nptl/sysdeps/x86_64/pthreaddef.h @@ -30,9 +30,6 @@ /* Alignment requirement for TCB. */ #define TCB_ALIGNMENT 16 -/* The signal used for asynchronous cancelation. */ -#define SIGCANCEL __SIGRTMIN - /* Location of current stack frame. The frame pointer is not usable. */ #define CURRENT_STACK_FRAME \ diff --git a/sysdeps/generic/bits/typesizes.h b/sysdeps/generic/bits/typesizes.h index 6d6de21..2b9bd38 100644 --- a/sysdeps/generic/bits/typesizes.h +++ b/sysdeps/generic/bits/typesizes.h @@ -1,5 +1,5 @@ /* bits/typesizes.h -- underlying types for *_t. Generic version. - 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 @@ -54,7 +54,7 @@ #define __SWBLK_T_TYPE __SLONGWORD_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE -#define __TIMER_T_TYPE __S32_TYPE +#define __TIMER_T_TYPE void * #define __BLKSIZE_T_TYPE __SLONGWORD_TYPE #define __FSID_T_TYPE struct { int __val[2]; } diff --git a/sysdeps/unix/sysv/linux/bits/siginfo.h b/sysdeps/unix/sysv/linux/bits/siginfo.h index 4d1087d..0ea0dc5 100644 --- a/sysdeps/unix/sysv/linux/bits/siginfo.h +++ b/sysdeps/unix/sysv/linux/bits/siginfo.h @@ -1,5 +1,5 @@ /* siginfo_t, sigevent and constants. Linux version. - Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. + Copyright (C) 1997-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 @@ -69,8 +69,10 @@ typedef struct siginfo /* POSIX.1b timers. */ struct { - unsigned int _timer1; - unsigned int _timer2; + int si_tid; /* Timer ID. */ + int si_overrun; /* Overrun count. */ + char _pad[sizeof (__uid_t) - sizeof (int)]; + sigval_t si_sigval; /* Signal value. */ } _timer; /* POSIX.1b signals. */ @@ -110,8 +112,8 @@ typedef struct siginfo /* X/Open requires some more fields with fixed names. */ # define si_pid _sifields._kill.si_pid # define si_uid _sifields._kill.si_uid -# define si_timer1 _sifields._timer._timer1 -# define si_timer2 _sifields._timer._timer2 +# define si_timerid _sifields._timer.si_tid +# define si_overrun _sifields._timer.si_overrun # define si_status _sifields._sigchld.si_status # define si_utime _sifields._sigchld.si_utime # define si_stime _sifields._sigchld.si_stime @@ -280,6 +282,10 @@ typedef struct sigevent { int _pad[__SIGEV_PAD_SIZE]; + /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the + thread to receive the signal. */ + __pid_t _tid; + struct { void (*_function) (sigval_t); /* Function to start. */ @@ -299,8 +305,11 @@ enum # define SIGEV_SIGNAL SIGEV_SIGNAL SIGEV_NONE, /* Other notification: meaningless. */ # define SIGEV_NONE SIGEV_NONE - SIGEV_THREAD /* Deliver via thread creation. */ + SIGEV_THREAD, /* Deliver via thread creation. */ # define SIGEV_THREAD SIGEV_THREAD + + SIGEV_THREAD_ID = 4 /* Send signal to specific thread. */ +#define SIGEV_THREAD_ID SIGEV_THREAD_ID }; #endif /* have _SIGNAL_H. */ |