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/uts/common/io/eventfd.c
          +++ new/usr/src/uts/common/io/eventfd.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2016 Joyent, Inc.
       13 + * Copyright 2017 Joyent, Inc.
  14   14   */
  15   15  
  16   16  /*
  17   17   * Support for the eventfd facility, a Linux-borne facility for user-generated
  18   18   * file descriptor-based events.
  19   19   */
  20   20  
  21   21  #include <sys/ddi.h>
  22   22  #include <sys/sunddi.h>
  23   23  #include <sys/eventfd.h>
↓ open down ↓ 197 lines elided ↑ open up ↑
 221  221          state = ddi_get_soft_state(eventfd_softstate, minor);
 222  222  
 223  223          mutex_enter(&state->efd_lock);
 224  224  
 225  225          if (state->efd_value > 0)
 226  226                  revents |= POLLRDNORM | POLLIN;
 227  227  
 228  228          if (state->efd_value < EVENTFD_VALMAX)
 229  229                  revents |= POLLWRNORM | POLLOUT;
 230  230  
 231      -        if (!(*reventsp = revents & events) && !anyyet)
      231 +        *reventsp = revents & events;
      232 +        if ((*reventsp == 0 && !anyyet) || (events & POLLET)) {
 232  233                  *phpp = &state->efd_pollhd;
      234 +        }
 233  235  
 234  236          mutex_exit(&state->efd_lock);
 235  237  
 236  238          return (0);
 237  239  }
 238  240  
 239  241  /*ARGSUSED*/
 240  242  static int
 241  243  eventfd_ioctl(dev_t dev, int cmd, intptr_t arg, int md, cred_t *cr, int *rv)
 242  244  {
↓ open down ↓ 206 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX