The shmctl service provides a variety of shared memory control operations as specified by the Command parameter. These functions include reading and changing shared memory variables with the shmid_ds data structure, and removing a shared memory segment from the system.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state; PSW key 2, 8, or 9 |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1MCT): | 31-bit |
AMODE (BPX4MCT): | 64-bit |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4MCT with the same parameters. The Buffer_address parameter is a doubleword.
Specifies the shared memory identifier.
For shared memory segments that were not created with the Ipc_MEGA option, the permissions that are in effect (IPC_MODE) when a process attaches a segment remain, even though these permissions may change. For shared memory segments that were created with the Ipc_MEGA option, the permissions that are set by this request take effect immediately. All processes that are currently attached to the shared memory segment are able to read only or read and write to it based on the permissions that are specified in the IPC_MODE.
The effect of the new mode on access is determined by the three parts of the mode field: the owner permissions, the group permissions, and other permissions. If all three read and all three write permissions in the new mode are off, the access for all attached processes is changed to read. If any of the three read permission bits is on without the corresponding write permission bit on, the access for all attached processes is changed to read. Otherwise, the access for all attached processes is changed to write.
The name of a fullword (doubleword) field that contains the address of the buffer that is mapped by SHMID_DS. The shmctl service assumes that the size of this buffer is at least as large as SHMID_DS.
The name of a fullword in which the shmctl service stores the return value, or a -1 if the operation is unsuccessful.
Return_code | Explanation |
---|---|
EACCES | The command specified was Ipc_STAT, and the calling process does not have read permission. The following reason code can accompany the return code: JRIpcDenied. |
EFAULT | The Buffer_Address parameter specified an address that caused the callable service to program check. The following reason code can accompany the return code: JRBadAddress. |
EINVAL | This error code may be returned for the following reasons:
|
EPERM | Command=IPC_RMID or IPC_SET, and the effective user ID of the caller is not that of a process with appropriate privileges (see Authorization), and is not the value of IPC_CUID or IPC_UID in the SHMID_DS data structure that is associated with Shared_Memory_ID. The following reason code can accompany the return code: JRIpcDenied. |
The name of a fullword in which the shmctl service stores the reason code. The shmctl service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
The caller of the shmctl service is restricted by ownership and read and read-write permissions that are defined by shmget and shmctl Ipc_SET.
For an example using this callable service, see BPX1MCT (shmctl) example.