]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Mon, 21 Apr 2003 07:39:20 +0000 (07:39 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 21 Apr 2003 07:39:20 +0000 (07:39 +0000)
2003-04-21  Ulrich Drepper  <drepper@redhat.com>

* sysdeps/unix/sysv/linux/sigprocmask.c: Prevent changing mask for
SIGCANCEL.
* sysdeps/unix/sysv/linux/alpha/bits/siginfo.h: Define SI_TKILL.
* sysdeps/unix/sysv/linux/bits/siginfo.h: Define SI_TKILL.
* sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Define SI_TKILL.
* sysdeps/unix/sysv/linux/s390/bits/siginfo.h: Define SI_TKILL.
* sysdeps/unix/sysv/linux/sparc/bits/siginfo.h: Define SI_TKILL.

first syscall parameter to const char*.

15 files changed:
ChangeLog
nptl/ChangeLog
nptl/init.c
nptl/pthreadP.h
nptl/sysdeps/pthread/pthread_sigmask.c
nptl/sysdeps/pthread/sigaction.c
nptl/sysdeps/pthread/sigprocmask.c [new file with mode: 0644]
nptl/sysdeps/unix/sysv/linux/allocrtsig.c
nptl/sysdeps/unix/sysv/linux/timer_routines.c
sysdeps/unix/sysv/linux/alpha/bits/siginfo.h
sysdeps/unix/sysv/linux/bits/siginfo.h
sysdeps/unix/sysv/linux/ia64/bits/siginfo.h
sysdeps/unix/sysv/linux/s390/bits/siginfo.h
sysdeps/unix/sysv/linux/sigprocmask.c
sysdeps/unix/sysv/linux/sparc/bits/siginfo.h

index 5c6557ff9a1cbdcfd4b11537b64d2bbb0db1fd57..be3a26c90903db4e8d86ce680f97dcfeef6e8141 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,17 @@
+2003-04-21  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/unix/sysv/linux/sigprocmask.c: Prevent changing mask for
+       SIGCANCEL.
+       * sysdeps/unix/sysv/linux/alpha/bits/siginfo.h: Define SI_TKILL.
+       * sysdeps/unix/sysv/linux/bits/siginfo.h: Define SI_TKILL.
+       * sysdeps/unix/sysv/linux/ia64/bits/siginfo.h: Define SI_TKILL.
+       * sysdeps/unix/sysv/linux/s390/bits/siginfo.h: Define SI_TKILL.
+       * sysdeps/unix/sysv/linux/sparc/bits/siginfo.h: Define SI_TKILL.
+
 2003-04-20  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/not-cancel.h (open_not_cancel): Cast
-       first syscall parameter to cnst char*.
+       first syscall parameter to const char*.
 
 2003-04-19  Ulrich Drepper  <drepper@redhat.com>
 
index e5302642b803f8fd0c5f10505bd1bc6091b1a9a2..88af72f05748f3197b8535aff1b1b923cb636dee 100644 (file)
@@ -1,3 +1,16 @@
+2003-04-21  Ulrich Drepper  <drepper@redhat.com>
+
+       * init.c (__pthread_initialize_minimal): Don't block SIGTIMER.
+       * pthreadP.h: Make SIGTIMER and SIGCANCEL the same.
+       * sysdeps/pthread/pthread_sigmask.c: Remove handling of SIGTIMER.
+       * sysdeps/pthread/sigaction.c: Likewise.
+       * sysdeps/pthread/sigprocmask.c: New file.
+       * sysdeps/unix/sysv/linux/allocrtsig.c (current_rtmin): Define as
+       __SIGRTMIN+1.
+       * sysdeps/unix/sysv/linux/timer_routines.c (timer_helper_thread):
+       Block SIGTIMER.  Also handle SI_TKILL events and terminate thread
+       in this case.
+
 2003-04-19  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/i386/dl-sysdep.h
index 9db50036c6b90d082f6ff6c38316298e8519f992..3e041edeb3136a47d94407c7d98f8fd7edf13f75 100644 (file)
@@ -223,16 +223,6 @@ __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 ad62be8d2131b97487b8c4f854262f4fb26da9a6..71f1a7fedef48265769c0f7cfae2409c01ae8076 100644 (file)
@@ -162,8 +162,10 @@ __do_cancel (void)
 #define SIGCANCEL      __SIGRTMIN
 
 
-/* Signal needed for the kernel-supported POSIX timer implementation.  */
-#define SIGTIMER       (__SIGRTMIN + 1)
+/* Signal needed for the kernel-supported POSIX timer implementation.
+   We can reuse the cancellation signal since we can distinguish
+   cancellation from timer expirations.  */
+#define SIGTIMER       SIGCANCEL
 
 
 /* Internal prototypes.  */
index df6ac64ddb17ff4a92b8a55e648092dc443714ef..efe186ac2c8c2a221f0ec3cbf6fb8c377e2d7ef6 100644 (file)
@@ -32,36 +32,13 @@ pthread_sigmask (how, newmask, oldmask)
   sigset_t local_newmask;
 
   /* The only thing we have to make sure here is that SIGCANCEL is not
-     blocked and that SIGTIMER is not unblocked.  */
-  if (newmask != NULL)
+     blocked.  */
+  if (newmask != NULL
+      && __builtin_expect (__sigismember (newmask, SIGCANCEL), 0))
     {
-      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;
-           }
-       }
+      local_newmask = *newmask;
+      __sigdelset (&local_newmask, SIGCANCEL);
+      newmask = &local_newmask;
     }
 
 #ifdef INTERNAL_SYSCALL
