Checks the I/O status of multiple file pointers, file descriptors, and message queues.
#include <sys/types.h> #include <sys/errno.h> #include <sys/poll.h>
int fp_poll (listptr, nfdsmsgs, timeout, flags) void *listptr; unsigned long nfdsmsgs; long timeout; uint flags;
Note: The fp_poll service applies only to character devices, pipes, message queues, and sockets. Not all character device drivers support the fp_poll service.
The fp_poll kernel service checks the specified file pointers/descriptors and message queues to see if they are ready for reading or writing, or if they have an exceptional condition pending.
The pollfd, pollmsg, and pollist structures are defined in the /usr/include/sys/poll.h file. These are the same structures described for the poll subroutine. One difference is that the fd field in the pollfd structure contains a file pointer when the flags parameter on the fp_poll kernel service equals 0 (zero). If the flags parameter is set to a POLL_FDMSG value, the field is taken as a file descriptor in all processed pollfd structures. If either the fd or msgid fields in their respective structures has a negative value, the processing for that structure is skipped.
When performing a poll operation on both files and message queues, the listptr parameter points to a pollist structure, which can specify both files and message queues. To construct a pollist structure, use the POLLIST macro as described in the poll subroutine.
If the number of pollfd elements in the nfdsmsgs parameter is 0, then the listptr parameter must point to an array of pollmsg structures.
If the number of pollmsg elements in the nfdsmsgs parameter is 0, then the listptr parameter must point to an array of pollfd structures.
If the number of pollmsg and pollfd elements are both nonzero in the nfdsmsgs parameter, the listptr parameter must point to a pollist structure as previously defined.
The fp_poll kernel service can be called from the process environment only.
Upon successful completion, the fp_poll kernel service returns a value that indicates the total number of files and message queues that satisfy the selection criteria. The return value is similar to the nfdsmsgs parameter in the following ways:
Use the NFDS and NMSGS macros to separate these two values from the return value. A return code of 0 (zero) indicates that:
In other words, all revents fields are 0 (zero).
When the return code from the fp_poll kernel service is negative, it is set to the following value:
EINTR | Indicates that a signal was caught during the fp_poll kernel service. |
The fp_poll kernel service is part of Base Operating System (BOS) Runtime.
The poll subroutine.
The selreg kernel service.
Logical File System Kernel Services in AIX Version 4.3 Kernel Extensions and Device Support Programming Concepts.