xref: /titanic_44/usr/src/uts/common/sys/poll_impl.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_POLL_IMPL_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_POLL_IMPL_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * Caching Poll Subsystem:
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * Each kernel thread (1), if engaged in poll system call, has a reference to
36*7c478bd9Sstevel@tonic-gate  * a pollstate_t (2), which contains relevant flags and locks.  The pollstate_t
37*7c478bd9Sstevel@tonic-gate  * contains a pointer to a pcache_t (3), which caches the state of previous
38*7c478bd9Sstevel@tonic-gate  * calls to poll.  A bitmap (4) is stored inside the poll cache, where each
39*7c478bd9Sstevel@tonic-gate  * bit represents a file descriptor.  The bits are set if the corresponding
40*7c478bd9Sstevel@tonic-gate  * device has a polled event pending.  Only fds with their bit set will be
41*7c478bd9Sstevel@tonic-gate  * examined on the next poll invocation.  The pollstate_t also contains a list
42*7c478bd9Sstevel@tonic-gate  * of fd sets (5), which are represented by the pollcacheset_t type.  These
43*7c478bd9Sstevel@tonic-gate  * structures keep track of the pollfd_t arrays (6) passed in from userland.
44*7c478bd9Sstevel@tonic-gate  * Each polled file descriptor has a corresponding polldat_t which can be
45*7c478bd9Sstevel@tonic-gate  * chained onto a device's pollhead, and these are kept in a hash table (7)
46*7c478bd9Sstevel@tonic-gate  * inside the pcache_t.  The hash table allows efficient conversion of a
47*7c478bd9Sstevel@tonic-gate  * given fd to its corresponding polldat_t.
48*7c478bd9Sstevel@tonic-gate  *
49*7c478bd9Sstevel@tonic-gate  * (1)              (2)
50*7c478bd9Sstevel@tonic-gate  * +-----------+    +-------------+
51*7c478bd9Sstevel@tonic-gate  * | kthread_t |--->| pollstate_t |-->+-------------+  (6)
52*7c478bd9Sstevel@tonic-gate  * +-----------+    +-------------+(5)| pcacheset_t |->[_][_][_][_] pollfd_t
53*7c478bd9Sstevel@tonic-gate  *                          |         +-------------+
54*7c478bd9Sstevel@tonic-gate  *                          |         | pcacheset_t |->[_][_][_][_] pollfd_t
55*7c478bd9Sstevel@tonic-gate  * (1a)                     |         +-------------+
56*7c478bd9Sstevel@tonic-gate  * +---------------+	    |
57*7c478bd9Sstevel@tonic-gate  * | /dev/poll tbl |	    |
58*7c478bd9Sstevel@tonic-gate  * +-v-------------+	    |
59*7c478bd9Sstevel@tonic-gate  *   |			    |
60*7c478bd9Sstevel@tonic-gate  *   +------------------+   |
61*7c478bd9Sstevel@tonic-gate  * (7)              (3) V   v
62*7c478bd9Sstevel@tonic-gate  * polldat hash     +-------------+    (4) bitmap representing fd space
63*7c478bd9Sstevel@tonic-gate  * [_][_][_][_]<----|             |--->000010010010001010101010101010110
64*7c478bd9Sstevel@tonic-gate  *  |  |  |  |      | pollcache_t |
65*7c478bd9Sstevel@tonic-gate  *  .  v  .  .      |             |
66*7c478bd9Sstevel@tonic-gate  *    [polldat_t]   +-------------+
67*7c478bd9Sstevel@tonic-gate  *     |
68*7c478bd9Sstevel@tonic-gate  *    [polldat_t]
69*7c478bd9Sstevel@tonic-gate  *     |
70*7c478bd9Sstevel@tonic-gate  *     v
71*7c478bd9Sstevel@tonic-gate  *     NULL
72*7c478bd9Sstevel@tonic-gate  *
73*7c478bd9Sstevel@tonic-gate  *
74*7c478bd9Sstevel@tonic-gate  * Both poll system call and /dev/poll use the pollcache_t structure
75*7c478bd9Sstevel@tonic-gate  * definition and the routines managing the structure. But poll(2) and
76*7c478bd9Sstevel@tonic-gate  * /dev/poll have their own copy of the structures. The /dev/poll driver
77*7c478bd9Sstevel@tonic-gate  * table (1a) contains an array of pointers, each pointing at a pcache_t
78*7c478bd9Sstevel@tonic-gate  * struct (3). A device minor number is used as an device table index.
79*7c478bd9Sstevel@tonic-gate  *
80*7c478bd9Sstevel@tonic-gate  */
81*7c478bd9Sstevel@tonic-gate #include <sys/poll.h>
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate #if defined(_KERNEL) || defined(_KMEMUSER)
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate #include <sys/thread.h>
86*7c478bd9Sstevel@tonic-gate #include <sys/file.h>
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
89*7c478bd9Sstevel@tonic-gate extern "C" {
90*7c478bd9Sstevel@tonic-gate #endif
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /*
93*7c478bd9Sstevel@tonic-gate  * description of pollcacheset structure
94*7c478bd9Sstevel@tonic-gate  */
95*7c478bd9Sstevel@tonic-gate typedef struct pollcacheset {
96*7c478bd9Sstevel@tonic-gate 	uintptr_t	pcs_usradr;	/* usr pollfd array address */
97*7c478bd9Sstevel@tonic-gate 	pollfd_t	*pcs_pollfd;	/* cached poll lists */
98*7c478bd9Sstevel@tonic-gate 	size_t		pcs_nfds;	/* number of poll fd in cached list */
99*7c478bd9Sstevel@tonic-gate 	ulong_t		pcs_count;	/* for LU replacement policy */
100*7c478bd9Sstevel@tonic-gate } pollcacheset_t;
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #define	POLLFDSETS	2
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /*
105*7c478bd9Sstevel@tonic-gate  * State information kept by each polling thread
106*7c478bd9Sstevel@tonic-gate  */
107*7c478bd9Sstevel@tonic-gate typedef struct pollstate {
108*7c478bd9Sstevel@tonic-gate 	pollfd_t	*ps_pollfd;	/* hold the current poll list */
109*7c478bd9Sstevel@tonic-gate 	size_t		ps_nfds;	/* size of ps_pollfd */
110*7c478bd9Sstevel@tonic-gate 	kmutex_t	ps_lock;	/* mutex for sleep/wakeup */
111*7c478bd9Sstevel@tonic-gate 	struct pollcache *ps_pcache;	/* cached poll fd set */
112*7c478bd9Sstevel@tonic-gate 	pollcacheset_t	*ps_pcacheset;	/* cached poll lists */
113*7c478bd9Sstevel@tonic-gate 	int		ps_nsets;	/* no. of cached poll sets */
114*7c478bd9Sstevel@tonic-gate 	pollfd_t	*ps_dpbuf;	/* return pollfd buf used by devpoll */
115*7c478bd9Sstevel@tonic-gate 	size_t		ps_dpbufsize;	/* size of ps_dpbuf */
116*7c478bd9Sstevel@tonic-gate } pollstate_t;
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate /*
119*7c478bd9Sstevel@tonic-gate  * poll cache size defines
120*7c478bd9Sstevel@tonic-gate  */
121*7c478bd9Sstevel@tonic-gate #define	POLLCHUNKSHIFT		8	/* hash table increment size is 256 */
122*7c478bd9Sstevel@tonic-gate #define	POLLHASHCHUNKSZ		(1 << POLLCHUNKSHIFT)
123*7c478bd9Sstevel@tonic-gate #define	POLLHASHINC		2	/* poll hash table growth factor */
124*7c478bd9Sstevel@tonic-gate #define	POLLHASHTHRESHOLD	2	/* poll hash list length threshold */
125*7c478bd9Sstevel@tonic-gate #define	POLLHASH(x, y)	((y) % (x))	/* poll hash function */
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * poll.c assumes the POLLMAPCHUNK is power of 2
129*7c478bd9Sstevel@tonic-gate  */
130*7c478bd9Sstevel@tonic-gate #define	POLLMAPCHUNK	2048	/* bitmap inc -- each for 2K of polled fd's */
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate /*
133*7c478bd9Sstevel@tonic-gate  * used to refrence from watched fd back to the fd position in cached
134*7c478bd9Sstevel@tonic-gate  * poll list for quick revents update.
135*7c478bd9Sstevel@tonic-gate  */
136*7c478bd9Sstevel@tonic-gate typedef struct xref {
137*7c478bd9Sstevel@tonic-gate 	ssize_t	xf_position;    /* xref fd position in poll fd list */
138*7c478bd9Sstevel@tonic-gate 	short	xf_refcnt;	/* ref cnt of same fd in poll list */
139*7c478bd9Sstevel@tonic-gate } xref_t;
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #define	POLLPOSINVAL	(-1L)	/* xf_position is invalid */
142*7c478bd9Sstevel@tonic-gate #define	POLLPOSTRANS	(-2L)	/* xf_position is transient state */
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate /*
145*7c478bd9Sstevel@tonic-gate  * polldat is an entry for a cached poll fd. A polldat struct can be in
146*7c478bd9Sstevel@tonic-gate  * poll cache table as well as on pollhead ph_list, which is used by
147*7c478bd9Sstevel@tonic-gate  * pollwakeup to wake up a sleeping poller. There should be one polldat
148*7c478bd9Sstevel@tonic-gate  * per polled fd hanging off pollstate struct.
149*7c478bd9Sstevel@tonic-gate  */
150*7c478bd9Sstevel@tonic-gate typedef struct polldat {
151*7c478bd9Sstevel@tonic-gate 	int		pd_fd;		/* cached poll fd */
152*7c478bd9Sstevel@tonic-gate 	int		pd_events;	/* union of all polled events */
153*7c478bd9Sstevel@tonic-gate 	file_t		*pd_fp;		/* used to detect fd reuse */
154*7c478bd9Sstevel@tonic-gate 	pollhead_t	*pd_php;	/* used to undo poll registration */
155*7c478bd9Sstevel@tonic-gate 	kthread_t	*pd_thread;	/* used for waking up a sleep thrd */
156*7c478bd9Sstevel@tonic-gate 	struct pollcache *pd_pcache;	/* a ptr to the pollcache of this fd */
157*7c478bd9Sstevel@tonic-gate 	struct polldat	*pd_next;	/* next on pollhead's ph_list */
158*7c478bd9Sstevel@tonic-gate 	struct polldat	*pd_hashnext;	/* next on pollhead's ph_list */
159*7c478bd9Sstevel@tonic-gate 	int		pd_count;	/* total count from all ref'ed sets */
160*7c478bd9Sstevel@tonic-gate 	int		pd_nsets;	/* num of xref sets, used by poll(2) */
161*7c478bd9Sstevel@tonic-gate 	xref_t		*pd_ref;	/* ptr to xref info, 1 for each set */
162*7c478bd9Sstevel@tonic-gate 	struct port_kevent *pd_portev;	/* associated port event struct */
163*7c478bd9Sstevel@tonic-gate } polldat_t;
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*
166*7c478bd9Sstevel@tonic-gate  * One cache for each thread that polls. Points to a bitmap (used by pollwakeup)
167*7c478bd9Sstevel@tonic-gate  * and a hash table of polldats.
168*7c478bd9Sstevel@tonic-gate  * The offset of pc_lock field must be kept in sync with the pc_lock offset
169*7c478bd9Sstevel@tonic-gate  * of port_fdcache_t, both structs implement pc_lock with offset 0 (see also
170*7c478bd9Sstevel@tonic-gate  * pollrelock()).
171*7c478bd9Sstevel@tonic-gate  */
172*7c478bd9Sstevel@tonic-gate typedef struct pollcache {
173*7c478bd9Sstevel@tonic-gate 	kmutex_t	pc_lock;	/* lock to protect pollcache */
174*7c478bd9Sstevel@tonic-gate 	ulong_t		*pc_bitmap;	/* point to poll fd bitmap */
175*7c478bd9Sstevel@tonic-gate 	polldat_t	**pc_hash;	/* points to a hash table of ptrs */
176*7c478bd9Sstevel@tonic-gate 	int		pc_mapend;	/* the largest fd encountered so far */
177*7c478bd9Sstevel@tonic-gate 	int		pc_mapsize;	/* the size of current map */
178*7c478bd9Sstevel@tonic-gate 	int		pc_hashsize;	/* the size of current hash table */
179*7c478bd9Sstevel@tonic-gate 	int		pc_fdcount;	/* track how many fd's are hashed */
180*7c478bd9Sstevel@tonic-gate 	int		pc_flag;	/* see pc_flag define below */
181*7c478bd9Sstevel@tonic-gate 	int		pc_busy;	/* can only exit when its 0 */
182*7c478bd9Sstevel@tonic-gate 	kmutex_t	pc_no_exit;	/* protects pc_busy*, can't be nested */
183*7c478bd9Sstevel@tonic-gate 	kcondvar_t	pc_busy_cv;	/* cv to wait on if ps_busy != 0 */
184*7c478bd9Sstevel@tonic-gate 	kcondvar_t	pc_cv;		/* cv to wait on if needed */
185*7c478bd9Sstevel@tonic-gate 	pid_t		pc_pid;		/* for check acc rights, devpoll only */
186*7c478bd9Sstevel@tonic-gate 	int		pc_mapstart;	/* where search start, devpoll only */
187*7c478bd9Sstevel@tonic-gate } pollcache_t;
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate /* pc_flag */
190*7c478bd9Sstevel@tonic-gate #define	T_POLLWAKE	0x02	/* pollwakeup() occurred */
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #if defined(_KERNEL)
193*7c478bd9Sstevel@tonic-gate /*
194*7c478bd9Sstevel@tonic-gate  * Internal routines.
195*7c478bd9Sstevel@tonic-gate  */
196*7c478bd9Sstevel@tonic-gate extern void pollnotify(pollcache_t *, int);
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate /*
199*7c478bd9Sstevel@tonic-gate  * public poll head interfaces (see poll.h):
200*7c478bd9Sstevel@tonic-gate  *
201*7c478bd9Sstevel@tonic-gate  *  pollhead_clean      clean up all polldats on a pollhead list
202*7c478bd9Sstevel@tonic-gate  */
203*7c478bd9Sstevel@tonic-gate extern void pollhead_clean(pollhead_t *);
204*7c478bd9Sstevel@tonic-gate 
205*7c478bd9Sstevel@tonic-gate /*
206*7c478bd9Sstevel@tonic-gate  * private poll head interfaces:
207*7c478bd9Sstevel@tonic-gate  *
208*7c478bd9Sstevel@tonic-gate  *  pollhead_insert     adds a polldat to a pollhead list
209*7c478bd9Sstevel@tonic-gate  *  pollhead_delete     removes a polldat from a pollhead list
210*7c478bd9Sstevel@tonic-gate  */
211*7c478bd9Sstevel@tonic-gate extern void pollhead_insert(pollhead_t *, polldat_t *);
212*7c478bd9Sstevel@tonic-gate extern void pollhead_delete(pollhead_t *, polldat_t *);
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate /*
215*7c478bd9Sstevel@tonic-gate  * poll state interfaces:
216*7c478bd9Sstevel@tonic-gate  *
217*7c478bd9Sstevel@tonic-gate  *  pollstate_create    creates per-thread pollstate
218*7c478bd9Sstevel@tonic-gate  *  pollstate_destroy   cleans up per-thread pollstate
219*7c478bd9Sstevel@tonic-gate  */
220*7c478bd9Sstevel@tonic-gate extern pollstate_t *pollstate_create(void);
221*7c478bd9Sstevel@tonic-gate extern void pollstate_destroy(pollstate_t *);
222*7c478bd9Sstevel@tonic-gate 
223*7c478bd9Sstevel@tonic-gate /*
224*7c478bd9Sstevel@tonic-gate  * public pcache interfaces:
225*7c478bd9Sstevel@tonic-gate  *
226*7c478bd9Sstevel@tonic-gate  *  pcache_alloc	allocate a poll cache skeleton
227*7c478bd9Sstevel@tonic-gate  *  pcache_create       creates all poll cache supporting data struct
228*7c478bd9Sstevel@tonic-gate  *  pcache_insert	cache a poll fd, calls pcache_insert_fd
229*7c478bd9Sstevel@tonic-gate  *  pcache_lookup       given an fd list, returns a cookie
230*7c478bd9Sstevel@tonic-gate  *  pcache_poll         polls the cache for fd's having events on them
231*7c478bd9Sstevel@tonic-gate  *  pcache_clean        clean up all the pollhead and fpollinfo reference
232*7c478bd9Sstevel@tonic-gate  *  pcache_destroy      destroys the pcache
233*7c478bd9Sstevel@tonic-gate  */
234*7c478bd9Sstevel@tonic-gate extern pollcache_t *pcache_alloc();
235*7c478bd9Sstevel@tonic-gate extern void pcache_create(pollcache_t *, nfds_t);
236*7c478bd9Sstevel@tonic-gate extern int pcache_insert(pollstate_t *, file_t *, pollfd_t *, int *, ssize_t,
237*7c478bd9Sstevel@tonic-gate     int);
238*7c478bd9Sstevel@tonic-gate extern int pcache_poll(pollfd_t *, pollstate_t *, nfds_t, int *, int);
239*7c478bd9Sstevel@tonic-gate extern void pcache_clean(pollcache_t *);
240*7c478bd9Sstevel@tonic-gate extern void pcache_destroy(pollcache_t *);
241*7c478bd9Sstevel@tonic-gate 
242*7c478bd9Sstevel@tonic-gate /*
243*7c478bd9Sstevel@tonic-gate  * private pcache interfaces:
244*7c478bd9Sstevel@tonic-gate  *
245*7c478bd9Sstevel@tonic-gate  *  pcache_lookup_fd	lookup an fd, returns a polldat
246*7c478bd9Sstevel@tonic-gate  *  pcache_alloc_fd	allocates and returns a polldat
247*7c478bd9Sstevel@tonic-gate  *  pcache_insert_fd	insert an fd into pcache (called by pcache_insert)
248*7c478bd9Sstevel@tonic-gate  *  pcache_delete_fd	insert an fd into pcache (called by pcacheset_delete_fd)
249*7c478bd9Sstevel@tonic-gate  *  pcache_grow_hashtbl	grows the pollcache hash table and rehash
250*7c478bd9Sstevel@tonic-gate  *  pcache_grow_map	grows the pollcache bitmap
251*7c478bd9Sstevel@tonic-gate  *  pcache_update_xref	update cross ref (from polldat back to cacheset) info
252*7c478bd9Sstevel@tonic-gate  *  pcache_clean_entry	cleanup an entry in pcache and more...
253*7c478bd9Sstevel@tonic-gate  */
254*7c478bd9Sstevel@tonic-gate extern polldat_t *pcache_lookup_fd(pollcache_t *, int);
255*7c478bd9Sstevel@tonic-gate extern polldat_t *pcache_alloc_fd(int);
256*7c478bd9Sstevel@tonic-gate extern void pcache_insert_fd(pollcache_t *, polldat_t *, nfds_t);
257*7c478bd9Sstevel@tonic-gate extern int pcache_delete_fd(pollstate_t *, int, size_t, int, uint_t);
258*7c478bd9Sstevel@tonic-gate extern void pcache_grow_hashtbl(pollcache_t *, nfds_t);
259*7c478bd9Sstevel@tonic-gate extern void pcache_grow_map(pollcache_t *, int);
260*7c478bd9Sstevel@tonic-gate extern void pcache_update_xref(pollcache_t *, int, ssize_t, int);
261*7c478bd9Sstevel@tonic-gate extern void pcache_clean_entry(pollstate_t *, int);
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate /*
264*7c478bd9Sstevel@tonic-gate  * pcacheset interfaces:
265*7c478bd9Sstevel@tonic-gate  *
266*7c478bd9Sstevel@tonic-gate  * pcacheset_create     creates new pcachesets (easier for dynamic pcachesets)
267*7c478bd9Sstevel@tonic-gate  * pcacheset_destroy    destroys a pcacheset
268*7c478bd9Sstevel@tonic-gate  * pcacheset_cache_list caches and polls a new poll list
269*7c478bd9Sstevel@tonic-gate  * pcacheset_remove_list removes (usually a partial) cached poll list
270*7c478bd9Sstevel@tonic-gate  * pcacheset_resolve    resolves extant pcacheset and fd list
271*7c478bd9Sstevel@tonic-gate  * pcacheset_cmp        compares a pcacheset with an fd list
272*7c478bd9Sstevel@tonic-gate  * pcacheset_invalidate invalidate entries in pcachesets
273*7c478bd9Sstevel@tonic-gate  * pcacheset_reset_count resets the usage counter of pcachesets
274*7c478bd9Sstevel@tonic-gate  * pcacheset_replace	selects a poll cacheset for replacement
275*7c478bd9Sstevel@tonic-gate  */
276*7c478bd9Sstevel@tonic-gate extern pollcacheset_t *pcacheset_create(int);
277*7c478bd9Sstevel@tonic-gate extern void pcacheset_destroy(pollcacheset_t *, int);
278*7c478bd9Sstevel@tonic-gate extern int pcacheset_cache_list(pollstate_t *, pollfd_t *, int *, int);
279*7c478bd9Sstevel@tonic-gate extern void pcacheset_remove_list(pollstate_t *, pollfd_t *, int, int, int,
280*7c478bd9Sstevel@tonic-gate     int);
281*7c478bd9Sstevel@tonic-gate extern int pcacheset_resolve(pollstate_t *, nfds_t, int *, int);
282*7c478bd9Sstevel@tonic-gate extern int pcacheset_cmp(pollfd_t *, pollfd_t *, pollfd_t *, int);
283*7c478bd9Sstevel@tonic-gate extern void pcacheset_invalidate(pollstate_t *, polldat_t *);
284*7c478bd9Sstevel@tonic-gate extern void pcacheset_reset_count(pollstate_t *, int);
285*7c478bd9Sstevel@tonic-gate extern int pcacheset_replace(pollstate_t *);
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) */
288*7c478bd9Sstevel@tonic-gate 
289*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
290*7c478bd9Sstevel@tonic-gate }
291*7c478bd9Sstevel@tonic-gate #endif
292*7c478bd9Sstevel@tonic-gate 
293*7c478bd9Sstevel@tonic-gate #endif /* defined(_KERNEL) || defined(_KMEMUSER) */
294*7c478bd9Sstevel@tonic-gate 
295*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_POLL_IMPL_H */
296