1SEM_GETVALUE(3P)           POSIX Programmer's Manual          SEM_GETVALUE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       sem_getvalue - get the value of a semaphore (REALTIME)
13

SYNOPSIS

15       #include <semaphore.h>
16
17       int sem_getvalue(sem_t *restrict sem, int *restrict sval);
18
19

DESCRIPTION

21       The sem_getvalue() function shall update the location referenced by the
22       sval  argument  to  have  the  value of the semaphore referenced by sem
23       without affecting the state of the semaphore. The updated value  repre‐
24       sents  an actual semaphore value that occurred at some unspecified time
25       during the call, but it need not be the actual value of  the  semaphore
26       when it is returned to the calling process.
27
28       If  sem is locked, then the object to which sval points shall either be
29       set to zero or to a negative number whose absolute value represents the
30       number  of processes waiting for the semaphore at some unspecified time
31       during the call.
32

RETURN VALUE

34       Upon successful completion, the sem_getvalue() function shall return  a
35       value  of  zero. Otherwise, it shall return a value of -1 and set errno
36       to indicate the error.
37

ERRORS

39       The sem_getvalue() function shall fail if:
40
41       EINVAL The sem argument does not refer to a valid semaphore.
42
43
44       The following sections are informative.
45

EXAMPLES

47       None.
48

APPLICATION USAGE

50       The sem_getvalue() function is part of the Semaphores option  and  need
51       not be available on all implementations.
52

RATIONALE

54       None.
55

FUTURE DIRECTIONS

57       None.
58

SEE ALSO

60       semctl(),  semget(),  semop(),  sem_post(),  sem_timedwait(),  sem_try‐
61       wait(),    sem_wait(),    the    Base     Definitions     volume     of
62       IEEE Std 1003.1-2001, <semaphore.h>
63
65       Portions  of  this text are reprinted and reproduced in electronic form
66       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
67       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
68       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
69       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
70       event of any discrepancy between this version and the original IEEE and
71       The  Open Group Standard, the original IEEE and The Open Group Standard
72       is the referee document. The original Standard can be  obtained  online
73       at http://www.opengroup.org/unix/online.html .
74
75
76
77IEEE/The Open Group                  2003                     SEM_GETVALUE(3P)
Impressum