The fchattr service modifies the attributes that are associated with a file. It can be used to change the mode, owner, access time, modification time, change time, reference time, audit flags, general attribute flags, file size, and file tag. It can also be used to set the initial security label for a file or directory. You identify the file by its file descriptor.
For the corresponding service using a pathname, see chattr (BPX1CHR, BPX4CHR) — Change the attributes 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 (BPX1FCR): | 31-bit |
AMODE (BPX4FCR): | 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 BPX4FCR with the same parameters.
The name of a fullword containing the file descriptor of the file whose attributes you want to change.
The name of a fullword containing the length of the area containing the attributes you want to change.
The name of the area containing the attributes you want to change. The area is mapped by BPXYATT. For information on the content of this area, see BPXYATT — Map file attributes for chattr and fchattr.
The name of a fullword where the fchattr service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The calling process did not have appropriate permissions. Possible
reasons include:
|
EBADF | The File_descriptor parameter is not a valid file descriptor. |
EFBIG | Attempting to change the size of a file, the specified length is greater than the maximum file size limit for the process. The following reason code can accompany the return code: JRWriteBeyondLimit. |
EINVAL | The length of the Attributes parameter is too small, or the Attributes structure containing the requested changes is not valid. The following reason codes can accompany the return code: JrInvalidAtt, JrNegativeValueInvalid, JrTrNotRegFile, JrTrNegOffset, JrFileNotEmpty, and JrInvalidFileTag. |
EMVSERR | An MVS™ environmental error has been detected. The following reason code can accompany the return code: JrSeclabelClassInactive. |
ENOSYS | The function is not supported for the specified file. The following reason code can accompany the return code: JrNotSupportedForFileType. |
EPERM | The operation is not permitted for one of the following reasons:
|
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 fchattr service stores the reason code. The fchattr 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.
Set flags | Attribute fields input | Description |
---|---|---|
ATTMODECHG | ATTMODE | Set the mode according to the value in ATTMODE. See fchmod (BPX1FCM, BPX4FCM) — Change the mode of a file or directory by descriptor. |
ATTOWNERCHG | ATTUID ATTGID |
Set the owner user identifier (UID) and group identifier (GID) to the values specified in ATTUID and ATTGID. See chown (BPX1CHO, BPX4CHO) — Change the owner or group of a file or directory. |
ATTSETGEN | ATTGENVALUE ATTGENMASK |
Only the bits corresponding to the bits set ON in the ATTGENMASK are set to the value (ON or OFF) in ATTGENVALUE. Other bits will be unchanged. |
ATTTRUNC | ATTSIZE | Change the file size to ATTSIZE bytes. See ftruncate (BPX1FTR, BPX4FTR) — Change the size of a file. |
ATTATIMECHG | ATTATIME | If ATTLP64TIMES is not set, set the access time of the file to the value specified in ATTATIME. If ATTLP64TIMES is set, set the access time of the file to the value specified in ATTATIME64, which is a doubleword field. |
ATTATIMETOD | None | Set the access time of the file to the current time. |
ATTMTIMECHG | ATTMTIME | If ATTLP64TIMES is not set, set the modification time of the file to the value specified in ATTMTIME. If ATTLP64TIMES is set, set the modification time of the file to the value specified in ATTMTIME64, which is a doubleword field. |
ATTMTIMETOD | None | Set the Modification time of the file to the current time. |
ATTMAAUDIT | ATTAUDITORAUDIT | Set the security auditor's auditing flags to the value specified in ATTAUDITORAUDIT. See fchaudit (BPX1FCA, BPX4FCA) — Change audit flags for a file by descriptor. |
ATTMUAUDIT | ATTUSERAUDIT | Set the User's auditing flags to the value specified in ATTUSERAUDIT. See fchaudit (BPX1FCA, BPX4FCA) — Change audit flags for a file by descriptor. |
ATTCTIMECHG | ATTCTIME | If ATTLP64TIMES is not set, set the change time of the file to the value specified in ATTCTIME. If ATTLP64TIMES is set, set the change time of the file to the value specified in ATTCTIME64, which is a doubleword field. |
ATTCTIMETOD | None | Set the Change Time of the file to the current time. |
ATTREFTIMECHG | ATTREFTIME | If ATTLP64TIMES is not set, set the reference time of the file to the value specified in ATTREFTIME. If ATTLP64TIMES is set, set the reference time of the file to the value specified in ATTREFTIME64, which is a doubleword field. |
ATTREFTIMETOD | None | Set the Reference Time of the file to the current time. |
ATTFILEFMTCHG | ATTFILEFMT | Set the File Format of the file to the value specified in ATTFILEFMT. |
ATTCHARSETIDCHG | ATTFILETAG | Set the file tag. See BPXYSTAT (BPXYSTAT — Map the response structure for stat) for file tag mapping. |
ATTSECLABELCHG | ATTSECLABEL | Set the initial security label for a file or directory. |
The Set Flag field should be cleared before any bits are turned on. It is considered an error if any of the reserved bits in the flag field are turned on.
Full blocks are returned to the file system so that they can be used again.
The file offset is not changed.
Auditor authority is established by issuing the TSO/E command ALTUSER Auditor.
For an example using this callable service, see BPX1FCR (fchattr) example.