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


v_mkdir (BPX1VMK, BPX4VMK) — Create a directory

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

Function

The v_mkdir service creates a new empty directory in the directory that is represented by Directory_vnode_token. The input Attr is used to define the attributes of the new directory. A token that represents the new directory is returned in the New_directory_vnode_token.

Requirements

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

AMODE 64 callers use BPX4VMK 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 in which the v_mkdir service creates the new directory that is named 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 the directory name that is to be created. The name can be up to 255 bytes long. It must not contain null characters (X'00').

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

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

Attr_length
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the length of the area that is passed in the Attr parameter. To determine the value of Attr_length, use the ATTR structure (see BPXYATTR — Map file attributes for v_ system calls).

Attr
Supplied and returned parameter
Type:
Structure
Length:
Specified by the Attr_length parameter

The name of an area, of length Attr_length, that is to be used by the v_mkdir service to set the attributes of the directory that is to be created. The attributes of the directory that is created are also returned in this area. This area is mapped by the ATTR structure (see BPXYATTR — Map file attributes for v_ system calls).

New_directory_vnode_token
Returned parameter
Type:
Token
Length:
8 bytes

The name of an 8-byte area in which the v_mkdir service returns a vnode token of the directory that is created.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

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

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the v_mkdir service stores the return code. The v_mkdir 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_mkdir service can return one of the following values in the Return_code parameter:
Return_code Explanation
EACCES The calling process does not have permission to update the directory that was specified.
EEXIST The directory named already exists.
EFBIG The file size limit for the process is set to zero, which means directories cannot be created.
EINVAL Parameter error; for example, a supplied area was too small. The following reason codes can accompany the return code: JRSmallAttr, JRInvalidAttr, JrNoName, JRVTokenFreed, JRWrongPID, JRStaleVnodeTok, JRInvalidVnodeTok, JRInvalidOSS.
EMFILE The maximum number of vnode tokens have been created.
ENAMETOOLONG The name is longer than 255 characters.
ENFILE An error occurred while storage was being obtained for a vnode token.
ENOTDIR The supplied token did not represent a directory.
EPERM The operation is not permitted. The caller of the service is not registered as a server.
EROFS Directory_vnode_token specifies a directory on a read-only file system.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the v_mkdir service stores the reason code. The v_mkdir service returns a 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. The following Attr fields are provided by the caller:
    AttrID
    Contains Attr#ID (from the ATTR structure).
    AttrLen
    Specifies the length of the Attr structure.
    AttrMode
    Specifies directory mode permission bits. See BPXYMODE in Mapping macros in z/OS UNIX System Services Programming: Assembler Callable Services Referencefor the mapping of this field.

    Other fields should be initialized to zero.

  2. If the directory that is named in the Name parameter already exists, the v_mkdir service returns a failing return code, and no New_directory_vnode_token is returned.
  3. Vnode tokens that are returned by the v_mkdir service are not inherited across a fork callable service.
  4. The caller is responsible for freeing vnode tokens that are returned by the v_mkdir service, by calling to the v_rel service when they are no longer needed.
  5. If the file size limit for the process is set to zero, directories cannot be created and directory creation fails with EFBIG.
  6. The value set by umask() for the process does not affect the setting of the mode permission bits.
  7. The setting of the AttrLP64times bit in the BPXYATT structure, and not the AMODE of the caller, determines whether 4-byte or 8-byte time fields are used.

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1VMK, BPX4VMK (v_mkdir).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014