The fchmod service modifies the permission bits used to control the owner access, group access, and general access to a file. It can be used to set flags that modify the user ID (UID) and group ID (GID) of the file when it is executed. It can also be used to set the sticky bit to indicate where the file should be fetched from. You identify the file by its file descriptor.
For the corresponding service using a pathname, see chmod (BPX1CHM, BPX4CHM) — Change the mode of a file or directory.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1FCM): | 31-bit |
AMODE (BPX4FCM): | 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 BPX4FCM with the same parameters.
Specifies the name of a fullword containing the file descriptor of the file whose mode you want to change.
Specifies the name of a fullword in which the mode field is specified. The mode field, mapped by BPXYMODE, specifies the file type and the permissions you grant to yourself, to your group, and to any user. See BPXYMODE — Map the mode constants of the file services for the parameter options.
Specifies the name of a fullword to which the fchmod service returns 0 if successful, or -1 if not successful.
Return_code | Explanation |
---|---|
EBADF | The File_descriptor parameter is not a valid file descriptor. |
EPERM | The effective UID of the calling process does not match the owner of the file, and the calling process does not have appropriate privileges (see Authorization). |
EROFS | The specified file is on a read-only file system. The following reason code can accompany the return code: JRReadOnlyFS. |
The name of a fullword where the fchmod service stores the reason code. The fchmod service returns a 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.
There are no restrictions on the use of the fchmod service.
For an example using this callable service, see BPX1FCM (fchmod) example.