summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2016-10-24 22:34:36 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2016-10-24 22:37:40 +0200
commit79e9d2b78ec0747a94731d45e0e5149269e96159 (patch)
treea68858fc2037b1a8b945c567312f678864c454e1
parent05babf965ec39be7e1c8a7306ec1c60b1e614654 (diff)
Do not pthread_self when raise is called before libpthread init
* Versions (__pthread_threads): Add in GLIBC_PRIVATE. * pthreadP.h (__pthread_threads): Declare. * sysdeps/generic/raise.c (__pthread_threads): Make symbol weak. (raise): Check for __pthread_threads before calling __pthread_self.
-rw-r--r--Versions1
-rw-r--r--pthreadP.h1
-rw-r--r--sysdeps/generic/raise.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/Versions b/Versions
index 089c6b5..4ad3c3e 100644
--- a/Versions
+++ b/Versions
@@ -142,5 +142,6 @@ libpthread {
}
GLIBC_PRIVATE {
__shm_directory;
+ __pthread_threads;
}
}
diff --git a/pthreadP.h b/pthreadP.h
index f1fd625..97e3028 100644
--- a/pthreadP.h
+++ b/pthreadP.h
@@ -22,5 +22,6 @@
extern pthread_t __pthread_self (void);
extern int __pthread_kill (pthread_t threadid, int signo);
+extern struct __pthread **__pthread_threads;
#endif /* pthreadP.h */
diff --git a/sysdeps/generic/raise.c b/sysdeps/generic/raise.c
index cc18b39..b98cf51 100644
--- a/sysdeps/generic/raise.c
+++ b/sysdeps/generic/raise.c
@@ -24,6 +24,7 @@
#pragma weak __pthread_kill
#pragma weak __pthread_self
+#pragma weak __pthread_threads
int
raise (int signo)
{
@@ -31,7 +32,7 @@ raise (int signo)
"the effect of the raise() function shall be equivalent to
calling: pthread_kill(pthread_self(), sig);" */
- if (__pthread_kill)
+ if (__pthread_kill && __pthread_threads)
{
int err;
err = __pthread_kill (__pthread_self (), signo);