The lstat callable service obtains status information about a file. The lstat service is identical to the stat service, except when the path name specified is a symbolic link (a pointer to another file or directory). In this case, the status information that is returned relates to the symbolic link, rather than to the file to which the symbolic link refers. The stat service is explained in stat (BPX1STA, BPX4STA) — Get status information about a file by pathname.
For the corresponding service using a file descriptor, see fstat (BPX1FST, BPX4FST) — Get status information about a file by descriptor.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1LST): | 31-bit |
AMODE (BPX4LST): | 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 BPX4LST with the same parameters.
The name of a fullword that contains the length of Pathname.
The name of an area of length Pathname_length that contains the path name of the file for which you want to obtain status. The Pathname can be a pathname to a file, a linkname to a file (as returned by link (BPX1LNK, BPX4LNK) — Create a link to a file), or a symbolic link name (as returned by symlink (BPX1SYM, BPX4SYM) — Create a symbolic link to a path name).
The name of a fullword that contains the length of the area to which the service returns Status_area. To determine the value of Status_area_length, use macro BPXYSTAT; see BPXYSTAT — Map the response structure for stat.
The name of an area of length Status_area_length to which the service returns the status information for the file. Status_area is mapped by the BPXYSTAT macro; see BPXYSTAT — Map the response structure for stat.
The name of a fullword in which the lstat service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The process does not have permission to search some component of the Pathname prefix. |
EINVAL | Parameter error—for example, a zero-length buffer. The following reason code can accompany the return code: JRBuffTooSmall. |
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. |
ENAMETOOLONG | Pathname is longer than 1023 characters; or some component of the path name is longer than 255 characters. This could happen if a symbolic link was encountered during the resolution of Pathname, and the substituted string was longer than 1023 characters. |
ENOENT | No file named Pathname was found, or Pathname was not specified. The following reason code can accompany the return code: JRFileNotThere. |
ENOTDIR | A component of the Pathname prefix is not a directory. |
The name of a fullword in which the lstat service stores the reason code. The lstat 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.
To obtain information about a file, you need not have permissions for the file itself; however, you must have search permission for all of the directory components of Pathname.
For an example on the use of this system call, see BPX1LST (lstat) example.