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 specied.
PARAMETERS
semid Species the ID of the semaphore set.
semnum Species the number of the semaphore to be processed.
cmd Species the type of operation (see DESCRIPTION).
the fourth parameter
Is dened in the XPG4 specication in a manner that avoids conict 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 dened in a user program as follows:
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
} arg;
The elds have the following denitions:
val Contains the semaphore value to which the semval eld of the
sem structure is set when the cmd parameter has the value SET-
VAL. Individual semaphores are dened using the sem struc-
ture, where semval is one of the structures elds.
*buf Points to a semid_ds structure. When the IPC_STAT value is
specied 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 specied 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 specied by the semnum parameter.
710 Hewlett-Packard Company 527186-003