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>


   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  29  */
  30 
  31 /*
  32  * av1394 asynchronous module
  33  */
  34 #include <sys/stat.h>
  35 #include <sys/file.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/1394/targets/av1394/av1394_impl.h>
  39 
  40 /* configuration routines */
  41 static void     av1394_async_cleanup(av1394_inst_t *, int);
  42 static int      av1394_async_create_minor_node(av1394_inst_t *);
  43 static void     av1394_async_remove_minor_node(av1394_inst_t *);
  44 static int      av1394_async_update_targetinfo(av1394_inst_t *);
  45 static int      av1394_async_db2arq_type(int);
  46 static void     av1394_async_putbq(av1394_queue_t *, mblk_t *);
  47 
  48 static int      av1394_ioctl_arq_get_ibuf_size(av1394_inst_t *, void *, int);


 333         case IEC61883_ARQ_GET_IBUF_SIZE:
 334                 ret = av1394_ioctl_arq_get_ibuf_size(avp, (void *)arg, mode);
 335                 break;
 336         case IEC61883_ARQ_SET_IBUF_SIZE:
 337                 ret = av1394_ioctl_arq_set_ibuf_size(avp, (void *)arg, mode);
 338                 break;
 339         case IEC61883_NODE_GET_BUS_NAME:
 340                 ret = av1394_ioctl_node_get_bus_name(avp, (void *)arg, mode);
 341                 break;
 342         case IEC61883_NODE_GET_UID:
 343                 ret = av1394_ioctl_node_get_uid(avp, (void *)arg, mode);
 344                 break;
 345         case IEC61883_NODE_GET_TEXT_LEAF:
 346                 ret = av1394_ioctl_node_get_text_leaf(avp, (void *)arg, mode);
 347         }
 348 
 349         AV1394_TNF_EXIT(av1394_async_ioctl);
 350         return (ret);
 351 }
 352 
 353 /*ARGSUSED*/
 354 int
 355 av1394_async_poll(av1394_inst_t *avp, short events, int anyyet, short *reventsp,
 356                 struct pollhead **phpp)
 357 {
 358         av1394_async_t  *ap = &avp->av_a;
 359         av1394_queue_t  *rq = &ap->a_rq;
 360 
 361         AV1394_TNF_ENTER(av1394_async_poll);
 362 
 363         if (events & POLLIN) {
 364                 if (av1394_peekq(rq))
 365                         *reventsp |= POLLIN;

 366 
 367                 if ((!*reventsp && !anyyet) || (events & POLLET)) {
 368                         mutex_enter(&ap->a_mutex);

 369                         ap->a_pollevents |= POLLIN;

 370                         *phpp = &ap->a_pollhead;
 371                         mutex_exit(&ap->a_mutex);
 372                 }
 373         }
 374 
 375         AV1394_TNF_EXIT(av1394_async_poll);
 376         return (0);
 377 }
 378 
 379 
 380 /*
 381  * put a message on the read queue, take care of polling
 382  */
 383 void
 384 av1394_async_putq_rq(av1394_inst_t *avp, mblk_t *mp)
 385 {
 386         av1394_async_t  *ap = &avp->av_a;
 387 
 388         if (!av1394_putq(&ap->a_rq, mp)) {
 389                 freemsg(mp);




   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Copyright 2017 Joyent, Inc.
  29  */
  30 
  31 /*
  32  * av1394 asynchronous module
  33  */
  34 #include <sys/stat.h>
  35 #include <sys/file.h>
  36 #include <sys/ddi.h>
  37 #include <sys/sunddi.h>
  38 #include <sys/1394/targets/av1394/av1394_impl.h>
  39 
  40 /* configuration routines */
  41 static void     av1394_async_cleanup(av1394_inst_t *, int);
  42 static int      av1394_async_create_minor_node(av1394_inst_t *);
  43 static void     av1394_async_remove_minor_node(av1394_inst_t *);
  44 static int      av1394_async_update_targetinfo(av1394_inst_t *);
  45 static int      av1394_async_db2arq_type(int);
  46 static void     av1394_async_putbq(av1394_queue_t *, mblk_t *);
  47 
  48 static int      av1394_ioctl_arq_get_ibuf_size(av1394_inst_t *, void *, int);


 333         case IEC61883_ARQ_GET_IBUF_SIZE:
 334                 ret = av1394_ioctl_arq_get_ibuf_size(avp, (void *)arg, mode);
 335                 break;
 336         case IEC61883_ARQ_SET_IBUF_SIZE:
 337                 ret = av1394_ioctl_arq_set_ibuf_size(avp, (void *)arg, mode);
 338                 break;
 339         case IEC61883_NODE_GET_BUS_NAME:
 340                 ret = av1394_ioctl_node_get_bus_name(avp, (void *)arg, mode);
 341                 break;
 342         case IEC61883_NODE_GET_UID:
 343                 ret = av1394_ioctl_node_get_uid(avp, (void *)arg, mode);
 344                 break;
 345         case IEC61883_NODE_GET_TEXT_LEAF:
 346                 ret = av1394_ioctl_node_get_text_leaf(avp, (void *)arg, mode);
 347         }
 348 
 349         AV1394_TNF_EXIT(av1394_async_ioctl);
 350         return (ret);
 351 }
 352 

 353 int
 354 av1394_async_poll(av1394_inst_t *avp, short events, int anyyet, short *reventsp,
 355     struct pollhead **phpp)
 356 {
 357         av1394_async_t  *ap = &avp->av_a;
 358         av1394_queue_t  *rq = &ap->a_rq;
 359 
 360         AV1394_TNF_ENTER(av1394_async_poll);
 361 
 362         if (events & (POLLIN | POLLET)) {
 363                 if ((events & POLLIN) && av1394_peekq(rq)) {
 364                         *reventsp |= POLLIN;
 365                 }
 366 
 367                 if ((!*reventsp && !anyyet) || (events & POLLET)) {
 368                         mutex_enter(&ap->a_mutex);
 369                         if (events & POLLIN) {
 370                                 ap->a_pollevents |= POLLIN;
 371                         }
 372                         *phpp = &ap->a_pollhead;
 373                         mutex_exit(&ap->a_mutex);
 374                 }
 375         }
 376 
 377         AV1394_TNF_EXIT(av1394_async_poll);
 378         return (0);
 379 }
 380 
 381 
 382 /*
 383  * put a message on the read queue, take care of polling
 384  */
 385 void
 386 av1394_async_putq_rq(av1394_inst_t *avp, mblk_t *mp)
 387 {
 388         av1394_async_t  *ap = &avp->av_a;
 389 
 390         if (!av1394_putq(&ap->a_rq, mp)) {
 391                 freemsg(mp);