Semaphore Manager sem_open - Open a named semaphore
RTEMS POSIX API User's Guide
9.4.3: sem_open - Open a named semaphore
CALLING SEQUENCE:
int sem_open(
const char *name,
int oflag
);
ARGUMENTS:
The following flag bit may be set in oflag:
O_CREAT - Creates the semaphore if it does not already exist. If O_CREAT
is set and the semaphore already exists then O_CREAT has no effect. Otherwise,
sem_open() creates a semaphore. The O_CREAT flag requires the third and fourth
argument: mode and value of type mode_t and unsigned int, respectively.
O_EXCL - If O_EXCL and O_CREAT are set, all call to sem_open() shall fail
if the semaphore name exists
STATUS CODES:
EACCES
Valid name specified but oflag permissions are denied, or the semaphore name
specified does not exist and permission to create the named semaphore is denied.
EEXIST
O_CREAT and O_EXCL are set and the named semaphore already exists.
EINTR
The sem_open() operation was interrupted by a signal.
EINVAL
The sem_open() operation is not supported for the given name.
EMFILE
Too many semaphore descriptors or file descriptors in use by this process.
ENAMETOOLONG
The length of the name exceed PATH_MAX or name component is longer than NAME_MAX
while POSIX_NO_TRUNC is in effect.
ENOENT
O_CREAT is not set and the named semaphore does not exist.
ENOSPC
There is insufficient space for the creation of a new named semaphore.
ENOSYS
The function sem_open() is not supported by this implementation.
DESCRIPTION:
The sem_open() function establishes a connection between a specified semaphore and
a process. After a call to sem_open with a specified semaphore name, a process
can reference to semaphore by the associated name using the address returned by
the call. The oflag arguments listed above control the state of the semaphore by
determining if the semaphore is created or accessed by a call to sem_open().