NXDirCreate

Creates a new directory.

Library:LibC
Classification:NKS
Service:File and Directory I/O

Syntax

  #include <nks/dirio.h> 
   
  int NXDirCreate (
     NXPathCtx_t   pathCtx,
     const void   *pathname,
     void         *reserved,
     NXPathCtx_t  *newPathCtx);
  

Parameters

pathCtx

(IN) Specifies a file system path context. Along with the pathname parameter, it specifies the directory to create.

pathname

(IN) Points to a null-terminated Unicode or ASCII string, which specifies the name of the directory to create. Each of the pathname components must already exist or NXDirCreate fails.

reserved

(IN) Is currently reserved. Pass zero.

newPathCtx

(OUT) Points to a handle to the newly created directory. To free the handle, call NXFreePathContext.

Return Values

If successful, returns 0, and in the newPathCtx parameter, an open file descriptor. Otherwise, returns one of the following error codes and -1 in the newPathCtx parameter:

Decimal

Hex

Constant

Description

1

0x01

NX_ENOENT

A component of the path prefix (as specific by the pathname parameter) does not exist or the pathname parameter is NULL.

4

0x04

NX_EBADF

Invalid path context.

6

0x06

NX_EACCES

Insufficient rights to the object.

7

0x07

NX_EEXIST

The directory specified by the pathname parameter exists.

9

0x09

NX_EINVAL

The pathCtx parameter was specified, but the pathname parameter indicates a full path.

12

0x0C

NX_ENOSPC

File system in which a new directory is to be created does not have enough media space.

24

0x18

NX_EAGAIN

Resource exhaustion prevented successful completion.

65

0x41

NX_ENAMETOOLONG

The contents of the pathname parameter are longer than the system-permitted name length.

67

0x43

NX_ENOTDIR

A component of pathname prefix identifies a non-directory object.

72

0x48

NX_EMLINK

The creation of the specified directory violates system limits on the parent directory link count.

Remarks

If a path context exists for a directory, it does not guarantee the stability of that directory.

See Also

NXDirRemove