Fix thread linkspace
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Mon, 29 Oct 2018 20:36:01 +0000 (20:36 +0000)
committerSamuel Thibault <sthibault@debian.org>
Mon, 29 Oct 2018 20:36:01 +0000 (20:36 +0000)
Libc uses some thread functions, but should not expose the corresponding
symbols, so call aliases.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-thread-linkspace.diff

hurd/Versions
hurd/hurdsig.c
sysdeps/mach/hurd/cthreads.c
sysdeps/mach/libc-lock.h

index 0c4dfa31187418ba149cfc2b7c7c8f016d8be255..c906d753323af0f91755e3d8606d774163a167f6 100644 (file)
@@ -156,14 +156,14 @@ libc {
 
   HURD_CTHREADS_0.3 {
     # weak refs to libthreads functions that libc calls iff libthreads in use
-    cthread_fork; cthread_detach;
-    pthread_getattr_np; pthread_attr_getstack;
+    __cthread_fork; __cthread_detach;
+    __pthread_getattr_np; __pthread_attr_getstack;
 
     # variables used for detecting cthreads
     _cthread_exit_routine; _cthread_init_routine;
 
     # cthreads functions with stubs in libc
-    cthread_keycreate; cthread_getspecific; cthread_setspecific;
+    __cthread_keycreate; __cthread_getspecific; __cthread_setspecific;
     __libc_getspecific;
   }
 
index 16dc8fe02eb399a1a8b1857788b8d7f71d721e8a..07b9c20231acef5303d995414849bf15a7e27c1e 100644 (file)
@@ -1512,11 +1512,11 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
 
   /* Start the signal thread listening on the message port.  */
 
-#pragma weak cthread_fork
-#pragma weak cthread_detach
-#pragma weak pthread_getattr_np
-#pragma weak pthread_attr_getstack
-  if (!cthread_fork)
+#pragma weak __cthread_fork
+#pragma weak __cthread_detach
+#pragma weak __pthread_getattr_np
+#pragma weak __pthread_attr_getstack
+  if (!__cthread_fork)
     {
       err = __thread_create (__mach_task_self (), &_hurd_msgport_thread);
       assert_perror (err);
@@ -1541,7 +1541,7 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
     }
   else
     {
-      cthread_t thread;
+      __cthread_t thread;
       /* When cthreads is being used, we need to make the signal thread a
          proper cthread.  Otherwise it cannot use mutex_lock et al, which
          will be the cthreads versions.  Various of the message port RPC
@@ -1551,17 +1551,17 @@ _hurdsig_init (const int *intarray, size_t intarraysize)
          we'll let the signal thread's per-thread variables be found as for
          any normal cthread, and just leave the magic __hurd_sigthread_*
          values all zero so they'll be ignored.  */
-      cthread_detach (thread = cthread_fork ((cthread_fn_t) &_hurd_msgport_receive, 0));
+      __cthread_detach (thread = __cthread_fork ((__cthread_fn_t) &_hurd_msgport_receive, 0));
 
-      if (pthread_getattr_np)
+      if (__pthread_getattr_np)
        {
          /* Record stack layout for fork() */
          pthread_attr_t attr;
          void *addr;
          size_t size;
 
-         pthread_getattr_np ((pthread_t) thread, &attr);
-         pthread_attr_getstack (&attr, &addr, &size);
+         __pthread_getattr_np ((pthread_t) thread, &attr);
+         __pthread_attr_getstack (&attr, &addr, &size);
          __hurd_sigthread_stack_base = (uintptr_t) addr;
          __hurd_sigthread_stack_end = __hurd_sigthread_stack_base + size;
        }
index 51916856d7514293da9dea5c9b014142fa1e4931..9bd594618b1dd301abf860f770b9939b2b63c029 100644 (file)
@@ -24,7 +24,7 @@ char __libc_lock_self0[0];
 /* Placeholder for key creation routine from Hurd cthreads library.  */
 int
 weak_function
-cthread_keycreate (cthread_key_t *key)
+__cthread_keycreate (cthread_key_t *key)
 {
   __set_errno (ENOSYS);
  *key = -1;
@@ -34,7 +34,7 @@ cthread_keycreate (cthread_key_t *key)
 /* Placeholder for key retrieval routine from Hurd cthreads library.  */
 int
 weak_function
-cthread_getspecific (cthread_key_t key, void **pval)
+__cthread_getspecific (cthread_key_t key, void **pval)
 {
   *pval = NULL;
   __set_errno (ENOSYS);
@@ -44,19 +44,19 @@ cthread_getspecific (cthread_key_t key, void **pval)
 /* Placeholder for key setting routine from Hurd cthreads library.  */
 int
 weak_function
-cthread_setspecific (cthread_key_t key, void *val)
+__cthread_setspecific (cthread_key_t key, void *val)
 {
   __set_errno (ENOSYS);
   return -1;
 }
 
-/* Call cthread_getspecific which gets a pointer to the return value instead
+/* Call __cthread_getspecific which gets a pointer to the return value instead
    of just returning it.  */
 void *
 weak_function
 __libc_getspecific (cthread_key_t key)
 {
   void *val;
-  cthread_getspecific (key, &val);
+  __cthread_getspecific (key, &val);
   return val;
 }
index fba4972a0cad3fea70d7795e1f10cfc7f135abd2..cc8544e54a506e9f5adc2acdf2e9f2fe7c7a95f7 100644 (file)
@@ -223,8 +223,8 @@ struct __libc_once
    used as argument to __libc_cleanup_region_start.  */
 #define __libc_mutex_unlock __libc_lock_unlock
 
-#define __libc_key_create(KEY,DEST) cthread_keycreate (KEY)
-#define __libc_setspecific(KEY,VAL) cthread_setspecific (KEY, VAL)
+#define __libc_key_create(KEY,DEST) __cthread_keycreate (KEY)
+#define __libc_setspecific(KEY,VAL) __cthread_setspecific (KEY, VAL)
 void *__libc_getspecific (__libc_key_t key);
 
 /* Hide the definitions which are only supposed to be used inside libc in