diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2017-10-15 07:48:58 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2017-10-15 07:48:58 -0700 |
commit | 16be5568a0c24b9bd1ade7fa937c94b5d53b6ab1 (patch) | |
tree | 4531c244fc07bc63f33aeb9c48ce4d0a8f34f5a8 /nptl/pthread_create.c | |
parent | df44f9d02b68de45ba8c3984f47ecf1a523306ec (diff) | |
download | glibc-hjl/pr22298/master.tar glibc-hjl/pr22298/master.tar.gz glibc-hjl/pr22298/master.tar.bz2 glibc-hjl/pr22298/master.zip |
Define __PTHREAD_MUTEX_HAVE_PREV only if undefined [BZ #22298]hjl/pr22298/master
It is incorrect to define __PTHREAD_MUTEX_HAVE_PREV to 1 only when
__WORDSIZE == 64. For x32, __PTHREAD_MUTEX_HAVE_PREV should be 1, but
it has __WORDSIZE == 32. This patch defines __PTHREAD_MUTEX_HAVE_PREV
based on __WORDSIZE only if it is undefined. __PTHREAD_MUTEX_HAVE_PREV
check is changed from "#ifdef" to "#if" to support values of 0 or 1.
[BZ #22298]
* nptl/allocatestack.c (allocate_stack): Check if
__PTHREAD_MUTEX_HAVE_PREV is non-zero, instead if
__PTHREAD_MUTEX_HAVE_PREV is defined.
* nptl/descr.h (pthread): Likewise.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
Likewise.
* nptl/pthread_create.c (START_THREAD_DEFN): Likewise.
* sysdeps/nptl/fork.c (__libc_fork): Likewise.
* sysdeps/nptl/pthread.h (PTHREAD_MUTEX_INITIALIZER): Likewise.
* sysdeps/nptl/bits/thread-shared-types.h
(__PTHREAD_MUTEX_HAVE_PREV): Define only if it is undefined.
(__pthread_internal_list): Check __pthread_internal_list instead
of __WORDSIZE.
(__PTHREAD_SPINS_DATA): Likewise.
(__PTHREAD_SPINS): Likewise.
(__pthread_mutex_s): Likewise.
* sysdeps/x86/nptl/bits/pthreadtypes-arch.h
(__PTHREAD_MUTEX_HAVE_PREV): Defined.
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r-- | nptl/pthread_create.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 992331e280..51ae60dfca 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -518,7 +518,7 @@ START_THREAD_DEFN #ifndef __ASSUME_SET_ROBUST_LIST /* If this thread has any robust mutexes locked, handle them now. */ -# ifdef __PTHREAD_MUTEX_HAVE_PREV +# if __PTHREAD_MUTEX_HAVE_PREV void *robust = pd->robust_head.list; # else __pthread_slist_t *robust = pd->robust_list.__next; @@ -536,7 +536,7 @@ START_THREAD_DEFN __list.__next)); robust = *((void **) robust); -# ifdef __PTHREAD_MUTEX_HAVE_PREV +# if __PTHREAD_MUTEX_HAVE_PREV this->__list.__prev = NULL; # endif this->__list.__next = NULL; |