sem_getvalue(3C)
sem_getvalue - get the value of a posix named or unnamed semaphore
As shipped in IRIX 6.5.19. Unchanged since IRIX 6.5.
NAME sem_getvalue - get the value of a posix named or unnamed semaphore SYNOPSIS #include <semaphore.h> int sem_getvalue(sem_t *sem, int *value); DESCRIPTION sem_getvalue obtains the current value of the semaphore located at address sem, and stores it at address value. The returned value should be viewed as a snapshot only, useful for debugging. If the number stored at value is positive, then the semaphore is available. If the number stored at value is zero, then the semaphore is not available. If the number stored at value is negative, then the semaphore is not available and the absolute value of the number represents the number of processes currently blocked on the semaphore. The address sem may reside anywhere in the calling processes address space, but the process must have read and write access to sem. sem_getvalue will fail if the following is true: [EINVAL] The semaphore located at address sem is not a valid posix named or unnamed semaphore. SEE ALSO sem_init(3C), sem_destroy(3C), sem_getvalue(3C), sem_post(3C), sem_wait(3C), sem_trywait(3C), sem_open(3C), sem_close(3C), sem_unlink(3C), DIAGNOSTICS Upon successful completion, a value of 0 is returned to the calling process. Otherwise, a value of -1 is returned and errno is set to indicate the error.