[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#647229: p11-kit: FTBFS(!linux): error: 'PTHREAD_MUTEX_RECURSIVE' undeclared (first use in this function)



clone 647229 -1
tags -1 patch
reassign -1 libc0.1-dev
thanks

Hi,

2011/11/6 Andreas Metzler <ametzler@downhill.at.eu.org>:
> Hello,
> Afaict this happens because on Linux the respective parts of pthread.h
> are conditional on
> #if defined __USE_UNIX98 || defined __USE_XOPEN2K8
> but only
> #if defined __USE_UNIX98
> on kFree-BSD.
>
> features.h on both Linux and kFree-BSD #defines __USE_XOPEN2K8 by
> default.

I compared nptl and linuxthreads versions of pthread.h and there were
a pair of similar problems.

Here's a patch that harmonizes usage of __USE_XOPEN2K8 a bit with the
nptl version.

-- 
Robert Millan
=== modified file 'linuxthreads/sysdeps/pthread/pthread.h'
--- linuxthreads/sysdeps/pthread/pthread.h	2011-11-06 16:25:40 +0000
+++ linuxthreads/sysdeps/pthread/pthread.h	2011-11-06 16:31:48 +0000
@@ -86,7 +86,7 @@ enum
   PTHREAD_MUTEX_RECURSIVE_NP,
   PTHREAD_MUTEX_ERRORCHECK_NP,
   PTHREAD_MUTEX_ADAPTIVE_NP
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
   ,
   PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP,
   PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
@@ -241,7 +241,6 @@ extern int pthread_attr_setscope (pthrea
 extern int pthread_attr_getscope (__const pthread_attr_t *__restrict __attr,
 				  int *__restrict __scope) __THROW;
 
-#ifdef __USE_UNIX98
 /* Set the size of the guard area at the bottom of the thread.  */
 extern int pthread_attr_setguardsize (pthread_attr_t *__attr,
 				      size_t __guardsize) __THROW;
@@ -250,7 +249,6 @@ extern int pthread_attr_setguardsize (pt
 extern int pthread_attr_getguardsize (__const pthread_attr_t *__restrict
 				      __attr, size_t *__restrict __guardsize)
      __THROW;
-#endif
 
 /* Set the starting address of the stack of the thread to be created.
    Depending on whether the stack grows up or down the value must either
@@ -371,7 +369,7 @@ extern int pthread_mutexattr_getpshared
 extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr,
 					 int __pshared) __THROW;
 
-#ifdef __USE_UNIX98
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K8
 /* Set the mutex kind attribute in *ATTR to KIND (either PTHREAD_MUTEX_NORMAL,
    PTHREAD_MUTEX_RECURSIVE, PTHREAD_MUTEX_ERRORCHECK, or
    PTHREAD_MUTEX_DEFAULT).  */


Reply to: