read_extlink (BPX1RDX, BPX4RDX) — Read an external symbolic link
Function
The read_extlink callable service reads the contents of an external symbolic link into a buffer that you provide. The external symbolic link contains the external name that was specified when the symbolic link was defined (see extlink_np (BPX1EXT, BPX4EXT) — Create an external symbolic link).
Requirements
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task |
Cross memory mode: | PASN = HASN |
AMODE (BPX1RDX): | 31-bit |
AMODE (BPX4RDX): | 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. |
Format
|
AMODE 64 callers use BPX4RDX with the same parameters. The Buffer_address parameter is a doubleword.
Parameters
- Link_name_length,
- Supplied parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword that contains the length of Link_name.
- Link_name
- Supplied parameter
- Type:
- Character string
- Character set:
- No restriction
- Length:
- Specified by the Link_name_length parameter
The name of a field that contains the link name of the external symbolic link that is to be read. The length of this field is specified in Link_name_length.
- Buffer_length
- Supplied parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword that contains the length, in bytes, of the buffer that is pointed to by Buffer_address.
- Buffer_address
- Supplied parameter
- Type:
- Address
- Length:
- Fullword (doubleword)
The name of a fullword (doubleword) that contains the address of the buffer that is supplied to the read_extlink service, into which the value of the external symbolic link is to be written. The value of the external symbolic link is actually the external name that was specified when the symbolic link was created. The buffer must reside in the process's address space.
- Return_value
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the read_extlink service returns a count of the number of characters placed in the buffer, if the request is successful; or -1, if it is not successful.
- Return_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the read_extlink service stores the return code. The read_extlink service returns Return_code only if Return_value is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The read_extlink service can return one of the following values in the Return_code parameter:Return_code Explanation EACCES Search permission is denied for a component of the path prefix. EINVAL The file that is named by Link_name is not a symbolic link; or there was a problem with the supplied buffer. The following reason codes can accompany the return code: JRFileNotSymLink, and JRRdlBuffLenInvalid. ELOOP A loop exists in symbolic links that were encountered during resolution of the Link_name argument. This error is issued if more than 24 symbolic links are detected in the resolution of Link_name. ENAMETOOLONG Link_name is longer than 1023 characters; or some component of the link name is longer than 255 characters. Name truncation is not supported. ENOENT No file with the name specified by Link_name was found. The following reason code can accompany the return code: JRFileNotThere. ENOTDIR A component of the path prefix is not a directory. - Reason_code
- Returned parameter
- Type:
- Integer
- Length:
- Fullword
The name of a fullword in which the read_extlink service stores the reason code. The read_extlink 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.
Usage notes
- If the buffer that is supplied to the read_extlink service is too small to contain the value of the external symbolic link, the value is truncated to the length of the buffer (Buffer_length). If the value that is returned is the length of the buffer, you can use the lstat service (see lstat (BPX1LST, BPX4LST) — Get status information about a file or symbolic link by path name) to determine the actual length of the external symbolic link.
- If the Buffer_length is 0, the value that is returned is the number of bytes in the external symbolic link. The buffer remains unchanged.
- It is recommended that this function, rather than the readlink function (see readlink (BPX1RDL, BPX4RDL) — Read the value of a symbolic link), be used for reading an external link with a symbolic link ending its pathname.
Related services
- extlink_np (BPX1EXT, BPX4EXT) — Create an external symbolic link
- lstat (BPX1LST, BPX4LST) — Get status information about a file or symbolic link by path name
- readlink (BPX1RDL, BPX4RDL) — Read the value of a symbolic link
- symlink (BPX1SYM, BPX4SYM) — Create a symbolic link to a path name
- unlink (BPX1UNL, BPX4UNL) — Remove a directory entry
Characteristics and restrictions
There are no restrictions on the use of the read_extlink service.
Examples
For an example using this callable service, see BPX1RDX (read extlink) example.