1 This patch helps to integrate the Hurd's libpthread as a libc add-on.
3 It writes the configure file, removes an rpc call not yet
4 implemented on the version of gnumach we use and defines
7 diff --git a/libpthread/configure b/libpthread/configure
11 +++ b/libpthread/configure
13 +libc_add_on_canonical=libpthread
14 +libc_add_on_subdirs=.
18 We are using a version of GNU Mach that lacks 'thread_terminate_release'
19 (not introduced yet). The 'thread_terminate' RPC call will be enough for
21 See <http://lists.gnu.org/archive/html/bug-hurd/2014-05/msg00127.html>.
23 diff --git a/libpthread/sysdeps/mach/pt-thread-terminate.c b/libpthread/sysdeps/mach/pt-thread-terminate.c
24 index 6672065..129a611 100644
25 --- a/libpthread/sysdeps/mach/pt-thread-terminate.c
26 +++ b/libpthread/sysdeps/mach/pt-thread-terminate.c
27 @@ -70,9 +70,9 @@ __pthread_thread_terminate (struct __pthread *thread)
28 __mach_port_destroy (__mach_task_self (), wakeup_port);
30 /* Terminate and release all that's left. */
31 - err = __thread_terminate_release (kernel_thread, mach_task_self (),
32 - kernel_thread, reply_port,
33 - stackaddr, stacksize);
34 + /* err = __thread_terminate_release (kernel_thread, mach_task_self (), */
35 + /* kernel_thread, reply_port, */
36 + /* stackaddr, stacksize); */
38 /* The kernel does not support it yet. Leak but at least terminate
43 The __PTHREAD_SPIN_LOCK_INITIALIZER definition is missing, so we
44 define it to __SPIN_LOCK_INITIALIZER which already exists.
45 See <http://lists.gnu.org/archive/html/commit-hurd/2009-04/msg00006.html>.
47 diff --git a/libpthread/sysdeps/mach/bits/spin-lock.h b/libpthread/sysdeps/mach/bits/spin-lock.h
48 index 537dac9..fca0e5a 100644
49 --- a/libpthread/sysdeps/mach/bits/spin-lock.h
50 +++ b/libpthread/sysdeps/mach/bits/spin-lock.h
51 @@ -30,7 +30,7 @@ typedef __spin_lock_t __pthread_spinlock_t;
53 /* Initializer for a spin lock object. */
54 #ifndef __PTHREAD_SPIN_LOCK_INITIALIZER
55 -#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
56 +#define __PTHREAD_SPIN_LOCK_INITIALIZER __SPIN_LOCK_INITIALIZER
61 The version of the glibc we use doesn't include the shm-directory.c file and does
62 not yet support IS_IN.
63 See <https://lists.gnu.org/archive/html/bug-hurd/2015-03/msg00078.html>
65 diff --git a/libpthread/Makefile b/libpthread/Makefile
66 index 2906788..b8dee58 100644
67 --- a/libpthread/Makefile
68 +++ b/libpthread/Makefile
69 @@ -149,8 +149,6 @@ libpthread-routines := pt-attr pt-attr-destroy pt-attr-getdetachstate \
70 sem-post sem-timedwait sem-trywait sem-unlink \
81 diff --git a/libpthread/pthread/pt-create.c b/libpthread/pthread/pt-create.c
82 index d88afae..84044dc 100644
83 --- a/libpthread/pthread/pt-create.c
84 +++ b/libpthread/pthread/pt-create.c
87 #include <pt-internal.h>
89 -#if IS_IN (libpthread)
90 +#ifdef IS_IN_libpthread
94 @@ -50,7 +50,7 @@ entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg)
95 __resp = &self->res_state;
98 -#if IS_IN (libpthread)
99 +#ifdef IS_IN_libpthread
100 /* Initialize pointers to locale data. */
103 diff --git a/libpthread/pthread/pt-initialize.c b/libpthread/pthread/pt-initialize.c
104 index 9e5404b..b9cacbd 100644
105 --- a/libpthread/pthread/pt-initialize.c
106 +++ b/libpthread/pthread/pt-initialize.c
109 DEFINE_HOOK (__pthread_init, (void));
111 -#if IS_IN (libpthread)
112 +#ifdef IS_IN_libpthread
113 static const struct pthread_functions pthread_functions =
115 .ptr_pthread_attr_destroy = __pthread_attr_destroy,
116 @@ -81,7 +81,7 @@ static const struct pthread_functions pthread_functions =
118 ___pthread_init (void)
120 -#if IS_IN (libpthread)
121 +#ifdef IS_IN_libpthread
122 __libc_pthread_init(&pthread_functions);
124 RUN_HOOK (__pthread_init, ());
125 diff --git a/libpthread/pthread/pt-internal.h b/libpthread/pthread/pt-internal.h
126 index 18b5b4c..8cdcfce 100644
127 --- a/libpthread/pthread/pt-internal.h
128 +++ b/libpthread/pthread/pt-internal.h
130 #include <pt-sysdep.h>
131 #include <pt-machdep.h>
133 -#if IS_IN (libpthread)
134 +#ifdef IS_IN_libpthread
135 # include <ldsodefs.h>
138 @@ -60,7 +60,7 @@ enum pthread_state
139 # define PTHREAD_SYSDEP_MEMBERS
142 -#if !(IS_IN (libpthread))
143 +#ifndef IS_IN_libpthread
145 /* Type of the TCB. */