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


v_remove (BPX1VRM, BPX4VRM) — Remove a link to a file

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

Function

The v_remove service removes a link to a file.

The name of the link is specified as input, along with a Directory_vnode_token value that identifies the directory that contains the name that is to be removed. The name can identify a file, a link name to a file, or a symbolic link.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1VRM): 31-bit
AMODE (BPX4VRM): 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 BPX1VRM,(Directory_vnode_token,
              OSS,
              Name_length,
              Name,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4VRM with the same parameters.

Parameters

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_remove service is to remove the entry that is supplied in the Name parameter.

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.

Name_length
Supplied parameter
Type:
Integer
Length:
Fullword

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

Name
Supplied parameter
Type:
Character string
Length:
Specified by Name_length parameter

The name of an area, of length Name_length, that contains the name that is to be removed. It must not contain null characters (X'00').

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_remove 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_remove service stores the return code. The v_remove 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_remove service can return one of the following values in the Return_code parameter:
Return_code Explanation
EACCES The process did not have write permission for the directory that contains the name that is to be removed.
EAGAIN The name cannot be removed, because it is temporarily unavailable. The following reason code can accompany the return code: JRInvalidVnode.
EBUSY The file is open by a remote NFS client with a share reservation that conflicts with the requested operation.
EINVAL Parameter error; for example, the vnode token parameter is stale. The following reason codes can accompany the return code: JRVTokenFreed, JRWrongPID, JRStaleVnodeTok, JRInvalidVnodeTok, JRInvalidOSS, JRNoName, JRNullInPath.
ENAMETOOLONG Name_length exceeds 255 characters.
ENOENT Name was not found.
ENOTDIR The file that was specified by Directory_vnode_token is not 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 Name specifies a directory. The following reason codes can accompany the return code: JRNotRegisteredServer, JRNotForDir.
EROFS The name that is to be removed is on a read-only file system. The following reason code can accompany the return code: JRReadOnlyFS.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_remove service stores the reason code. The v_remove 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. If the sticky bit is on in the parent directory, the file cannot be deleted.
  2. If the name that is specified refers to a symbolic link, the symbolic link file that is named by Name is deleted.
  3. If the v_remove service request is successful and the link count becomes zero, the file is deleted. The contents of the file are discarded, and the space it occupied is freed for reuse. However, if another process (or more than one) has the file open, or has a valid vnode token, when the last link is removed, the file contents are not discarded until the last process closes the file or releases the vnode token.
  4. When the v_remove service is successful in removing a directory entry and decrementing the link count, whether or not the link count becomes zero, it returns control to the caller with Return_value set to 0. It updates the change and modification times for the parent directory, and the change time for the file itself (unless the file is deleted).
  5. Directories cannot be removed using v_remove. To remove a directory, refer to v_rmdir (BPX1VRE, BPX4VRE) — Remove a directory.
  6. A file may not be removed if it is currently open by a remote NFS client with a share reservation that would prevent the file from being opened for write access.

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1VRM, BPX4VRM (v_remove).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014