#include <semaphore.h> int
sem_init (sem_t *sem int pshared unsigned int value);
DESCRIPTION
The
sem_init ();
function initializes the unnamed semaphore pointed to by
Fa sem
to have the value
Fa value .
A non-zero value for
Fa pshared
specifies a shared semaphore that can be used by multiple processes, which this
implementation is not capable of.
Following a successful call to
sem_init (,);
Fa sem
can be used as an argument in subsequent calls to
sem_wait3,
sem_trywait3,
sem_post3,
and
sem_destroy3.
The
Fa sem
argument is no longer valid after a successful call to
sem_destroy3.
The
sem_init ();
function conforms to
St -p1003.1-96 .
This implementation does not support shared semaphores, and reports this fact
by setting
errno
to
Er EPERM .
This is perhaps a stretch of the intention of
POSIX
but is
compliant, with the caveat that
sem_init ();
always reports a permissions error when an attempt to create a shared semaphore
is made.