NXDeviceOpen

Opens the specified device or application console.

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

Syntax

  #include <nks/fsio.h> 
   
  int NXDeviceOpen (
     NXPathCtx_t     pathCtx,
     const void     *name,
     NXMode_t        mode,
     NXShareMode_t   shareMode,
     unsigned long   flags,
     size_t         *ioBlockSize,
     NXHandle_t     *deviceHandle);
  

Parameters

pathCtx

(IN) Specifies a file system path context. Along with the pathname parameter, it specifies the device to open. This parameter is not used for a console.

name

(IN) Points to a null-terminated Unicode or ASCII string that specifies the name of the device or console to open. For a console, this becomes the name displayed at the top of the screen.

mode

(IN) Specifies whether the device or console is to be opened for reading, writing, or both. See NKS Open Modes.

shareMode

(IN) Specifies the share mode flags. See Shared Modes. This parameter is not used for a console.

flags

(IN) Pass 0.

ioBlockSize

(OUT) Points to the block size for I/O operations. This parameter is not used for a console.

deviceHandle

(OUT) Points to the file descriptor on which the device can be read or written.

Return Values

If successful, returns 0, and in the deviceHandle parameter, a handle to the device. Otherwise, returns a nonzero error code and -1 in the deviceHandle parameter:

Decimal

Hex

Constant

Description

65

0x41

NX_ENAMETOOLONG

The name is longer than the system-permitted length

Remarks

NXDeviceOpen creates a handle and associates it with a device or console. If zero is returned in the ioBlockSize parameter, any size can be used. Otherwise, I/O operations must use multiples of the returned block size.

Currently on NetWare, this function can be used to open a console or a FIFO. Each of these devices have a macro, based on NXDeviceOpen and designed especially for that type of device: NXConsoleOpen and NXFifoOpen.

NOTE:If your NLM has already created an application screen, the pathname parameter is ignored and the deviceHandle parameter returns a handle to the already created screen.

See Also