z/OS UNIX System Services File System Interface Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


v_link (BPX1VLN, BPX4VLN) — Create a link to a file

z/OS UNIX System Services File System Interface Reference
SA23-2285-00

Function

The v_link service creates a link (Link_name) to the file that is specified by File_vnode_token in the directory that is specified by Directory_vnode_token. The link is a new name that identifies an existing file. The new name does not replace the old one, but provides an additional way to refer to the file. To rename an existing file, see v_rename (BPX1VRN, BPX4VRN) — Rename a file or directory.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1VLN): 31-bit
AMODE (BPX4VLN): 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

CALL BPX1VLN,(File_vnode_token,
              OSS,
              Link_name_length,
              Link_name,
              Directory_vnode_token,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4VLN with the same parameters.

Parameters

File_vnode_token
Supplied parameter
Type:
Token
Length:
8 bytes

The name of an 8-byte area that contains a vnode token that represents the file to which a link is to be established.

OSS
Supplied and returned parameter
Type:
Structure
Length:
OSS#LENGTH (from the BPXYOSS macro)

The name of an area that contains operating-system-specific parameters. This area is mapped by the BPXYOSS macro (see BPXYOSS — Map operating system specific information).

Link_name_length
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the length of Link_name. The name can be up to 255 bytes long.

Link_name
Supplied parameter
Type:
Character string
Length:
Specified by Link_name_length parameter

The name of an area, of length Link_name_length, that contains the name by which the file is to be known. It must not contain null characters (X'00').

Directory_vnode_token
Supplied parameter
Type:
Token
Length:
8 bytes

The name of an 8-byte area that contains a vnode token that represents the directory from which the v_link service is to create the link that is supplied in the Link_name parameter.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_link service returns 0 if the request completes successfully, or -1 if the request is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the v_link service stores the return code. The v_link service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The v_link service can return one of the following values in the Return_code parameter:
Return_code Explanation
EACCES The process did not have appropriate permissions to create the link. Possible reasons include:
  • The process had no write permission for the directory that is intended to contain the link.
  • The process had no permission to access the file that is specified by File_vnode_token.
EEXIST A file, directory, or symbolic link named Link_name already exists.
EINVAL Parameter error; for example, one of the vnode tokens is stale. The following reason codes can accompany the return code: JRVTokenFreed, JRWrongPID, JRStaleVnodeTok, JRInvalidVnodeTok, JRInvalidOSS, JRNoName, JRNullInPath.
EMLINK The file that is specified by File_vnode_token already has its maximum number of links. The maximum number is LINK_MAX. The value of LINK_MAX can be determined through pathconf (BPX1PCF) or fpathconf (BPX1FPC).
ENAMETOOLONG Link_name_length exceeds 255 characters.
ENOSPC The directory that is intended to contain the link cannot be extended to contain another entry.
ENOTDIR Directory_vnode_token does not specify a directory. The following reason code can accompany the return code: JRTokNotDir.
EPERM The operation is not permitted. The caller of the service is not registered as a server; or the File_vnode_token specifies a directory. The following reason codes can accompany the return code: JRNotRegisteredServer, JRTokDir.
EROFS Creating the link would require writing on a read-only file system. The following reason code can accompany the return code: JRLnkROFileSet.
EXDEV The file that is specified by File_vnode_token and Directory_vnode_token are on different file systems. The following reason code can accompany the return code: JRLnkAcrossFileSets.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_link service stores the reason code. The v_link service returns 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.

Usage notes

  1. BPX1VLN creates a link named Link_name to an existing file that is specified by File_vnode_name. This provides an alternate pathname for the existing file; the file may be accessed by the old name or the new name. The link may be stored under the same directory as the original file, or under a different directory on the same file system.
  2. If the link is created successfully, the service routine increments the link count of the file. The link count shows how many links to a file exist. (If the link is not created successfully, the link count is not incremented.)
  3. Links are not allowed to directories.
  4. If the link is created successfully, the change time of the linked-to file is updated, as are the change and modification times of the directory that contains Link_name (that is, the directory that holds the link).

Characteristics and restrictions

A process must be registered as a server before the v_link service is permitted, See v_reg (BPX1VRG, BPX4VRG) — Register a process as a server.

Examples

For an example using this callable service, see BPX1VLN, BPX4VLN (v_link).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014