Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
semctl(2) OSS System Calls Reference Manual
*array Points to an array of semaphore values. These values are
returned when the cmd parameter has the value GETALL.
These values are used to set semaphore values when the cmd
parameter has the value SETALL.
arg Specifies the instance of the union used for the fourth parameter.
DESCRIPTION
An OSS semaphore is identified by a set ID and by a unique semaphore number within that set
ID. The semaphore set ID is unique within an HP NonStop server node.
The semctl() function allows a process to perform various operations on the following:
• An individual semaphore within a semaphore set
• All semaphores within a semaphore set
• The semid_ds structure associated with the semaphore set
The semctl() function also allows a process to remove the semaphore set ID and its associated
semid_ds structure. Individual semaphores are defined using the sem structure.
The cmd parameter determines which operation is performed. The following values for cmd
operate on the specified semaphore (given by the semnum parameter) within the specified sema-
phore set (given by the semid parameter):
GETNCNT Returns the number of processes waiting for the specified semaphore’s value to
become greater than its current value. This number is returned as the value of
the semncnt field from the semid_ds structure.
This operation requires read access permission.
GETPID Returns the OSS process ID of the process that last operated on the specified
semaphore. This operation requires read access permission.
GETVAL Returns the value of the specified semaphore. This operation requires read
access permission.
GETZCNT Returns the number of processes waiting for the specified semaphore’s value to
become 0 (zero). This number is returned as the value of the semzcnt field from
the semid_ds structure.
This operation requires read access permission.
SETVAL Sets the value of the specified semaphore to the value specified through the
fourth parameter (arg.val). When this operation successfully executes, the sys-
tem clears the semaphore’s adjust-on-exit value in all processes that have a
semadj value for this semaphore. It also wakes up all processes that are waiting
on this semaphore when the value of semzcnt or semncnt is greater than zero,
depending on whether the value of this semaphore is set to zero or a positive
integer respectively.
This operation requires alter access permission.
The following values for cmd operate on all the semaphores in the specified semaphore set:
GETALL Returns the values of all semaphores in the set by placing these values in the
array pointed to in fourth parameter (arg.array). This operation requires read
access permission.
7−16 Hewlett-Packard Company 527186-023