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 specied shared memory identier. It also allows a process to remove the
shared memory identier 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 elds in the shmid_ds structure associated with the shared memory
identier. The elds are set as follows:
The owners user ID eld (shm_perm.uid) is set as specied in the input.
The owners group ID eld (shm_perm.gid) is set as specied in the input.
The access modes eld (shm_perm.mode) is set as specied in the low-order nine bits
of the corresponding eld in the input.
The IPC_SET and IPC_RMID values of the cmd parameter also update the shm_perm.ctime
eld 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 identier, shmid, is not the Guardian environment segid value or segment
identier.
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 749