[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd,commited 05/10] htl: Add support for semaphore maximum value
From: |
Samuel Thibault |
Subject: |
[hurd,commited 05/10] htl: Add support for semaphore maximum value |
Date: |
Mon, 10 Feb 2020 02:05:03 +0100 |
---
sysdeps/htl/sem-post.c | 7 +++++++
sysdeps/mach/hurd/bits/local_lim.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/sysdeps/htl/sem-post.c b/sysdeps/htl/sem-post.c
index 77f297314e..2e0be8fc49 100644
--- a/sysdeps/htl/sem-post.c
+++ b/sysdeps/htl/sem-post.c
@@ -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);
diff --git a/sysdeps/mach/hurd/bits/local_lim.h
b/sysdeps/mach/hurd/bits/local_lim.h
index 348eee74bb..8e781e4965 100644
--- a/sysdeps/mach/hurd/bits/local_lim.h
+++ b/sysdeps/mach/hurd/bits/local_lim.h
@@ -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)
--
2.24.1
- [hurd, commited 01/10] htl: clean __pthread_get_cleanup_stack hidden proto, Samuel Thibault, 2020/02/09
- [hurd,commited 06/10] htl: Make sem_open return ENOSYS, Samuel Thibault, 2020/02/09
- [hurd, commited 04/10] pthread: Move key tests from nptl to sysdeps/pthread, Samuel Thibault, 2020/02/09
- [hurd,commited 05/10] htl: Add support for semaphore maximum value,
Samuel Thibault <=
- [hurd,commited 03/10] hurd: Make nanosleep a cancellation point, Samuel Thibault, 2020/02/09
- [hurd, commited 08/10] pthread: Move most sem tests from nptl to sysdeps/pthread, Samuel Thibault, 2020/02/09
- [hurd,commited 02/10] htl: Add support for libc cancellation points, Samuel Thibault, 2020/02/09
- [hurd,commited 09/10] htl: Fix barrier_wait with one thread, Samuel Thibault, 2020/02/09
- [hurd, commited 10/10] pthread: Move most barrier tests from nptl to sysdeps/pthread, Samuel Thibault, 2020/02/09
- [hurd,commited 07/10] htl: Make sem_wait/sem_timedwait interruptible, Samuel Thibault, 2020/02/09