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/xen/io/evtchn_dev.c
          +++ new/usr/src/uts/common/xen/io/evtchn_dev.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2017 Joyent, Inc.
  25   26   */
  26   27  
  27   28  
  28   29  /*
  29   30   * evtchn.c
  30   31   *
  31   32   * Driver for receiving and demuxing event-channel signals.
  32   33   *
  33   34   * Copyright (c) 2004-2005, K A Fraser
  34   35   * Multi-process extensions Copyright (c) 2004, Steven Smith
↓ open down ↓ 408 lines elided ↑ open up ↑
 443  444  }
 444  445  
 445  446  static int
 446  447  evtchndrv_poll(dev_t dev, short ev, int anyyet, short *revp, pollhead_t **phpp)
 447  448  {
 448  449          struct evtsoftdata *ep;
 449  450          minor_t minor = getminor(dev);
 450  451          short mask = 0;
 451  452  
 452  453          ep = EVTCHNDRV_INST2SOFTS(EVTCHNDRV_MINOR2INST(minor));
 453      -        *phpp = (struct pollhead *)NULL;
 454  454  
 455  455          if (ev & POLLOUT)
 456  456                  mask |= POLLOUT;
 457  457          if (ep->ring_overflow)
 458  458                  mask |= POLLERR;
 459  459          if (ev & (POLLIN | POLLRDNORM)) {
 460  460                  mutex_enter(&ep->evtchn_lock);
 461      -                if (ep->ring_cons != ep->ring_prod)
      461 +                if (ep->ring_cons != ep->ring_prod) {
 462  462                          mask |= (POLLIN | POLLRDNORM) & ev;
 463      -                else
 464      -                        if (mask == 0 && !anyyet)
 465      -                                *phpp = &ep->evtchn_pollhead;
      463 +                }
 466  464                  mutex_exit(&ep->evtchn_lock);
 467  465          }
      466 +        if ((mask == 0 && !anyyet) || (ev & POLLET)) {
      467 +                *phpp = &ep->evtchn_pollhead;
      468 +        }
 468  469          *revp = mask;
 469  470          return (0);
 470  471  }
 471  472  
 472  473  
 473  474  /* ARGSUSED */
 474  475  static int
 475  476  evtchndrv_open(dev_t *devp, int flag, int otyp, cred_t *credp)
 476  477  {
 477  478          struct evtsoftdata *ep;
↓ open down ↓ 263 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX