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


vn_symlink — Create a symbolic link

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

Function

The vn_symlink operation creates a symbolic link to a pathname or an external name. A file that is named Link_name, of type "symbolic link", is created within the directory that is represented by Token_structure. The content of the symbolic link file is the path name or external name that is specified in Pathname.

Environment on entry and exit

See Environment for PFS operations.

Input parameter format

vn_symlink  (Token_structure,
             OSI_structure,
             Audit_structure,
             Pathname_length,
             Pathname,
             attribute_structure,
             Link_name_length,
             Link_name,
             Return_value,
             Return_code,
             Reason_code)

Parameters

Token_structure
Supplied parameter
Type:
TOKSTR
Length:
Specified by TOKSTR.ts_hdr.cblen.

The Token_structure represents the file (vnode) that is being operated on. It contains the PFS's initialization token, mount token, and the file token. Refer to LFS/PFS control block structure for a discussion of this structure, and to the TOKSTR typedef in BPXYPFSI in Interface structures for C language servers and clients for its mapping.

OSI_structure
Supplied and returned parameter
Type:
OSI
Length:
Specified by OSI.osi_hdr.cblen.

The OSI_structure contains information that is used by the OSI operations that may be called by the PFS. See OSI services for more information.

It also contains MVS-specific information that needs to be passed to the PFS, including SMF accounting fields, a work area, a recovery area, and an optional pointer to an output ATTR structure. For more details on the OSI structure, see The OSI structure.

This area is mapped by the OSI typedef in BPXYPFSI in Interface structures for C language servers and clients.

Audit_structure
Supplied parameter
Type:
CRED
Length:
Specified by CRED.cred_hdr.cblen.

The Audit_structure contains information that is used by the security product for access checks and auditing. It is passed to most SAF routines that are invoked by the PFS.

Refer to Security responsibilities and considerations for a discussion of security processing, and to the CRED typedef in BPXYPFSI in Interface structures for C language servers and clients for the mapping of this structure.

Pathname_length
Supplied parameter
Type:
Integer
Length:
Fullword

A fullword that contains the length of Pathname. The Pathname can be up to 1023 bytes long.

Pathname
Supplied parameter
Type:
Character string
Length:
Specified by the Pathname_length parameter

An area that contains the pathname or external name for which a symbolic link is to be created.

A pathname can begin with or without a slash:
  • If the pathname begins with a slash, it is an absolute pathname; the slash refers to the root directory, and the search for the file starts at the root directory.
  • If the pathname does not begin with a slash, it is a relative pathname, and the search for the file starts at the parent directory of the symbolic link file.

A pathname contains no nulls.

An external name is the name of an object outside of the hierarchical file system. It may contain nulls.

attribute_structure
Supplied parameter
Type:
ATTR
Length:
Specified by ATTR.at_hdr.cblen.

An area that contains the file attributes that are to be set for the symbolic link being created. This area is mapped by typedef ATTR in the BPXYVFSI header file (see Interface structures for C language servers and clients).

Link_name_length
Supplied parameter
Type:
Integer
Length:
Fullword

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

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

An area that contains the symbolic link that is being created. Link_name contains no nulls.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword
A fullword in which the vn_symlink service returns the results of the operation, as one of the following:
Return_value
Meaning
-1
The operation was not successful. The Return_code and Reason_Code values must be filled in by the PFS when Return_value is -1.
0
The operation was successful.
Return_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_symlink service stores the return code. The vn_symlink service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of supported return code values.

The vn_symlink service should support at least the following error values:
Return_code Explanation
EACCES The calling process does not have permission to write in the directory that was specified.
EEXIST Link_name already exists.
ENAMETOOLONG Link_name is longer than is supported by the PFS.
ENOENT The parent directory has been marked for deletion.
ENOSPC The file system is out of space.
ENOSYS The PFS does not support storing external links.
EROFS Token_structure specifies a directory on a read-only file system.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

A fullword in which the vn_symlink service stores the reason code. The vn_symlink service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. These reason codes are documented by the PFS.

Implementation notes

Overview of vn_symlink processing
Creating files provides an overview of symbolic link creation.
Specific processing notes
  • The Token_structure that is passed on input represents the directory in which the symbolic link is to be created.
  • The following attribute_structure fields are provided by the LFS:
    ATTR.at_hdr.cbid
    Contains Attr_ID (from the BPXYVFSI header file)
    ATTR.at_hdr.cbLen
    Specifies the length of attribute_structure
    ATTR.at_genvalue
    When ((at_genvalue & S_IFEXTL) == S_IFEXTL) is true, the pathname is an external link.
  • An external link is a symbolic link with an extra file attribute bit stored by the PFS. The distinction between a normal symbolic link and an external link is only apparent in the attribute structures that are returned by the PFS for the link file. There is no difference in the way vn_readlink is processed, for example.

    If the PFS cannot store this external link bit, it must fail the vn_symlink request with ENOSYS.

  • If the file that is named in the Name parameter already exists, the vn_symlink operation returns a failing return code.
  • Refer to the symlink() function in the POSIX .1a standard (IEEE Std 1003.1a), draft 7, for more information about the semantics of this operation for a POSIX-conforming PFS.
Serialization provided by the LFS
The vn_symlink operation is invoked with an exclusive latch held on the vnode of the directory.
Security calls to be made by the PFS
The PFS is expected to invoke SAF's Check Access callable service to check that the user has write permission to the directory.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014