DESCRIPTION
sem_getvalue() places the current value of the semaphore pointed to sem into the integer pointed to by sval.
If one or more processes or threads are blocked waiting to lock the semaphore with sem_wait(3), POSIX.1-2001 permits
two possibilities for the value returned in sval: either 0 is returned; or a negative number whose absolute value is
the count of the number of processes and threads currently blocked in sem_wait(3). Linux adopts the former behavior.
RETURN VALUE
sem_getvalue() returns 0 on success; on error, -1 is returned and errno is set to indicate the error.
ERRORS
EINVAL sem is not a valid semaphore.
CONFORMING TO
POSIX.1-2001.
NOTES
The value of the semaphore may already have changed by the time sem_getvalue() returns.
The sem_unlink() function removes the specified named semaphore. If other process are currently referencing the specified semaphore, sem_unlink() has no effect on the state of the semaphore. If one or more processes have the specified semaphore open when you call sem_unlink(), the semaphore is not removed until all references to the semaphore has been destroyed by sem_close(), _exit(), or exec() calls. Calls to sem_open() to re-create or re-connect to the specified semaphore refer to a new semaphore after sem_unlink() is called. The sem_unlink() call does not block until all references have been destroyed; it returns immediately.