ACC Programmer's Reference Guide

138 Chapter4
ZCOM C I/F Library Routines
GETDEVICE (3X)
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 */
char dpname[8]; /* Protocol module name */
} zdev_type;
EXAMPLE #include <zcom/zcomsys.h>
#include <zcom/zcomcall.h>
int32 ierr;
char *dfile;
zdev_type *dp;
ierr = getdevice (dfile, &dp);
if (ierr < 0) {
/* (error; user to check errno) */
}
else {
/* (success; ierr indicates number of device types) */
}