pollset.h File

Purpose

Defines structures and flags that are used by pollset subroutines.

Description

The /usr/include/sys/pollset.h file defines several structures that are used by the pollset subroutines. The pollset_poll subroutine or the pollset_poll_ext subroutine checks the I/O status of the file descriptors specified by an array of poll_ctl or poll_ctl_ext structures. The following tables lists the commands that are defined in the /usr/include/sys/pollset.h file. These commands can be used with the pollset_poll subroutine or the pollset_poll_ext subroutine.

Table 1. Commands that can be used with the pollset_ctl or pollset_ctl_ext subroutine that are defined in the pollset.h File.
Command Description
PS_ADD Add a valid open file descriptor to the set of pollset file descriptors.
PS_MOD If the file descriptor is already present in the pollset file descriptors, bits from the events field that is defined in the poll_ctl structure or the pollfd structure, are added to the events that are monitored by the kernel and user-specified data is updated with a new value. If the file descriptor is not present in the pollset file descriptors, the file descriptor is added to the pollset file descriptors.
PS_DELETE Remove a file descriptor from the set of pollset file descriptors.
PS_REPLACE If the file descriptor is already present in the set of pollset file descriptors, replace the value in the events field and user-specified data of the pollset file descriptors set, with a new value specified in the poll_ctl structure.

The poll_ctl structure or the poll_ctl_ext structure is used to perform operations on the pollset structure, and the pollset structure is passed as an input to the pollset_ctl subroutine or the pollset_ctl_ext subroutine. Two versions of the poll_ctl structure or the poll_ctl_ext structure are compatible with the pollset_ctl subroutine or the pollset_ctl_ext subroutine.

The following table lists fields of the poll_ctl structure or the poll_ctl_ext structure that is defined in the pollset.h file:
Table 2. Fields of the poll_ctl structure or the poll_ctl_ext structure
Item Description
version The version field has the following values:
version 0
Original format of the version field that does not support extended fields such as the data field.
version 1
Extended format of the version field that supports user-specified data.
command Specifies the pollset command that is used to read data from the structure and to determine how to modify the pollset file descriptor.
events Indicates events that are being tracked by the kernel. The events field can also contain one of the following flags:
POLLIN
Input to the file descriptor that is present in the file or in the message queue of the device that is sending data to another device.
POLLOUT
The files or the message queue can accept output from a device.
POLLPRI
An exceptional condition such as out-of-band data is present in the file or in the message queue of the device that is sending data to another device.
POLLET
Notifications from a device must be delivered to the device that has created the pollset structure in an edge-triggered manner, that is, the notifications must be delivered as long as the event is being tracked.
The following macros can be used to populate the poll_ctl structure or the poll_ctl_ext structure, or these structures can be populated directly.
Table 3. Macros to initialize the poll_ctl or poll_ctl_ext structure
Item Description
POLL_CTL_INIT(struct poll_ctl *, command, events, fd) Initializes the poll_ctl structure.
POLL_CTL_EXT_INIT_V1(struct poll_ctl_ext *, command, events, fd, data) Initializes the poll_ctl_ext structure with an extended format that supports user-specified data.