index d69abf09aefeceff622bc7d96aff59924fc6b6ef..392cb65c90058c9b48bc1884fcfe5d94b99f2360 100644 (file)
@@ -36,7 +36,7 @@ __sigaction (sig, act, oact)
      const struct sigaction *act;
      struct sigaction *oact;
 {
-  if (sig == SIGCANCEL || sig == SIGTIMER)
+  if (sig == SIGCANCEL)
     {
       __set_errno (EINVAL);
       return -1;
diff --git a/nptl/sysdeps/pthread/sigprocmask.c b/nptl/sysdeps/pthread/sigprocmask.c
new file mode 100644 (file)
index 0000000..855b433
--- /dev/null
@@ -0,0 +1,20 @@
+/* Copyright (C) 1997,1998,1999,2000,2001,2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <nptl/pthreadP.h>
+#include <sysdeps/unix/sysv/linux/sigprocmask.c>
index 265416999a84bc24a6bf112f2e677b386ab38647..51aeb22765a446b3ef6127bca42bcec35adb08a1 100644 (file)
@@ -20,7 +20,7 @@
 #include <signal.h>
 
 
-static int current_rtmin = __SIGRTMIN + 2;
+static int current_rtmin = __SIGRTMIN + 1;
 static int current_rtmax = __SIGRTMAX;
 
 
index e9ece9f488bd2c0d4a01edbc8b19c983f5d376fa..b0d6ef91bf4796418c2e4797a22a88d3c7cc7d41 100644 (file)
@@ -49,6 +49,11 @@ timer_helper_thread (void *arg)
   sigset_t ss;
   sigemptyset (&ss);
   sigaddset (&ss, SIGTIMER);
+  /* SIGTIMER is the same signal as SIGCANCEL and it is therefore
+     unblocked so far.  Block it for this thread, we handle
+     cancellation explicitly.  */
+  INTERNAL_SYSCALL_DECL (err);
+  INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_BLOCK, &ss, NULL, _NSIG / 8);
 
   /* Endless loop of waiting for signals.  The loop is only ended when
      the thread is canceled.  */
@@ -56,14 +61,19 @@ timer_helper_thread (void *arg)
     {
       siginfo_t si;
 
-      if (sigwaitinfo (&ss, &si) > 0 && si.si_code == SI_TIMER)
+      if (sigwaitinfo (&ss, &si) > 0)
        {
-
-         struct timer *tk = (struct timer *) si.si_ptr;
-
-         /* That the signal we are waiting for.  */
-         pthread_t th;
-         (void) pthread_create (&th, &tk->attr, timer_sigev_thread, tk);
+         if (si.si_code == SI_TIMER)
+           {
+             struct timer *tk = (struct timer *) si.si_ptr;
+
+             /* That the signal we are waiting for.  */
+             pthread_t th;
+             (void) pthread_create (&th, &tk->attr, timer_sigev_thread, tk);
+           }
+         else if (si.si_code == SI_TKILL)
+           /* The thread is canceled.  */
+           pthread_exit (NULL);
        }
     }
 }
