System V Semaphores 991
int /* Release semaphore - increment it by 1 */
releaseSem(int semId, int semNum)
{
struct sembuf sops;
sops.sem_num = semNum;
sops.sem_op = 1;
sops.sem_flg = bsUseSemUndo? SEM_UNDO : 0;
return semop(semId, &sops, 1);
}
–––––––––––––––––––––––––––––––––––––––––––––––––––––– svsem/binary_sems.c
47.10 Semaphore Limits
Most UNIX implementations impose various limits on the operation of System V
semaphores. The following is a list of the Linux semaphore limits. The system call
affected by the limit and the error that results if the limit is reached are noted in
parentheses.
SEMAEM
This is the maximum value that can be recorded in a semadj total. SEMAEM is
defined to have the same value as SEMVMX (described below). (semop(), ERANGE)
SEMMNI
This is a system-wide limit on the number of semaphore identifiers (in
other words, semaphore sets) that can be created. (semget(), ENOSPC)
SEMMSL
This is the maximum number of semaphores that can be allocated in a
semaphore set. (semget(), EINVAL)
SEMMNS
This is a system-wide limit on the number of semaphores in all semaphore
sets. The number of semaphores on the system is also limited by SEMMNI and
SEMMSL; in fact, the default value for SEMMNS is the product of the defaults for
these two limits. (semget(), ENOSPC)
SEMOPM
This is the maximum number of operations per semop() call. (semop(), E2BIG)
SEMVMX
This is the maximum value for a semaphore. (semop(), ERANGE)
The limits above appear on most UNIX implementations. Some UNIX implementa-
tions (but not Linux) impose the following additional limits relating to semaphore
undo operations (Section 47.8):
SEMMNU
This is a system-wide limit on the total number of semaphore undo structures.
Undo structures are allocated to store semadj values.
SEMUME
This is the maximum number of undo entries per semaphore undo structure.