4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
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.
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]
23 * Copyright (c) 1998 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _SYS_DEVPOLL_H
28 #define _SYS_DEVPOLL_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/poll_impl.h>
33 #include <sys/types32.h>
41 #define DPIOC (0xD0 << 8)
42 #define DP_POLL (DPIOC | 1) /* poll on fds in cached in /dev/poll */
43 #define DP_ISPOLLED (DPIOC | 2) /* is this fd cached in /dev/poll */
45 #define DEVPOLLSIZE 1000 /* /dev/poll table size increment */
48 * /dev/poll DP_POLL ioctl format
50 typedef struct dvpoll
{
51 pollfd_t
*dp_fds
; /* pollfd array */
52 nfds_t dp_nfds
; /* num of pollfd's in dp_fds[] */
53 int dp_timeout
; /* time out in milisec */
56 typedef struct dvpoll32
{
57 caddr32_t dp_fds
; /* pollfd array */
58 uint32_t dp_nfds
; /* num of pollfd's in dp_fds[] */
59 int32_t dp_timeout
; /* time out in milisec */
64 typedef struct dp_entry
{
65 kmutex_t dpe_lock
; /* protect a devpoll entry */
66 pollcache_t
*dpe_pcache
; /* a ptr to pollcache */
67 int dpe_refcnt
; /* no. of ioctl lwp on the dpe */
68 int dpe_writerwait
; /* no. of waits on write */
69 int dpe_flag
; /* see below */
73 #define DP_WRITER_PRESENT 0x1 /* a write is in progress */
75 #define DP_REFRELE(dpep) { \
76 mutex_enter(&(dpep)->dpe_lock); \
77 ASSERT((dpep)->dpe_refcnt > 0); \
78 (dpep)->dpe_refcnt--; \
79 if ((dpep)->dpe_refcnt == 0) { \
80 cv_broadcast(&(dpep)->dpe_cv); \
82 mutex_exit(&(dpep)->dpe_lock); \
90 #endif /* _SYS_DEVPOLL_H */