index 446394f0db682bfd92dc88b7f3bf38a5d34801a6..a2aacc04b11122f67dceeba16156c7e569f943e0 100644 (file)
@@ -122,8 +122,10 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_ASYNCNL = -6            /* Sent by asynch name lookup completion.  */
+  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL    SI_ASYNCNL
+  SI_TKILL = -6,               /* Sent by tkill.  */
+# define SI_TKILL      SI_TKILL
   SI_SIGIO,                    /* Sent by queued SIGIO. */
 # define SI_SIGIO      SI_SIGIO
   SI_ASYNCIO,                  /* Sent by AIO completion.  */
index 102adbcfdd6aa8f45ba04b948aa5ade82656a4fc..4ce319dc974033ffb55e31376bf6bbe63b07bf10 100644 (file)
@@ -128,8 +128,10 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_ASYNCNL = -6            /* Sent by asynch name lookup completion.  */
+  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL    SI_ASYNCNL
+  SI_TKILL = -6,               /* Sent by tkill.  */
+# define SI_TKILL      SI_TKILL
   SI_SIGIO,                    /* Sent by queued SIGIO. */
 # define SI_SIGIO      SI_SIGIO
   SI_ASYNCIO,                  /* Sent by AIO completion.  */
index fb0e2a524d1898c7f3334842f462eed71323cd7a..f5bbea397a1455b63693a4269ec0e44fbaad74ef 100644 (file)
@@ -131,8 +131,10 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_ASYNCNL = -6            /* Sent by asynch name lookup completion.  */
+  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL    SI_ASYNCNL
+  SI_TKILL = -6,               /* Sent by tkill.  */
+# define SI_TKILL      SI_TKILL
   SI_SIGIO,                    /* Sent by queued SIGIO. */
 # define SI_SIGIO      SI_SIGIO
   SI_ASYNCIO,                  /* Sent by AIO completion.  */
index 98a0c3073779009f36d6b08f635fa5d773db9032..0b7985313752819b31032fb931255c572ed8c253 100644 (file)
@@ -130,8 +130,10 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_ASYNCNL = -6            /* Sent by asynch name lookup completion.  */
+  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL    SI_ASYNCNL
+  SI_TKILL = -6,               /* Sent by tkill.  */
+# define SI_TKILL      SI_TKILL
   SI_SIGIO,                    /* Sent by queued SIGIO. */
 # define SI_SIGIO      SI_SIGIO
   SI_ASYNCIO,                  /* Sent by AIO completion.  */
index 7a73d9c373f024d47ea82023cf272aa5c0301c8a..db8986aafb746cc1e9b3922384dd2fc5ed6d0f0b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,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
@@ -44,6 +44,19 @@ __sigprocmask (how, set, oset)
      const sigset_t *set;
      sigset_t *oset;
 {
+#ifdef SIGCANCEL
+  sigset_t local_newmask;
+
+  /* The only thing we have to make sure here is that SIGCANCEL is not
+     blocked.  */
+  if (set != NULL && __builtin_expect (__sigismember (set, SIGCANCEL), 0))
+    {
+      local_newmask = *set;
+      __sigdelset (&local_newmask, SIGCANCEL);
+      set = &local_newmask;
+    }
+#endif
+
 #if __ASSUME_REALTIME_SIGNALS > 0
   return INLINE_SYSCALL (rt_sigprocmask, 4, how, CHECK_SIGSET_NULL_OK (set),
                         CHECK_SIGSET_NULL_OK (oset), _NSIG / 8);
index 263b6b8cd113f44778a21adfa353b4b6dfef6e58..7ff1971c2a412c8440fbcbcc6eb1aa15b4e70216 100644 (file)
@@ -130,8 +130,10 @@ typedef struct siginfo
    signals.  */
 enum
 {
-  SI_ASYNCNL = -6            /* Sent by asynch name lookup completion.  */
+  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
 # define SI_ASYNCNL    SI_ASYNCNL
+  SI_TKILL = -6,               /* Sent by tkill.  */
+# define SI_TKILL      SI_TKILL
   SI_SIGIO,                    /* Sent by queued SIGIO. */
 # define SI_SIGIO      SI_SIGIO
   SI_ASYNCIO,                  /* Sent by AIO completion.  */
This page took 0.069497 seconds and 5 git commands to generate.