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.
The value argument exceeds SEM_VALUE_MAX.
A resource required to initialize
the semaphore has been exhausted. The limit on semaphores SEM_NSEMS_MAX has been reached.
The process lacks the appropriate
privileges to initialize the semaphore.