Return Values
sem_init() returns zero after completing successfully.
Any other return value indicates that an error occurred. When any of the following
conditions occurs, the function fails and returns the corresponding value.
-
EINVAL
-
The value argument exceeds SEM_VALUE_MAX.
-
ENOSPC
-
A resource required to initialize
the semaphore has been exhausted. The limit on semaphores SEM_NSEMS_MAX has been reached.
-
EPERM
-
The process lacks the appropriate
privileges to initialize the semaphore.