NXGetAttr

Returns the attributes of the object by specifying the path.

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

Syntax

  #include <nks/dirio.h> 
  
  int NXGetAttr (
     NXPathCtx_t     pathCtx, 
     const void     *pathname, 
     NXDeLevel_t     level,
     void           *buffer, 
     size_t          length, 
     unsigned long   flags); 
  

Parameters

pathCtx

(IN) Specifies the file system path context. Along with the pathname parameter, it specifies the object.

pathname

(IN) Points to the name of the object (wildcards are not allowed).

level

(IN) Specifies the level of information required (see NXDeLevel_t Enumeration).

buffer

(IN) Points to a caller allocated buffer. See Section 19.4, NKS Directory Attribute Structures for the possible structures to be returned in this buffer.

length

(IN) Specifies the size of the buffer pointed to by buffer.

flags

(IN) Pass 0.

Return Values

If successful, returns 0. Otherwise, returns one of the following error codes:

Decimal

Hex

Constant

Description

1

0x01

NX_ENOENT

The pathCtx and pathname parameters do not identify an existing object.

4

0x04

NX_EBADF

Invalid path context.

6

0x06

NX_EACCES

Insufficient rights to the object.

9

0x09

NX_EINVAL

A pathCtx was specified, but pathname indicates a full path.

24

0x18

NX_EAGAIN

Resource exhaustion prevented successful completion of the call.

65

0x41

NX_ENAMETOOLONG

The pathCtx and pathname combination are longer than system permitted name lengths.

81

0x51

NX_EOVERFLOW

The buffer is too small.

105

0x69

NX_ENOCONTEXT

The calling thread has no NKS context.

Remarks

This function looks up the attributes of a file, directory or other object that is identified by the pathCtx and pathname combination.

The attributes are return in the buffer pointed to by buffer.

  • If level is set to NX_DELEVEL_ BASIC, the buffer can point to an NXDirAttr_t structure.

  • If level is set to NX_DELEVEL_NAME_ONLY, the buffer is filled with an NXDirAttrWithName_t structure. The buffer must be large enough to hold both the NXDirAttrWithName_t structure and object's name. To ensure this, you probably should turn NXDirAttrWithName_t into a link.

  • If level is set to NX_DELEVEL_EXTENDED, the buffer can point to one of the following structures:

    The pathname format in the pathCtx argument specifies which structure is appropriate. If no pathname format is explicitly injected, NXDirAttrNKS_t is assumed.

The very generic NXDirAttrNks_t structure may be used no matter what the underlying file system at the extended level (although the pathname format in pathCtx must be set to NX_PNF_NKS). To permit applications to use filenames independent of the pathname format of the file system on which they are going to run, a generic NKS pathname format is defined. The NKS pathname format will be mapped to the underlying pathname format. Only fairly generic operations may be performed using the NKS pathname format and no file system-specific operations are possible.

See Also