[git commit future 1/1] semaphore.h, uClibc_local_lim.h: make sure SEM_VALUE_MAX is always defined

Peter S. Mazinger ps.m at gmx.net
Thu Mar 10 12:15:10 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=893d5476636c5292d66a1c52ce5914d8ba1e9506
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/future

LT old and new provided SEM_VALUE_MAX in semaphore.h, NPTL in local_lim.h
Make sure to get the same definitions, independently of the fact, that
semaphore.h is included or not.

Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
---
 libc/sysdeps/linux/common/bits/uClibc_local_lim.h |    5 ++++-
 libpthread/linuxthreads.old/semaphore.h           |    3 +++
 libpthread/linuxthreads/semaphore.h               |    3 +++
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
index 832051c..0727ebf 100644
--- a/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
+++ b/libc/sysdeps/linux/common/bits/uClibc_local_lim.h
@@ -20,7 +20,10 @@
 /* glibc uses 16384 */
 # define PTHREAD_THREADS_MAX	1024
 # define TIMER_MAX		256
-# undef SEM_VALUE_MAX
+# ifdef __LINUXTHREADS_OLD__
+#  undef SEM_VALUE_MAX
+#  define SEM_VALUE_MAX	((int) ((~0u) >> 1))
+# endif
 # undef PTHREAD_STACK_MIN
 /* glibc uses at least 16364 */
 # define PTHREAD_STACK_MIN	1024
diff --git a/libpthread/linuxthreads.old/semaphore.h b/libpthread/linuxthreads.old/semaphore.h
index fea127b..c5ff6a0 100644
--- a/libpthread/linuxthreads.old/semaphore.h
+++ b/libpthread/linuxthreads.old/semaphore.h
@@ -17,6 +17,7 @@
 
 #include <features.h>
 #include <sys/types.h>
+#include <limits.h>
 #ifdef __USE_XOPEN2K
 # define __need_timespec
 # include <time.h>
@@ -42,7 +43,9 @@ typedef struct
 #define SEM_FAILED	((sem_t *) 0)
 
 /* Maximum value the semaphore can have.  */
+#ifndef SEM_VALUE_MAX
 #define SEM_VALUE_MAX	((int) ((~0u) >> 1))
+#endif
 
 
 __BEGIN_DECLS
diff --git a/libpthread/linuxthreads/semaphore.h b/libpthread/linuxthreads/semaphore.h
index 3084209..f9ad4c5 100644
--- a/libpthread/linuxthreads/semaphore.h
+++ b/libpthread/linuxthreads/semaphore.h
@@ -17,6 +17,7 @@
 
 #include <features.h>
 #include <sys/types.h>
+#include <limits.h>
 #ifdef __USE_XOPEN2K
 # define __need_timespec
 # include <time.h>
@@ -42,7 +43,9 @@ typedef struct
 #define SEM_FAILED	((sem_t *) 0)
 
 /* Maximum value the semaphore can have.  */
+#ifndef SEM_VALUE_MAX
 #define SEM_VALUE_MAX	(2147483647)
+#endif
 
 
 __BEGIN_DECLS
-- 
1.7.3.4



More information about the uClibc-cvs mailing list