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


v_rmdir (BPX1VRE, BPX4VRE) — Remove a directory

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

Function

The v_rmdir service removes a directory. The directory must be empty.

Directory_name is specified as input, along with a Directory_vnode_token value that identifies the directory that contains the directory that is to be removed.

Requirements

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

AMODE 64 callers use BPX4VRE 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_rmdir service is to remove the directory that is supplied in the Directory_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).

Directory_name_length
Supplied parameter
Type:
Integer
Length:
Fullword

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

Directory_name
Supplied parameter
Type:
Character string
Length:
Specified by Directory_name_length parameter

The name of an area, of length Directory_name_length, that contains the name of the directory 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_rmdir 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_rmdir service stores the return code. The v_rmdir 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_rmdir 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 directory that is to be removed.
EBUSY The directory cannot be removed, because it is being used as a mount point. The following reason code can accompany the return code: JRIsFSRoot.
EAGAIN The directory cannot be removed, because it is temporarily unavailable. The following reason code can accompany the return code: JRInvalidVnode.
EINVAL Parameter error; for example, the Vnode_token parameter is obsolete. The following reason codes can accompany the return code: JRVTokenFreed, JRWrongPID, JRStaleVnodeTok, JRInvalidVnodeTok, JRInvalidOSS, JRDotOrDotDot, JRNoName, JRNullInPath.
ENAMETOOLONG Directory_name_length exceeds 255 characters.
ENOENT The directory that was specified by Directory_name was not found.
ENOTDIR The file that was specified by Directory_vnode_token is not a directory; or the name that was specified by Directory_name is not a directory. The following reason codes can accompany the return code: JRTokNotDir, JRNotDir.
ENOTEMPTY The directory contains files or subdirectories.
EPERM The operation is not permitted. The caller of the service is not registered as a server.
EROFS The directory 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_rmdir service stores the reason code. The v_rmdir 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 target directory cannot be removed.
  2. The directory that is specified by Directory_name must be empty.
  3. If the directory is successfully removed, the change and modification times for the parent directory are updated.
  4. If any process has the directory open when it is removed, the directory itself is not removed until the last process has closed the directory. New files cannot be created under a directory that is removed, even if the directory is still open.

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1VRE, BPX4VRE (v_rmdir).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014