get semaphore set
() system call returns the
semaphore identifier associated with key
A new set containing nsems
created if either key
is equal to
does not have a semaphore set associated
with it and the
bit is set in
The access modes of the created semaphores is specified in
as a bitwise OR of zero or more of the
SEM_A alter permission for owner
SEM_R read permission for owner
SEM_A >> 3 alter permission for group
SEM_R >> 3 read permission for group
SEM_A >> 6 alter permission for other
SEM_R >> 6 read permission for other
If a new set of semaphores is created, the data structure associated with it
) is initialized as
- sem_perm.cuid and
sem_perm.uid are set to the effective UID
of the calling process.
- sem_perm.gid and
sem_perm.cgid are set to the effective
GID of the calling process.
- sem_perm.mode is set to the lower 9 bits
- sem_nsems is set to the value of
- sem_ctime is set to the current
- sem_otime is set to 0.
() returns a non-negative semaphore
identifier if successful. Otherwise, -1 is returned and
is set to reflect the error.
- The caller has no permission to access a semaphore set already associated
IPC_EXCL are set in
semflg, and a semaphore set is already
associated with key.
- nsems is less than or equal to 0 or
greater than the system limit for the number in a semaphore set.
A semaphore set associated with key exists,
but has fewer semaphores than the number specified in
- A new set of semaphores could not be created because the system limit for
the number of semaphores or the number of semaphore sets has been
was not set in semflg and no semaphore
set associated with key was found.