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>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man9e/chpoll.9e
          +++ new/usr/src/man/man9e/chpoll.9e
   1    1  '\" te
   2    2  .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
   3    3  .\" Copyright 1989 AT&T
        4 +.\" Copyright 2017 Joyent, Inc
   4    5  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   5    6  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   6    7  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   7      -.TH CHPOLL 9E "May 7, 2008"
        8 +.TH CHPOLL 9E "Jan 18, 2017"
   8    9  .SH NAME
   9   10  chpoll \- poll entry point for a non-STREAMS character driver
  10   11  .SH SYNOPSIS
  11   12  .LP
  12   13  .nf
  13   14  #include <sys/types.h>
  14   15  #include <sys/poll.h>
  15   16  #include <sys/ddi.h>
  16   17  #include <sys/sunddi.h>
  17   18  
↓ open down ↓ 157 lines elided ↑ open up ↑
 175  176  1.
 176  177  Implement the following algorithm when the \fBchpoll()\fR entry point is
 177  178  called:
 178  179  .sp
 179  180  .in +2
 180  181  .nf
 181  182  if (specified_events_are_satisfied_now) {
 182  183        *reventsp = satisfied_events & events;
 183  184  } else {
 184  185        *reventsp = 0;
 185      -      if (!anyyet)
 186      -            *phpp = &my_local_pollhead_structure;
 187  186  }
      187 +if ((*reventsp == 0 && !anyyet) || (events & POLLET))
      188 +      *phpp = &my_local_pollhead_structure;
 188  189  return (0);
 189  190  .fi
 190  191  .in -2
 191  192  
      193 +Note: Prior to the integration of \fBepoll\fR(5), which included
      194 +edge-triggering via the \fBPOLLET\fR flag, standard chpoll mechanisms would
      195 +only provide a pollhead in \fBphpp\fR if there were no matching events.
      196 +Edge-triggered polling requires that \fBpollwakeup()\fR always be called for a
      197 +resource, so if \fBPOLLET\fR is set in the \fBevents\fR of interest, the chpoll
      198 +method must yield a pollhead and prepare to issue \fBpollwakeup()\fR calls on
      199 +it.
      200 +
      201 +Drivers which are not wired up to make \fBpollwakeup()\fR calls on a pollhead
      202 +when their status changes should emit one from their \fBchpoll\fR routine.
      203 +This will exclude the resource from caching by pollers, since it cannot alert
      204 +them to new events without \fBpollwakeup()\fR notification.
      205 +
 192  206  .RE
 193  207  .RS +4
 194  208  .TP
 195  209  2.
 196  210  Allocate an instance of the \fBpollhead\fR structure. This instance may be
 197  211  tied to the per-minor data structure defined by the driver. The \fBpollhead\fR
 198  212  structure should be treated as a "black box" by the driver. Initialize the
 199  213  \fBpollhead\fR structure by filling it with zeroes. The size of this structure
 200  214  is guaranteed to remain the same across releases.
 201  215  .RE
↓ open down ↓ 43 lines elided ↑ open up ↑
 245  259  associated with the \fBpollhead\fR is about to be deallocated by the
 246  260  \fBclose\fR(9E) entry point.
 247  261  
 248  262  .RE
 249  263  .SH RETURN VALUES
 250  264  .LP
 251  265  \fBchpoll()\fR should return \fB0\fR for success, or the appropriate error
 252  266  number.
 253  267  .SH SEE ALSO
 254  268  .LP
 255      -\fBpoll\fR(2), \fBnochpoll\fR(9F), \fBpollwakeup\fR(9F)
      269 +\fBpoll\fR(2), \fBepoll\fR(5), \fBnochpoll\fR(9F), \fBpollwakeup\fR(9F)
 256  270  .sp
 257  271  .LP
 258  272  \fIWriting Device Drivers\fR
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX