The lchattr service modifies the attributes that are associated with a file. It is similar to the chattr service, and can be used to modify certain attributes associated with a symbolic or external link, as well as for regular files and directories.
If the pathname is a symbolic link, the requested change occurs on the attributes of the symbolic link, and only those attributes that can apply to a symbolic link are updated. These are limited to the owner, the time values, and the security label. All other requested attribute changes have no effect for the symbolic link. 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 (BPX1LCR): | 31-bit |
AMODE (BPX4LCR): | 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 BPX4LCR with the same parameters.
|
The name of a fullword that contains the length of the pathname of the file whose attributes you want to change.
The name of a field that contains the pathname of the file. The length of this field is specified in Pathname_length.
If Pathname specifies a symbolic link file, the lchattr service changes the attributes of the symbolic link file itself, provided that the attributes requested can apply to a symbolic link. Only the owner, times, and security label can be changed for a symbolic link. All other attributes do not apply and will be ignored.
The name of a fullword that contains the length of the area containing the attributes you want to change.
The name of the area that contains 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.
If Pathname specifies a symbolic link file, the lchattr service changes the attributes of the symbolic link file itself, provided that the attributes requested can apply to a symbolic link. Only the owner, times, and security label can be changed for a symbolic link. All other attributes do not apply and will be ignored.
The name of a fullword in which the lchattr 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:
|
EFBIG | The calling process was attempting to change the size of a file, but the specified length is greater than the maximum file size limit for the process. Consult Reason_code to determine the exact reason the error occurred. 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. Consult Reason_code to determine the exact reason the error occurred. The following reason codes can accompany the return code: JrInvalidAtt, JrNegativeValueInvalid, JrTrNotRegFile, JrTrNegOffset, JrFileNotEmpty, and JrInvalidFileTag. |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Pathname argument. This error is issued if more than 24 symbolic links are detected in the resolution of Pathname. |
EMVSERR | An MVS™ environmental error has been detected. The following reason code can accompany the return code: JrSeclabelClassInactive. |
ENAMETOOLONG | Pathname is longer than 1023 characters, or a component of the pathname is longer than 255 characters. Filename truncation is not supported. |
ENOENT | No file named Pathname was found, or no pathname was specified. The following reason code can accompany the return code: JRFileNotThere. |
ENOSYS | The function is not supported for the specified file. The following reason code can accompany the return code: JrNotSupportedForFileType. |
ENOTDIR | Some component of Pathname is not a directory. |
EPERM | The operation is not permitted for one of the following reasons:
|
EROFS | Pathname specifies a file that is on a read-only file system. Consult Reason_code to determine the exact reason the error occurred. The following reason code can accompany the return code: JRReadOnlyFS. |
The name of a fullword in which the lchattr service stores the reason code. The lchattr 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 chmod (BPX1CHM, BPX4CHM) — Change the mode of a file or directory. |
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 are 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 chaudit (BPX1CHA, BPX4CHA) — Change audit flags for a file by path. |
ATTMUAUDIT | ATTUSERAUDIT | Set the user's auditing flags to the value specified in ATTUSERAUDIT. See chaudit (BPX1CHA, BPX4CHA) — Change audit flags for a file by path. |
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.
You establish auditor authority by issuing the TSO/E command ALTUSER Auditor.
For an example using this callable service, see BPX1LCR (lchattr) example.