[PATCH 1/2] Add debian/patches/libpthread_globsigdisp.patch
The patch makes libpthread enable global signal dispositions for new threads
if glibc supports it.
---
debian/changelog | 5 ++
debian/patches/libpthread_globsigdisp.patch | 58 +++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 64 insertions(+), 0 deletions(-)
create mode 100644 debian/patches/libpthread_globsigdisp.patch
diff --git a/debian/changelog b/debian/changelog
index e1f1966..9aedf73 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,13 @@
hurd (20110519-2) UNRELEASED; urgency=low
+ [ Samuel Thibault ]
* Make the hurd package depend on random-egd, to get /dev/*random working as
early as d-i's base install.
+ [ Jeremie Koenig ]
+ * debian/patches/libpthread_globsigdisp.patch: New patch, enables global
+ signal dispositions in libpthread if glibc supports it.
+
-- Samuel Thibault <sthibault@debian.org> Mon, 23 May 2011 15:03:43 +0200
hurd (20110519-1) unstable; urgency=low
diff --git a/debian/patches/libpthread_globsigdisp.patch b/debian/patches/libpthread_globsigdisp.patch
new file mode 100644
index 0000000..9380063
--- /dev/null
+++ b/debian/patches/libpthread_globsigdisp.patch
@@ -0,0 +1,58 @@
+From 486f83c7b57f6dcb479dca3a73e096ab88959b3f Mon Sep 17 00:00:00 2001
+From: Jeremie Koenig <jk@jk.fr.eu.org>
+Date: Mon, 23 May 2011 22:00:44 +0000
+Subject: [PATCH] Mark new threads as global signal receivers
+
+* sysdeps/mach/hurd/pt-sigstate-init.c (__pthread_sigstate_init):
+ Call _hurd_sigstate_set_global_rcv for newly created threads.
+ Declare it as a weak symbol so that we stay compatible with previous
+ glibc versions.
+---
+ sysdeps/mach/hurd/pt-sigstate-init.c | 20 +++++++++++++++++++-
+ 1 files changed, 19 insertions(+), 1 deletions(-)
+
+diff --git a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
+index da5a945..811f7b3 100644
+--- a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
++++ b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c
+@@ -19,9 +19,14 @@
+
+ #include <pthread.h>
+ #include <hurd/threadvar.h>
++#include <hurd/signal.h>
+
+ #include <pt-internal.h>
+
++/* Preserve compatibility with older glibc versions. */
++void _hurd_sigstate_set_global_rcv (struct hurd_sigstate *ss)
++ __attribute__((weak));
++
+ error_t
+ __pthread_sigstate_init (struct __pthread *thread)
+ {
+@@ -30,8 +35,21 @@ __pthread_sigstate_init (struct __pthread *thread)
+ thread->stackaddr);
+
+ /* The real initialization happens internally in glibc the first
+- time that _hurd_thead_sigstate is called. */
++ time that _hurd_self_sigstate is called. */
+ *location = 0;
+
++ /* Mark the thread as a global signal receiver so as to conform with
++ the pthread semantics. However, we must be careful. The first
++ pthread created is the main thread, during libpthread initialization.
++ We must not mark it, otherwise the sigprocmask call in
++ __pthread_create would try to access _hurd_global_sigstate,
++ which is not initialized yet. When glibc runs _hurdsig_init later
++ on, the message thread is created, which must not be marked either. */
++ if (_hurd_sigstate_set_global_rcv && __pthread_num_threads > 2)
++ {
++ struct hurd_sigstate *ss = _hurd_thread_sigstate (thread->kernel_thread);
++ _hurd_sigstate_set_global_rcv (ss);
++ }
++
+ return 0;
+ }
+--
+1.7.1
+
diff --git a/debian/patches/series b/debian/patches/series
index 8b2c46c..942f96e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -30,3 +30,4 @@ ext2fs_nowait.patch
auth-intr-cure.patch
libpager_deadlock.patch
libdiskfs_self-reauth.patch
+libpthread_globsigdisp.patch
--
1.7.1
Reply to: