sem Successful completion. The function opens
the semaphore and returns the semaphore's
descriptor.
sem_failed Indicates an error. The function sets errno to
one of the following values:
o EACCES-The named semaphore exists and
the permissions specified by ooption are
denied, or the named semaphore does not
exist and the permissions specified by
ooption are denied.
o EEXIST-O_CREAT and O_EXCL are set, and the
named semaphore already exists.
o EINVAL-The sem_open operation is not
supported for the given name. Or, O_CREAT
was specified in ooption and value was
greater than {SEM_VALUE_MAX}.
o EMFILE-Too many semaphore descriptors or
file descriptors are currently in use by
this process.
o ENAMETOOLONG-The length of the name string
exceeds {PATH_MAX}, or a pathname component
is longer than {NAME_MAX} while {_POSIX_NO_
TRUNC} is in effect.
o ENFILE-Too many semaphores are currently
open in the system. ENOENT O_CREAT is
not set, and the named semaphore does not
exist.
o ENOSPC-Insufficient space exists for the
creation of a new named semaphore.
o EVMSERR-OpenVMS specific nontranslatable
error code.