Gets the value of a specified semaphore.
This function is OpenVMS Alpha and Integrity servers only.
Format
#include <semaphore.h>
int sem_getvalue (sem_t *sem, int *sval);
1 – Argument
sem
The semaphore for which a value is to be returned.
sval
The location to be updated with the value of the semaphore
indicated by the sem argument.
2 – Description
The sem_getvalue function updates a location referenced by the
sval argument with the value of semaphore sem. The updated value
represents an actual semaphore value that occurred during the
call, but may not be the actual value of the semaphore at the
time that the value is returned to the calling process.
If the semaphore is locked, the value returned will either be
zero or a negative number indicating the number of processes
waiting for the semaphore at some time during the call.
3 – Return Values
0 Successful completion.
-1 Indicates an error. The function sets errno to
one of the following values:
o EINVAL - The sem argument is not a valid
semaphore.
o EVMSERR - OpenVMS specific nontranslatable
error code.