The mprotect callable service changes the access protection of a memory mapping for the caller's address space.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, PSW Key 2 or PSW Key 8 |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1MPR): | 31-bit |
AMODE (BPX4MPR): | 64-bit |
ASC mode: | Primary address space control (ASC) 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 BPX4MPR with the same parameters. The Map_address and Map_length parameters are doublewords.
The name of a fullword (doubleword) that contains the starting address in the address space at which the access protection of the mapping is to be changed. The value of Map_address must be a multiple of the page size.
The name of the fullword (doubleword) that contains the size (in bytes) of the mapping that is to have its access protection modified. The length can be the size of the whole mapping, or a part of it. If the specified length is not in multiples of the page size, it is rounded up to a page boundary.
Constant | Description |
---|---|
PROT_READ | Mapped data can be read. |
PROT_WRITE | Mapped data can be written and read. |
PROT_EXEC | Mapped data can be executed. PROT_EXEC is treated in the same way as PROT_READ. |
PROT_NONE | Mapped data cannot be accessed. |
The name of a fullword in which the mprotect service returns the value of 0 if the request is successful, or -1 if it is not successful.
Upon successful completion, the mprotect service has changed the access protections on the mapping specified by the range (map_address, map_address + map_length) to those specified by the protect_options parameter.
The name of a fullword in which the mprotect service stores the return code. The mprotect service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values.
Return_code | Explanation |
---|---|
EACCES | The access protection value is incorrect; it violates the access
permission of the process to the underlying file. The following condition
occurred:
|
EAGAIN | The caller is not running in either PSW Key 2 or PSW Key 8. (JRUnsupportedKey) |
EINVAL | One of the following conditions occurred:
|
ENOMEM | One of the following conditions occurred:
|
The name of a fullword in which the mprotect service stores the reason code. The mprotect service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.
The range specified (map_address, map_address + map_length) must not contain any areas that are not currently memory mapped. It may, however, contain areas that have been unmapped, in which case no action will be taken against the unmapped areas.
For an example using this callable service, see BPX1MPR (mprotect) example.