ZCOM C I/F Library Routines

GETDEVICE (3X)

PARAMETERS

 

dfile

Pointer to the full path name of a binary zdgen

 

 

device file. That is, the output file from the

 

 

zdgen program. If a NULL is passed, it

 

 

defaults to the file specified by the symbol

 

 

ZCOM_DEVICE_FILE), which is currently

 

 

defined as /opt/acc7cfg/zcomdevice in the

 

 

include file /opt/acc/include/zcom/zcomsys.h

 

dpp (Return

Pointer to a data structure containing the full

 

param)

device table. The device table is an array of

 

 

zdev_type elements.

RETURN VALUE

Routine getdevice, when successful, returns a non-negativevalue,

 

indicating the number of device types. That is, it returns the number of

 

zdev_type entries in the device table. Otherwise, it returns a negative

 

value, and the user should check errno to determine why getdevice failed.

NOTES

1. On every call to getdevice, malloc(3C) is called to allocate dynamic

 

memory for the returned device table. In case of error, this function

 

will release the allocated memory internally to avoid memory leak.

 

On successful return, the caller is responsible for freeing the

 

allocated memory when it is no longer needed.

2.In a multi-threaded application, if thread cancellation occurs while calling this function, the allocated memory will be released before the thread terminates. Once this function returns, the calling thread is responsible for freeing the allocated memory during thread cancellation.

3.The following is the zdev_type data structure definition (from /opt/acc/include/zcom/zcomsys.h).

/*-- ZCOM Device Entries --*/

typedef struct {

char dvname[16];

/* Device name */

uint16 dptype;

/* Physical type (i.e., protocol number)

*/

 

uint16 dltype;

/* Logical type (i.e., screen type) */

uint16 dalen

/* Poll/Select address length (0,1,2) */

uint16 damin;

/* Lower bound of address */

uint16 damax;

/* Upper bound of address */

uint16 doptn;

/* Protocol options */

uint16 dlflag;

/* Logical terminal flags */

144

Chapter 4