1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Change SEM_VALUE_MAX (maximum value of a POSIX semaphore) from UINT_MAX

to INT_MAX.  Otherwise, a process could create a semaphore (or increase
its value via ksem_post()) beyond INT_MAX and sem_getvalue() would return
a negative value.  sem_getvalue() is only supposed to return a negative
value if that is the number of waiters for that semaphore.

MFC after:	2 weeks
This commit is contained in:
John Baldwin 2008-06-26 13:51:25 +00:00
parent 127cc7673d
commit f4c1db8901
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180032

View File

@ -37,12 +37,14 @@
#ifndef _SEMAPHORE_H_
#define _SEMAPHORE_H_
#include <machine/_limits.h>
/* Opaque type definition. */
struct sem;
typedef struct sem * sem_t;
#define SEM_FAILED ((sem_t *)0)
#define SEM_VALUE_MAX (~0U) /* Equivalent to UINT_MAX. */
#define SEM_VALUE_MAX __INT_MAX
#ifndef _KERNEL
#include <sys/cdefs.h>