summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libpthread-glibc-preparation.patch
blob: a43245436c21085cc66f84ca9f2f320dbcea9d43 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
This patch helps to integrate the Hurd's libpthread as a libc add-on.

It writes the configure file, removes an rpc call not yet 
implemented on the version of gnumach we use and defines
a missing macro.

diff --git a/libpthread/configure b/libpthread/configure
new file mode 100644
index 0000000..2cdbc71
--- /dev/null
+++ b/libpthread/configure
@@ -0,0 +1,2 @@
+libc_add_on_canonical=libpthread
+libc_add_on_subdirs=.
-- 
1.9.0

We are using a version of GNU Mach that lacks 'thread_terminate_release'
(not introduced yet).  The 'thread_terminate' RPC call will be enough for
our needs.
See <http://lists.gnu.org/archive/html/bug-hurd/2014-05/msg00127.html>.

diff --git a/libpthread/sysdeps/mach/pt-thread-terminate.c b/libpthread/sysdeps/mach/pt-thread-terminate.c
index 6672065..129a611 100644
--- a/libpthread/sysdeps/mach/pt-thread-terminate.c
+++ b/libpthread/sysdeps/mach/pt-thread-terminate.c
@@ -70,9 +70,9 @@ __pthread_thread_terminate (struct __pthread *thread)
   __mach_port_destroy (__mach_task_self (), wakeup_port);
 
   /* Terminate and release all that's left.  */
-  err = __thread_terminate_release (kernel_thread, mach_task_self (),
-				    kernel_thread, reply_port,
-				    stackaddr, stacksize);
+  /* err = __thread_terminate_release (kernel_thread, mach_task_self (), */
+  /* 				    kernel_thread, reply_port, */
+  /* 				    stackaddr, stacksize); */
 
   /* The kernel does not support it yet.  Leak but at least terminate
      correctly.  */
-- 
1.9.2

The __PTHREAD_SPIN_LOCK_INITIALIZER definition is missing, so we 
define it to __SPIN_LOCK_INITIALIZER which already exists.
See <http://lists.gnu.org/archive/html/commit-hurd/2009-04/msg00006.html>.
  
diff --git a/libpthread/sysdeps/mach/bits/spin-lock.h b/libpthread/sysdeps/mach/bits/spin-lock.h
index 537dac9..fca0e5a 100644
--- a/libpthread/sysdeps/mach/bits/spin-lock.h
+++ b/libpthread/sysdeps/mach/bits/spin-lock.h
@@ -30,7 +30,7 @@ typedef __spin_lock_t __pthread_spinlock_t;
 
 /* Initializer for a spin lock object.  */
 #ifndef __PTHREAD_SPIN_LOCK_INITIALIZER
-#error __PTHREAD_SPIN_LOCK_INITIALIZER undefined: should be defined by <lock-intern.h>.
+#define __PTHREAD_SPIN_LOCK_INITIALIZER __SPIN_LOCK_INITIALIZER
 #endif
 
 __END_DECLS

The version of the glibc we use doesn't include the shm-directory.c file and does
not yet support IS_IN.
See <https://lists.gnu.org/archive/html/bug-hurd/2015-03/msg00078.html>

diff --git a/libpthread/Makefile b/libpthread/Makefile
index 2906788..b8dee58 100644
--- a/libpthread/Makefile
+++ b/libpthread/Makefile
@@ -149,8 +149,6 @@ libpthread-routines := pt-attr pt-attr-destroy pt-attr-getdetachstate	    \
 	sem-post sem-timedwait sem-trywait sem-unlink			    \
 	sem-wait							    \
 									    \
-	shm-directory							    \
-									    \
 	cthreads-compat							    \
 	$(SYSDEPS)
 
-- 
2.3.6

diff --git a/libpthread/pthread/pt-create.c b/libpthread/pthread/pt-create.c
index d88afae..84044dc 100644
--- a/libpthread/pthread/pt-create.c
+++ b/libpthread/pthread/pt-create.c
@@ -28,7 +28,7 @@
 
 #include <pt-internal.h>
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 # include <ctype.h>
 #endif
 #ifdef HAVE_USELOCALE
@@ -50,7 +50,7 @@ entry_point (struct __pthread *self, void *(*start_routine)(void *), void *arg)
   __resp = &self->res_state;
 #endif
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
   /* Initialize pointers to locale data.  */
   __ctype_init ();
 #endif
diff --git a/libpthread/pthread/pt-initialize.c b/libpthread/pthread/pt-initialize.c
index 9e5404b..b9cacbd 100644
--- a/libpthread/pthread/pt-initialize.c
+++ b/libpthread/pthread/pt-initialize.c
@@ -28,7 +28,7 @@
 
 DEFINE_HOOK (__pthread_init, (void));
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 static const struct pthread_functions pthread_functions =
   {
     .ptr_pthread_attr_destroy = __pthread_attr_destroy,
@@ -81,7 +81,7 @@ static const struct pthread_functions pthread_functions =
 void
 ___pthread_init (void)
 {
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
   __libc_pthread_init(&pthread_functions);
 #endif
   RUN_HOOK (__pthread_init, ());
diff --git a/libpthread/pthread/pt-internal.h b/libpthread/pthread/pt-internal.h
index 18b5b4c..8cdcfce 100644
--- a/libpthread/pthread/pt-internal.h
+++ b/libpthread/pthread/pt-internal.h
@@ -35,7 +35,7 @@
 #include <pt-sysdep.h>
 #include <pt-machdep.h>
 
-#if IS_IN (libpthread)
+#ifdef IS_IN_libpthread
 # include <ldsodefs.h>
 #endif
 
@@ -60,7 +60,7 @@ enum pthread_state
 # define PTHREAD_SYSDEP_MEMBERS
 #endif
 
-#if !(IS_IN (libpthread))
+#ifndef IS_IN_libpthread
 #ifdef ENABLE_TLS
 /* Type of the TCB.  */
 typedef struct