[hurd,commited,05/10] htl: Add support for semaphore maximum value
Commit Message
---
sysdeps/htl/sem-post.c | 7 +++++++
sysdeps/mach/hurd/bits/local_lim.h | 3 +++
2 files changed, 10 insertions(+)
@@ -30,6 +30,13 @@ __sem_post (sem_t *sem)
if (sem->__value > 0)
/* Do a quick up. */
{
+ if (sem->__value == SEM_VALUE_MAX)
+ {
+ __pthread_spin_unlock (&sem->__lock);
+ errno = EOVERFLOW;
+ return -1;
+ }
+
assert (sem->__queue == NULL);
sem->__value++;
__pthread_spin_unlock (&sem->__lock);
@@ -41,3 +41,6 @@
/* The number of threads per process. */
#define _POSIX_THREAD_THREADS_MAX 64
+
+/* Maximum value the semaphore can have. */
+#define SEM_VALUE_MAX (2147483647)