sem(5) sem(5)
NAME
sem - semaphore facility
SYNOPSIS
#include <sys/sem.h>
DESCRIPTION
The <sys/sem.h> header defines the following constants and structures.
Semaphore operation flags:
SEMUNDO Set up adjust on exit entry.
Command definitions for the function semctl():
GETNCNT Get semncnt.
GETPID Get sempid.
GETVAL Get semval.
GETALL Get all cases of semval.
GETZCNT Get semzcnt.
SETVAL Set semval.
SETALL Set all cases of semval.
The structure semidds contains the following members:
struct ipcperm semperm Operation permission structure.
unsigned short int semnsems Number of semaphores in set.
timet semotime Last semop() time.
timet semctime Last time changed by semctl().
The pidt, timet, keyt and sizet types are defined as described in
<sys/types.h>.
A semaphore is represented by an anonymous structure containing the
following members:
unsigned short int semval Semaphore value.
pidt sempid Process ID of last operation.
unsigned short int semncnt Number of processes waiting for semval
to become greater than current value.
Page 1 Reliant UNIX 5.44 Printed 11/98
sem(5) sem(5)
unsigned short int semzcnt Number of processes waiting for semval
to become 0.
The structure sembuf contains the following members:
unsigned short int semnum Semaphore number.
short int semop Semaphore operation.
short int semflg Operation flags.
The following are declared as functions and may also be defined as
macros:
int semctl(int semid, int semnum, int cmd, ...);
int semget(keyt key, int nsems, int semflg);
int semop(int semid, struct sembuf *sops, sizet nsops);
In addition, all of the symbols from <sys/ipc.h> will be defined when
this header is included.
SEE ALSO
semctl(2), semget(2), semop(2), types(5).
Page 2 Reliant UNIX 5.44 Printed 11/98