6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / devpoll.h
blob36c815c69ff7560bb03b75157525fbb41962b892
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
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>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 /* /dev/poll ioctl */
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 */
54 } dvpoll_t;
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 */
60 } dvpoll32_t;
62 #ifdef _KERNEL
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 */
70 kcondvar_t dpe_cv;
71 } dp_entry_t;
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); \
81 } \
82 mutex_exit(&(dpep)->dpe_lock); \
84 #endif /* _KERNEL */
86 #ifdef __cplusplus
88 #endif
90 #endif /* _SYS_DEVPOLL_H */