Open System Services System Calls Reference Manual (G06.25+, H06.03+)
System Functions (s and S) shmctl(2)
DESCRIPTION
The shmctl() function allows a process to query or set the contents of the shmid_ds structure
associated with the specified shared memory identifier. It also allows a process to remove the
shared memory identifier and its associated shmid_ds structure. The value of the cmd parameter
determines which operation is performed.
The IPC_SET value of the cmd parameter uses the user-supplied contents of the buf structure to
set the corresponding fields in the shmid_ds structure associated with the shared memory
identifier. The fields are set as follows:
• The owner’s user ID field (shm_perm.uid) is set as specified in the input.
• The owner’s group ID field (shm_perm.gid) is set as specified in the input.
• The access modes field (shm_perm.mode) is set as specified in the low-order nine bits
of the corresponding field in the input.
The IPC_SET and IPC_RMID values of the cmd parameter also update the shm_perm.ctime
field to the current time.
Use From the Guardian Environment
If called from a Guardian process, the function call fails and errno is set to the value of [ENO-
TOSS].
NOTES
The shared memory identifier, shmid, is not the Guardian environment segid value or segment
identifier.
Programs should not be written to depend upon the maximum number of attached shared seg-
ments. This limit is subject to change.
The maximum number of attached segments decreases when the size of any attached segment
exceeds SHMLBA.
Programs should not be written to depend upon the region size. The region size is subject to
change.
Refer to the SEGMENT_ALLOCATE_ procedure description in the Guardian Procedure Calls
Reference Manual for more information about segment limits.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the shmctl() function sets errno to the corresponding
value:
[EACCES] The cmd parameter is IPC_STAT, but the calling process does not have read
permission.
[EFAULT] One of the following conditions exists:
• The cmd parameter is IPC_STAT, and either the buf structure is not in
the address space of the process or the function cannot write into the buf
structure.
527186-003 Hewlett-Packard Company 7−49