[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 2/2] Update debian/patches/libpthread_sigmask.patch



If glibc has global signal dispositions, we must check for global pending
signals as well as for thread-specific ones.
---
 debian/changelog                        |    2 +
 debian/patches/libpthread_sigmask.patch |   53 +++++++++++++++++++++---------
 2 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 9aedf73..532b8ef 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ hurd (20110519-2) UNRELEASED; urgency=low
   [ Jeremie Koenig ]
   * debian/patches/libpthread_globsigdisp.patch: New patch, enables global
     signal dispositions in libpthread if glibc supports it.
+  * debian/patches/libpthread_sigmask.patch: Update for global signal
+    dispositions (check for global as well as thread-specific pending signals).
 
  -- Samuel Thibault <sthibault@debian.org>  Mon, 23 May 2011 15:03:43 +0200
 
diff --git a/debian/patches/libpthread_sigmask.patch b/debian/patches/libpthread_sigmask.patch
index 58c244a..dd67846 100644
--- a/debian/patches/libpthread_sigmask.patch
+++ b/debian/patches/libpthread_sigmask.patch
@@ -4,11 +4,11 @@ thread if any pending signals have been unblocked (code grabbed from glibc).
  libpthread/sysdeps/mach/hurd/pt-sigstate.c |    9 +++++++++
  1 files changed, 9 insertions(+), 0 deletions(-)
 
-diff --git a/libpthread/sysdeps/mach/hurd/pt-sigstate.c b/libpthread/sysdeps/mach/hurd/pt-sigstate.c
-index 68c79c5..51263ac 100644
---- a/libpthread/sysdeps/mach/hurd/pt-sigstate.c
-+++ b/libpthread/sysdeps/mach/hurd/pt-sigstate.c
-@@ -21,6 +21,7 @@
+Index: hurd/libpthread/sysdeps/mach/hurd/pt-sigstate.c
+===================================================================
+--- hurd.orig/libpthread/sysdeps/mach/hurd/pt-sigstate.c	2011-05-24 17:13:09.000000000 +0000
++++ hurd/libpthread/sysdeps/mach/hurd/pt-sigstate.c	2011-05-25 13:23:49.000000000 +0000
+@@ -21,9 +21,16 @@
  #include <assert.h>
  #include <signal.h>
  #include <hurd/signal.h>
@@ -16,7 +16,16 @@ index 68c79c5..51263ac 100644
  
  #include <pt-internal.h>
  
-@@ -31,6 +32,7 @@ __pthread_sigstate (struct __pthread *thread, int how,
++/* These symbols are available if glibc supports global signal dispositions,
++   in which case we must use them to query the thread's pending mask.  */
++void _hurd_sigstate_lock (struct hurd_sigstate *ss) __attribute__((weak));
++sigset_t _hurd_sigstate_pending (const struct hurd_sigstate *ss) __attribute__((weak));
++void _hurd_sigstate_unlock (struct hurd_sigstate *ss) __attribute__((weak));
++
+ error_t
+ __pthread_sigstate (struct __pthread *thread, int how,
+ 		    const sigset_t *set, sigset_t *oset,
+@@ -31,11 +38,15 @@
  {
    error_t err = 0;
    struct hurd_sigstate *ss;
@@ -24,23 +33,35 @@ index 68c79c5..51263ac 100644
  
    ss = _hurd_thread_sigstate (thread->kernel_thread);
    assert (ss);
-@@ -63,7 +65,14 @@ __pthread_sigstate (struct __pthread *thread, int how,
+ 
+-  __pthread_spin_lock (&ss->lock);
++  if (_hurd_sigstate_lock)
++    _hurd_sigstate_lock (ss);
++  else
++    __pthread_spin_lock (&ss->lock);
+ 
+   if (oset)
+     *oset = ss->blocked;
+@@ -63,7 +74,21 @@
    if (! err && clear_pending)
      __sigemptyset (&ss->pending);
  
-+  pending = ss->pending & ~ss->blocked;
+-  __pthread_spin_unlock (&ss->lock);
++  if (_hurd_sigstate_lock)
++    {
++      pending = _hurd_sigstate_pending (ss) & ~ss->blocked;
++      _hurd_sigstate_unlock (ss);
++    }
++  else
++    {
++      pending = ss->pending & ~ss->blocked;
++      __pthread_spin_unlock (&ss->lock);
++    }
 +
-   __pthread_spin_unlock (&ss->lock);
- 
 +  if (! err && pending)
 +    /* Send a message to the signal thread so it
 +       will wake up and check for pending signals.  */
 +    __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
-+
+ 
    return err;
  }
--- 
-1.7.1
-
-
-
-- 
1.7.1


Reply to: