Checks the I/O status of multiple file pointers, file descriptors, and message queues.
Item | Description |
---|---|
listptr | Points to an array of pollfd or pollmsg structures, or to a single pollist structure. Each structure specifies a file pointer, file descriptor, or message queue ID. The events of interest for this file or message queue are also specified. |
nfdsmsgs | Specifies the number of files and message queues to check. The low-order 16 bits give the number of elements present in the array of pollfd structures. The high-order 16 bits give the number of elements present in the array of pollmsg structures. If either half of the nfdsmsgs parameter is equal to 0, then the corresponding array is presumed abse1e. |
timeout | Specifies how long the service waits for a specified event to occur. If the value of this parameter is -1, the fp_poll kernel service does not return until at least one of the specified events has occurred. If the time-out value is 0, the fp_poll kernel service does not wait for an event to occur. Instead, the service returns immediately even if none of the specified events have occurred. For any other value of the timeout parameter, the fp_poll kernel service specifies the maximum length of time (in milliseconds) to wait for at least one of the specified events to occur. |
flags | Specifies
the type of data in the listptr parameter:
|
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:
Item | Description |
---|---|
EINTR | Indicates that a signal was caught during the fp_poll kernel service. |