gtpc2mjgC/C++ Language Support User's Guide

TPF_FSDD_POLL-Select or Poll an Open File Descriptor

This type of function is specified as part of the file system device driver interface. This function is called by the select function to determine if the open file descriptor is ready for reading, writing, or if any exception conditions are pending. The device driver is determined by the major and minor device type from the open file descriptor at open time. A file descriptor can be of any device type that is supported by the TPF system.

Format

typedef int TPF_FSDD_POLL(struct fd_entry *fd_ptr,
                          TPF_FSDD_FILEDATA *fita_ptr);

fd_ptr
A pointer to a file descriptor contained in the fd_entry structure defined in the i$pwbl.h header file. The information contained in the structure is used to reference system program interface fields contained in the c$spif.h header file.

fita_ptr
The address of an object of type TPF_FSDD_FILEDATA, defined in c$spif.h as:
typedef struct TPF_FSDD_FILEDATA {
    long filedata_length;
    void * filedata_state_ptr;
} TPF_FSDD_FILEDATA;

The information needed by the device drivers is carried in this object.

Normal Return

One of the following values:

0
The file descriptor is not ready for reading or writing, and there are no exception conditions pending.

1
The file descriptor is ready for reading or writing, or there are exception conditions pending.

Error Return

A value of -1. The request to check the state of the open file descriptor could not be processed because of a possible permanent internal error. The device driver should set errno to an appropriate error code. Calling programs should examine this return environment variable for additional information.

Programming Considerations

The TPF_FSDD_POLL-type device driver function can be called any number of times for the same open file descriptor. The file descriptor entry must be open and accessible to be able to use this device driver function.

Examples

The following example is the poll device driver interface function for the null file (/dev/null).

#include <c$spif.h> /* Device driver interface */
 
/**********************************************************************/
/* The null_poll() function is a NOP.                                 */
/**********************************************************************/
int null_poll(struct fd_entry *fd_ptr, TPF_FSDD_FILEDATA *filedata)
{
    return 0;
}

Related Information