Print this page
8634 epoll fails to wake on certain edge-triggered conditions
8635 epoll should not emit POLLNVAL
8636 recursive epoll should emit EPOLLRDNORM
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
        
@@ -105,16 +105,31 @@
 
                     if (specified_events_are_satisfied_now) {
                           *reventsp = satisfied_events & events;
                     } else {
                           *reventsp = 0;
-                          if (!anyyet)
-                                *phpp = &my_local_pollhead_structure;
                     }
+                    if ((*reventsp == 0 && !anyyet) || (events & POLLET))
+                          *phpp = &my_local_pollhead_structure;
                     return (0);
 
+                  Note: Prior to the integration of epoll(5), which included
+                  edge-triggering via the POLLET flag, standard chpoll
+                  mechanisms would only provide a pollhead in phpp if there
+                  were no matching events.  Edge-triggered polling requires
+                  that pollwakeup() always be called for a resource, so if
+                  POLLET is set in the events of interest, the chpoll method
+                  must yield a pollhead and prepare to issue pollwakeup()
+                  calls on it.
 
+                  Drivers which are not wired up to make pollwakeup() calls on
+                  a pollhead when their status changes should emit one from
+                  their chpoll routine.  This will exclude the resource from
+                  caching by pollers, since it cannot alert them to new events
+                  without pollwakeup() notification.
+
+
            2.     Allocate an instance of the pollhead structure. This
                   instance may be tied to the per-minor data structure defined
                   by the driver. The pollhead structure should be treated as a
                   "black box" by the driver. Initialize the pollhead structure
                   by filling it with zeroes. The size of this structure is
@@ -162,13 +177,13 @@
 
 RETURN VALUES
        chpoll() should return 0 for success, or the appropriate error number.
 
 SEE ALSO
-       poll(2), nochpoll(9F), pollwakeup(9F)
+       poll(2), epoll(5), nochpoll(9F), pollwakeup(9F)
 
 
        Writing Device Drivers
 
 
 
-                                  May 7, 2008                       CHPOLL(9E)
+                               January 18, 2017                     CHPOLL(9E)