1
0
Files
irix-657m-src/eoe/man/man3c/sem_getvalue.3c
2022-09-29 17:59:04 +03:00

46 lines
1.4 KiB
Plaintext

'\"macro stdmacro
.Op c p a
.TH sem_getvalue 3C
.SH NAME
\f4sem_getvalue\f1 \- get the value of a posix named or unnamed semaphore
.SH SYNOPSIS
.nf
\f4#include <semaphore.h>\f1
.sp .6v
\f4int sem_getvalue(sem_t *\f2sem\fP, int *\f2value\fP);\f1
.fi
.SH DESCRIPTION
.P
\f4sem_getvalue\f1 obtains the current value of the semaphore located
at address \f2sem\fP, and stores it at address \f2value\fP. The returned
value should be viewed as a snapshot only, useful for debugging.
.P
If the number stored at \f2value\fP is positive, then the semaphore is
available. If the number stored at \f2value\fP is zero, then the semaphore
is not available. If the number stored at \f2value\fP 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.
.P
The address \f2sem\fP may reside anywhere in the calling processes
address space, but the process must have read and write access to \f2sem\fP.
.P
\f4sem_getvalue\f1 will fail if the following is true:
.TP 12
[EINVAL]
The semaphore located at address \f2sem\fP is not a valid posix named
or unnamed semaphore.
.SH 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),
.SH DIAGNOSTICS
Upon successful completion, a value of 0 is returned to the calling process.
Otherwise, a value of -1 is returned and \f4errno\fP is set to indicate
the error.