RTEMS Logo

RTEMS 4.9.4 On-Line Library


Semaphore Manager sem_getvalue - Get the value of a semaphore

PREV UP next Bookshelf RTEMS POSIX API User's Guide

9.4.10: sem_getvalue - Get the value of a semaphore

CALLING SEQUENCE:

int sem_getvalue(
  sem_t *sem,
  int   *sval
);

STATUS CODES:

EINVAL
The "sem" argument does not refer to a valid semaphore
ENOSYS
The function sem_getvalue is not supported by this implementation

DESCRIPTION:

The sem_getvalue functions sets the location referenced by the "sval" argument to the value of the semaphore without affecting the state of the semaphore. The updated value represents a semaphore value that occurred at some point during the call, but is not necessarily the actual value of the semaphore when it returns to the calling process.

If "sem" is locked, the value returned by sem_getvalue will be zero or a negative number whose absolute value is the number of processes waiting for the semaphore at some point during the call.

NOTES:

If the functions completes successfully, it shall return a value of zero. Otherwise, it shall return a value of -1 and set "errno" to specify the error that occurred.


PREV UP next Bookshelf RTEMS POSIX API User's Guide

Copyright © 1988-2008 OAR Corporation