gnu: upower: Enable GObject introspection.
[jackhill/guix/guix.git] / gnu / packages / patches / libpthread-glibc-preparation.patch
1 This patch helps to integrate the Hurd's libpthread as a libc add-on.
2
3 It writes the configure file, removes an rpc call not yet
4 implemented on the version of gnumach we use and defines
5 a missing macro.
6
7 diff --git a/libpthread/configure b/libpthread/configure
8 new file mode 100644
9 index 0000000..2cdbc71
10 --- /dev/null
11 +++ b/libpthread/configure
12 @@ -0,0 +1,2 @@
13 +libc_add_on_canonical=libpthread
14 +libc_add_on_subdirs=.
15 --
16 1.9.0
17
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
20 our needs.
21 See <http://lists.gnu.org/archive/html/bug-hurd/2014-05/msg00127.html>.
22
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);
29
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); */
37
38 /* The kernel does not support it yet. Leak but at least terminate
39 correctly. */
40 --
41 1.9.2
42
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>.
46
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;
52
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
57 #endif
58
59 __END_DECLS
60
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>
64
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 \
71 sem-wait \
72 \
73 - shm-directory \
74 - \
75 cthreads-compat \
76 $(SYSDEPS)
77
78 --
79 2.3.6
80
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
85 @@ -28,7 +28,7 @@
86
87 #include <pt-internal.h>
88
89 -#if IS_IN (libpthread)
90 +#ifdef IS_IN_libpthread
91 # include <ctype.h>
92 #endif
93 #ifdef HAVE_USELOCALE
94 @@ -50,7 +50,7 @@ entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg)
95 __resp = &self->res_state;
96 #endif
97
98 -#if IS_IN (libpthread)
99 +#ifdef IS_IN_libpthread
100 /* Initialize pointers to locale data. */
101 __ctype_init ();
102 #endif
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
107 @@ -28,7 +28,7 @@
108
109 DEFINE_HOOK (__pthread_init, (void));
110
111 -#if IS_IN (libpthread)
112 +#ifdef IS_IN_libpthread
113 static const struct pthread_functions pthread_functions =
114 {
115 .ptr_pthread_attr_destroy = __pthread_attr_destroy,
116 @@ -81,7 +81,7 @@ static const struct pthread_functions pthread_functions =
117 void
118 ___pthread_init (void)
119 {
120 -#if IS_IN (libpthread)
121 +#ifdef IS_IN_libpthread
122 __libc_pthread_init(&pthread_functions);
123 #endif
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
129 @@ -35,7 +35,7 @@
130 #include <pt-sysdep.h>
131 #include <pt-machdep.h>
132
133 -#if IS_IN (libpthread)
134 +#ifdef IS_IN_libpthread
135 # include <ldsodefs.h>
136 #endif
137
138 @@ -60,7 +60,7 @@ enum pthread_state
139 # define PTHREAD_SYSDEP_MEMBERS
140 #endif
141
142 -#if !(IS_IN (libpthread))
143 +#ifndef IS_IN_libpthread
144 #ifdef ENABLE_TLS
145 /* Type of the TCB. */
146 typedef struct