The link callable service creates a link to a file. The link is a new name that identifies an existing file. The new name does not replace the old one; it provides an additional way to refer to the file. To rename an existing file, see rename (BPX1REN, BPX4REN) — Rename 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 (BPX1LNK): | 31-bit |
AMODE (BPX4LNK): | 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 BPX4LNK with the same parameters.
The name of a fullword that contains the length of the Filename of the existing file.
The name of a field of length Filename_length that contains the name of the existing file to which a link is to be established.
The name of a fullword that contains the length of the Link_name.
The name of a field that contains the link name by which the file is to be known.
The name of a fullword in which the link service returns 0 if the request is successful, or -1 if it is not successful.
Return_code | Explanation |
---|---|
EACCES | The process did not have appropriate permissions to create
the link. Possible reasons include:
|
EEXIST | A file, directory, or symbolic link named Link_name already exists. The following reason code can accompany the return code: JRLnkNewPathExists. |
EINVAL | The Filename or Link_name is incorrect because it contains a null. |
ELOOP | A loop exists in symbolic links that were encountered during resolution of the Filename or Link_name argument. This error is issued if more than 24 symbolic links are detected in the resolution of Filename or Link_name. |
EMLINK | Filename already has its maximum number of links. The maximum number is LINK_MAX. The value of LINK_MAX can be determined through pathconf (BPX1PCF, BPX4PCF) — Determine configurable path name variables using a path name, or fpathconf (BPX1FPC, BPX4FPC) — Determine configurable path name variables using a descriptor. |
ENAMETOOLONG | Filename or Link_name is longer than 1023 characters; or some component of the pathname is longer than 255 characters. Name truncation is not supported. |
ENOENT | A component of the pathname that was specified by Filename or Link_name was not found; the file specified by Filename was not found; or one of the two arguments is missing. The following reason code can accompany the return code: JRLnkNoEnt. |
ENOSPC | The directory intended to contain the link cannot be extended to contain another entry. |
ENOTDIR | A pathname component of one of the arguments is not a directory. |
EPERM | Filename is the name of a directory; links to directories are not allowed. The following reason code can accompany the return code: JRLnkDir. |
EROFS | Creating the link would require writing on a read_only file system. The following reason code can accompany the return code: JRLnkROFileset. |
EXDEV | Filename and Link_name are on different file systems. z/OS UNIX does not support links between file systems. The following reason code can accompany the return code: JRLnkAcrossFilesets. |
The name of a fullword in which the link service stores the reason code. The link 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.
There are no restrictions on the use of the link service.
For an example using this callable service, see BPX1LNK (link) example.