ACC Programmer's Reference Guide

Chapter 4 137
ZCOM C I/F Library Routines
GETDEVICE (3X)
Threads
Considerations
This routine may be called from a multi-threaded application using the
POSIX (1003.1c) kernel threads API package. This routine has the
following characteristics when called by a multi-threaded application:
See the NOTES section below for more information on using this routine
in a multi-threaded application.
PARAMETERS
RETURN VALUE Routine getdevice, when successful, returns a non-negative value,
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 successfulreturn,the caller is responsible for freeing the allocated
memory when it is no longer needed.
cancellation point Thread cancellation can occur when a thread calls this
routine.
async-cancel unsafe The calling thread’s cancelability type must be
PTHREAD_CANCEL_DEFERRED if cancellation is
enabled.
async-signal unsafe It cannot be called from a signal handler.
fork unsafe It cannot be called by a child process after fork(2) but
before exec(2).
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 param) Pointer to a data structure containing the full device
table. The device table is an array of zdev_type
elements.