Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 25 Mar 2003 20:41:26 +0000 (20:41 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 25 Mar 2003 20:41:26 +0000 (20:41 +0000)
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:
ChangeLog
Versions.def
abilist/libpthread.abilist
bits/typesizes.h
csu/tst-atomic.c
include/atomic.h
linuxthreads/ChangeLog
linuxthreads/sysdeps/pthread/bits/typesizes.h [new file with mode: 0644]
nptl/ChangeLog
nptl/cleanup.c
nptl/cleanup_defer.c
nptl/init.c
nptl/sysdeps/i386/pthreaddef.h
nptl/sysdeps/ia64/pthreaddef.h
nptl/sysdeps/powerpc/pthreaddef.h
nptl/sysdeps/pthread/posix-timer.h
nptl/sysdeps/pthread/pthread_sigmask.c
nptl/sysdeps/pthread/sigaction.c
nptl/sysdeps/s390/pthreaddef.h
nptl/sysdeps/sh/pthreaddef.h
nptl/sysdeps/unix/sysv/linux/allocrtsig.c
nptl/sysdeps/unix/sysv/linux/bits/local_lim.h
nptl/sysdeps/unix/sysv/linux/ia64/Versions [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/ia64/timer_create.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/ia64/timer_delete.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/ia64/timer_getoverr.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/ia64/timer_gettime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/ia64/timer_settime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/Versions [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_create.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_delete.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_getoverr.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_gettime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/powerpc/powerpc64/timer_settime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/pthread_kill.c
nptl/sysdeps/unix/sysv/linux/s390/s390-64/Versions [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_create.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_delete.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_getoverr.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_gettime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/s390/s390-64/timer_settime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_create.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_delete.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_getoverr.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_gettime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_routines.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/timer_settime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/Versions [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/compat-timer.h [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/timer_create.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/timer_delete.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/timer_getoverr.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/timer_gettime.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/x86_64/timer_settime.c [new file with mode: 0644]
nptl/sysdeps/x86_64/pthreaddef.h
sysdeps/generic/bits/typesizes.h
sysdeps/unix/sysv/linux/bits/siginfo.h

index 3064149b0921069a57304dcb135dddec16cbab9d..b1d69cf1b330aab88cf0c055a4f42020bee8b09b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index e8728b1986039d0ca29fec4f3d7f0f9de5760f6d..50bb28d20e76f7db80c88c449beafcf26df9c9b2 100644 (file)
@@ -85,6 +85,7 @@ librt {
   GLIBC_2.1
   GLIBC_2.2
   GLIBC_2.3
+  GLIBC_2.3.3
 }
 libutil {
   GLIBC_2.0
index b60ad56c6d5c362bf26505aaedcbd64101d8e347..8074988adccd0945f1af1ddeb672c8f2684c074d 100644 (file)
@@ -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
index 6d6de21fabbd8759a9f18afa12a94b6d34b566ca..2b9bd38760a4a68ff7d5e9e570def5892418df04 100644 (file)
@@ -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]; }
 
index 292f6e7334f4c9a794c77ee42a1bd4c3f864a252..e5686e377dd49d561e5455bfe2c46f1fda906d5e 100644 (file)
@@ -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;
index afebb789a398c74995578e1287d0e0c5ae269e12..3a0ec3a4bea62f246e3ab0ef3710ebc19005b1d1 100644 (file)
 
 #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
 
 
index d741a1e4adac325874f282f204d4be561a8f2a78..f7467ab5708c494e08df3b0cfac47da37bed12db 100644 (file)
@@ -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 (file)
index 0000000..a95c41d
--- /dev/null
@@ -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 */
index fe24582b91f86b289be6487501bd74685713180b..31380477e49f9e676921195334e8f62ffc6a3939 100644 (file)
@@ -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
index fd372b65d3a19a9366d219d6145f2f5ba9243ffa..a25b397f9c32c7efbf1869cc8907abf9759db4a0 100644 (file)
@@ -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)
index b72553bdc0c1493fbfb06c1220eb89060e1b8abc..5d6ed0360b7877f95a775a1da8e9797b39d3f8a9 100644 (file)
@@ -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.  */
index 4237c6eb487e40f97263d06d771fff2324b83efc..2c85d87b999675d148d413555814c95974fa2aad 100644 (file)
@@ -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;
index 1fe9455848ed640e55efcbc3e8e0e033f737b5bf..43b771c6dbebb8dd305e935b53d7a5baa3075b9c 100644 (file)
@@ -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)
index 8fc58e04d8123b24e37d85bffff3e747b8e6a454..f2539e29059635a552b9533992179021b591a75c 100644 (file)
@@ -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
index b28d0bedd7ef29c7e419c21c8574006dd450c725..342c15c67fa76cb7832200a2d27a7c6360332017 100644 (file)
@@ -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)
index 6710291b9bd27214bc6c1ea63923159fd6aafc5c..bc0c57f63b44a351583a08d40ffaa60bd575523f 100644 (file)
@@ -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
index 4114e0be2f92634ff074289858681b47e0cf961d..df6ac64ddb17ff4a92b8a55e648092dc443714ef 100644 (file)
@@ -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
index e3554ddb449ea7cd5dde9302a92332fb80eeada6..d69abf09aefeceff622bc7d96aff59924fc6b6ef 100644 (file)
    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;
index ff044a3625082b7073c1a870c843263054ec40e7..6569e2aba676ffa09edd4d93cd3d3d4e6adc005d 100644 (file)
@@ -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)
index c66e838bdc27b9bfb2afdeb5faa175f3864c1a8d..70c6a850ba7bc9110ac4d62a231c01ca24de053f 100644 (file)
@@ -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)
index e3622c6076956272ce039934c75ee8766a56d49d..265416999a84bc24a6bf112f2e677b386ab38647 100644 (file)
@@ -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;
 
 
index 90564cbfe23ea9b01f0d52a399bd087d3fe60849..7f445495991606469d4089d542def387fe70a2c1 100644 (file)
@@ -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 (file)
index 0000000..3b111dd
--- /dev/null
@@ -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 (file)
index 0000000..172223a
--- /dev/null
@@ -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 (file)
index 0000000..537516e
--- /dev/null
@@ -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 (file)
index 0000000..3f21a73
--- /dev/null
@@ -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 (file)
index 0000000..a50143a
--- /dev/null
@@ -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 (file)
index 0000000..37baeff
--- /dev/null
@@ -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 (file)
index 0000000..6e7e029
--- /dev/null
@@ -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 (file)
index 0000000..3b111dd
--- /dev/null
@@ -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 (file)
index 0000000..172223a
--- /dev/null
@@ -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 (file)
index 0000000..537516e
--- /dev/null
@@ -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 (file)
index 0000000..3f21a73
--- /dev/null
@@ -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 (file)
index 0000000..a50143a
--- /dev/null
@@ -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 (file)
index 0000000..37baeff
--- /dev/null
@@ -0,0 +1 @@
+#include "../x86_64/timer_settime.c"
index a35a3f025b7eb6d7ce8b26c995a336fa0c37aefa..8da195aa0ad5544b76fb0ee0217f729b37097a9f 100644 (file)
@@ -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 (file)
index 0000000..3b111dd
--- /dev/null
@@ -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 (file)
index 0000000..172223a
--- /dev/null
@@ -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 (file)
index 0000000..537516e
--- /dev/null
@@ -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 (file)
index 0000000..3f21a73
--- /dev/null
@@ -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 (file)
index 0000000..a50143a
--- /dev/null
@@ -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 (file)
index 0000000..37baeff
--- /dev/null
@@ -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 (file)
index 0000000..637d925
--- /dev/null
@@ -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 (file)
index 0000000..cf63364
--- /dev/null
@@ -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 (file)
index 0000000..40b485f
--- /dev/null
@@ -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 (file)
index 0000000..6da1571
--- /dev/null
@@ -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 (file)
index 0000000..3f69aa6
--- /dev/null
@@ -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 (file)
index 0000000..7fc837c
--- /dev/null
@@ -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 (file)
index 0000000..3b111dd
--- /dev/null
@@ -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 (file)
index 0000000..02485da
--- /dev/null
@@ -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 (file)
index 0000000..1849f72
--- /dev/null
@@ -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 (file)
index 0000000..6e0d9d0
--- /dev/null
@@ -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 (file)
index 0000000..d75636c
--- /dev/null
@@ -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 (file)
index 0000000..1f1253a
--- /dev/null
@@ -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 (file)
index 0000000..4c945ec
--- /dev/null
@@ -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
index 8fe610004f6772fd2f6a8e2c63e27199eeb5babc..90a67f1751068fa8ac528b450ba3a215587726dd 100644 (file)
@@ -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 \
index 6d6de21fabbd8759a9f18afa12a94b6d34b566ca..2b9bd38760a4a68ff7d5e9e570def5892418df04 100644 (file)
@@ -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]; }
 
index 4d1087d33b18060811999459368010080650224b..0ea0dc54a9c648653fa89253f6fc96e927f84468 100644 (file)
@@ -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.  */