Open System Services System Calls Reference Manual (G06.25+, H06.03+)
semctl(2) OSS System Calls Reference Manual
NAME
semctl - Performs semaphore control operations
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossksrl
H-series OSS processes: /G/system/zdllnnn/zosskdll
SYNOPSIS
#include <sys/sem.h>
int semctl(
int semid,
int semnum,
int cmd [,
...]);
In this instance, the elipsis (...) indicates that the function is extensible. An additional,
optional parameter can be specified.
PARAMETERS
semid Specifies the ID of the semaphore set.
semnum Specifies the number of the semaphore to be processed.
cmd Specifies the type of operation (see DESCRIPTION).
the fourth parameter
Is defined in the XPG4 specification in a manner that avoids conflict with the
ISO C standard.
This parameter is required when the cmd parameter has values of GETALL,
IPC_SET, IPC_STAT, SETALL, and SETVAL. The fourth parameter can be
omitted in all other calls.
This parameter must be defined in a user program as follows:
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
} arg;
The fields have the following definitions:
val Contains the semaphore value to which the semval field of the
sem structure is set when the cmd parameter has the value SET-
VAL. Individual semaphores are defined using the sem struc-
ture, where semval is one of the structure’s fields.
*buf Points to a semid_ds structure. When the IPC_STAT value is
specified for the cmd parameter, semctl() copies the contents of
the requested semid_ds structure into the location pointed to by
the *buf parameter.
When the IPC_SET value is specified for the cmd parameter,
semctl() copies the contents of the location pointed to by the
*buf parameter into the semid_ds structure associated with the
semaphore specified by the semnum parameter.
7−10 Hewlett-Packard Company 527186-003