text: #include <sys/poll.h> #include <sys/ddi.h>
  int prefixchpoll(dev_t dev, short events, int anyyet, short *reventsp, struct pollhead **phpp);
  Valid values for events are:
  A driver that supports polling must provide a pollhead structure for each minor device supported by the driver. Use the phalloc(D3) function to allocate the pollhead structure, and use the phfree(D3) function to free the pollhead structure, if necessary. To drivers, the pollhead structure is an opaque object; none of its members can be referenced directly.
  The driver must implement the polling discipline itself. Each time the driver detects a pollable event, it should call pollwakeup(D3), passing to it the event that occurred and the address of the pollhead structure associated with the device. Note that pollwakeup should be called with only one event at a time.
  When the driver's chpoll entry point is called, the driver should check if any of the events requested in events have occurred. The driver should store the mask, consisting of the subset of events that are pending, in the short pointed to by reventsp. Note that this mask may be 0 if none of the events are pending. In this case, the driver should check the anyyet flag and, if it is zero, store the address of the device's pollhead structure in the pointer pointed at by phpp. The canonical chpoll algorithm is:
  if (events_are_satisfied_now) { *reventsp = events & mask_of_satisfied_events; } else { *reventsp = 0; if (!anyyet) *phpp = my_local_pollhead_pointer; } return (0);
  If the chpoll( ) entry point routine uses the sleep(D3) function to block, it must either sleep non-interruptible or use PCATCH.
  The phalloc(D3) routine is not supported in DDI versions 1, 2, and 4 so pollhead structures must be allocated directly by the driver and must be initialized to zero before it is used with the bzero(D3) or kmem_zalloc(D3) routine or static allocation.