sem_post(): Fix and document semaphore value overflow error.
The error code is per Austin Group issue #315. I provided different wording for the manual page change. Submitted by: pluknet MFC after: 1 week
This commit is contained in:
parent
3bb4600164
commit
49ba8a68f0
@ -439,8 +439,10 @@ _sem_post(sem_t *sem)
|
||||
|
||||
do {
|
||||
count = sem->_kern._count;
|
||||
if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX)
|
||||
return (EOVERFLOW);
|
||||
if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX) {
|
||||
errno = EOVERFLOW;
|
||||
return (-1);
|
||||
}
|
||||
} while (!atomic_cmpset_rel_int(&sem->_kern._count, count, count + 1));
|
||||
if (count & USEM_HAS_WAITERS)
|
||||
usem_wake(&sem->_kern);
|
||||
|
@ -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 ,
|
||||
|
Loading…
x
Reference in New Issue
Block a user