summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/sem_new.c6
-rw-r--r--lib/libc/gen/sem_post.35
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c
index ec1a2fd..7b04ef0 100644
--- a/lib/libc/gen/sem_new.c
+++ b/lib/libc/gen/sem_new.c
@@ -439,8 +439,10 @@ _sem_post(sem_t *sem)
do {
count = sem->_kern._count;
- if (count + 1 > SEM_VALUE_MAX)
- return (EOVERFLOW);
+ if (count + 1 > SEM_VALUE_MAX) {
+ errno = EOVERFLOW;
+ return (-1);
+ }
} while(!atomic_cmpset_rel_int(&sem->_kern._count, count, count+1));
(void)usem_wake(&sem->_kern);
return (0);
diff --git a/lib/libc/gen/sem_post.3 b/lib/libc/gen/sem_post.3
index 67559cc..5f8a35d 100644
--- a/lib/libc/gen/sem_post.3
+++ b/lib/libc/gen/sem_post.3
@@ -27,7 +27,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 15, 2000
+.Dd January 28, 2015
.Dt SEM_POST 3
.Os
.Sh NAME
@@ -65,6 +65,9 @@ The
.Fa sem
argument
points to an invalid semaphore.
+.It Bq Er EOVERFLOW
+The semaphore value would exceed
+.Dv SEM_VALUE_MAX .
.El
.Sh SEE ALSO
.Xr sem_getvalue 3 ,
OpenPOWER on IntegriCloud