summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2017-09-24 23:09:59 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-09-24 23:09:59 +0200
commitf881f17267506f3ced17259a066a4d95bffb57f0 (patch)
tree8fd2dd37c928033b6cc6fff7835575899b39b1e5 /sysdeps
parent4c9332bfdc9ccd793b6ded3168602195913cedb3 (diff)
Fix symbols exposed in linkspace
Libc uses some thread functions, but should not expose the corresponding symbols, so use aliases. * Versions (__cthread_detach, __cthread_fork, __cthread_keycreate, __cthread_getspecific, __cthread_setspecific, __pthread_getattr_np, __pthread_attr_getstack): Add symbols * pthread/cthreads-compat.c (cthread_t, cthread_fn_t, cthread_key_t): Do not define. (cthread_detach): Rename to __cthread_detach. (cthread_detach): Define as weak alias to __cthread_detach. (cthread_fork, cthread_keycreate, cthread_getspecific, cthread_setspecific): Likewise. * pthread/pt-getattr.c (pthread_getattr_np): Likewise. * sysdeps/generic/pt-attr-getstack.c (pthread_attr_getstack): Likewise. * sysdeps/pthread/pthread.h (__cthread_t, __cthread_key_t, __cthread_fn_t, __cthread_fork, __cthread_detach, __cthread_keycreate, __cthread_getspecific, __cthread_setspecific, __pthread_getattr_np, __pthread_attr_getstack): Declare.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/pt-attr-getstack.c3
-rw-r--r--sysdeps/pthread/pthread.h15
2 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/generic/pt-attr-getstack.c b/sysdeps/generic/pt-attr-getstack.c
index 7beb79f..5ab821e 100644
--- a/sysdeps/generic/pt-attr-getstack.c
+++ b/sysdeps/generic/pt-attr-getstack.c
@@ -21,7 +21,7 @@
#include <pt-internal.h>
int
-pthread_attr_getstack (const pthread_attr_t *attr,
+__pthread_attr_getstack (const pthread_attr_t *attr,
void **stackaddr,
size_t *stacksize)
{
@@ -29,3 +29,4 @@ pthread_attr_getstack (const pthread_attr_t *attr,
pthread_attr_getstacksize (attr, stacksize);
return 0;
}
+weak_alias (__pthread_attr_getstack, pthread_attr_getstack)
diff --git a/sysdeps/pthread/pthread.h b/sysdeps/pthread/pthread.h
index 1d4d3c7..8e65b05 100644
--- a/sysdeps/pthread/pthread.h
+++ b/sysdeps/pthread/pthread.h
@@ -1,7 +1,22 @@
#ifndef _PTHREAD_H
#include <pthread/pthread.h>
+/* These represent the interface used by glibc itself. */
+
extern int __pthread_mutex_lock (pthread_mutex_t *__mutex);
extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex);
+typedef struct __cthread *__cthread_t;
+typedef int __cthread_key_t;
+typedef void * (*__cthread_fn_t)(void *__arg);
+
+__cthread_t __cthread_fork (__cthread_fn_t, void *);
+void __cthread_detach (__cthread_t);
+int __cthread_keycreate (__cthread_key_t *);
+int __cthread_getspecific (__cthread_key_t, void **);
+int __cthread_setspecific (__cthread_key_t, void *);
+
+int __pthread_getattr_np (pthread_t, pthread_attr_t *);
+int __pthread_attr_getstack (const pthread_attr_t *, void **, size_t *);
+
#endif