NXGetAttrWithHandle

Returns the attributes of the object by specifying an open file handle.

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

Syntax

  #include <nks/dirio.h> 
  
  int NXGetAttrWithHandle (
     NXHandle_t       handle, 
     NXPathFormat_t   format, 
     NXDeLevel_t      level,
     void            *buffer, 
     size_t           length, 
     unsigned long    flags); 
  

Parameters

handle

(IN) Specifies the handle on which an object is currently open.

format

(IN) Specifies the pathname format in which to return the information. See NXPathFormat_t Enumeration.

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

Either dirName or entryName does not identify an existing object

4

0x04

NX_EBADF

Invalid directory handle

6

0x06

NX_EACCES

Insufficient rights to the object.

9

0x09

NX_EINVAL

fileHandle does not indicate a valid, open file

24

0x18

NX_EAGAIN

Resource exhaustion prevented successful completion of the call

65

0x41

NX_ENAMETOOLONG

The dirName or entryName 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

NXGetAttrWithHandle looks up the attributes of the object opened on the file handle.

If the pathname format is specified as NX_PNF_DEFAULT, the format in effect at open time will be used. What this format is (what sort of structure is returned) is specified in buffer (see below) in the pathFormat field of NXDeHeader_t (either deHeader or xdeHeader of the structure that is the format of buffer).

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

  • If level is set to NX_DELEVEL_ BASIC, the buffer is filled with 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 is filled with any of the following structures, depending on the pathname format of the handle:

For more information, see NXGetAttr.

See Also