159290Sjlemon/*-
259290Sjlemon * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>
359290Sjlemon * All rights reserved.
459290Sjlemon *
559290Sjlemon * Redistribution and use in source and binary forms, with or without
659290Sjlemon * modification, are permitted provided that the following conditions
759290Sjlemon * are met:
859290Sjlemon * 1. Redistributions of source code must retain the above copyright
959290Sjlemon *    notice, this list of conditions and the following disclaimer.
1059290Sjlemon * 2. Redistributions in binary form must reproduce the above copyright
1159290Sjlemon *    notice, this list of conditions and the following disclaimer in the
1259290Sjlemon *    documentation and/or other materials provided with the distribution.
1359290Sjlemon *
1459290Sjlemon * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1559290Sjlemon * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1659290Sjlemon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1759290Sjlemon * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1859290Sjlemon * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1959290Sjlemon * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2059290Sjlemon * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2159290Sjlemon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2259290Sjlemon * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2359290Sjlemon * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2459290Sjlemon * SUCH DAMAGE.
2559290Sjlemon *
2659290Sjlemon *	$FreeBSD$
2759290Sjlemon */
2859290Sjlemon
2959290Sjlemon#ifndef _SYS_EVENTVAR_H_
3059290Sjlemon#define _SYS_EVENTVAR_H_
3159290Sjlemon
32133741Sjmg#ifndef _KERNEL
33133741Sjmg#error "no user-servicable parts inside"
34133741Sjmg#endif
35133741Sjmg
36133741Sjmg#include <sys/_task.h>
37133741Sjmg
3863452Sjlemon#define KQ_NEVENTS	8		/* minimize copy{in,out} calls */
3959290Sjlemon#define KQEXTENT	256		/* linear growth by this amount */
4059290Sjlemon
4159290Sjlemonstruct kqueue {
42133741Sjmg	struct		mtx kq_lock;
43133741Sjmg	int		kq_refcnt;
44255527Skib	TAILQ_ENTRY(kqueue)	kq_list;
45133741Sjmg	TAILQ_HEAD(, knote)	kq_head;	/* list of pending event */
4659290Sjlemon	int		kq_count;		/* number of pending events */
47132138Salfred	struct		selinfo kq_sel;
48132138Salfred	struct		sigio *kq_sigio;
4959290Sjlemon	struct		filedesc *kq_fdp;
5059290Sjlemon	int		kq_state;
5159290Sjlemon#define KQ_SEL		0x01
5259290Sjlemon#define KQ_SLEEP	0x02
53133741Sjmg#define KQ_FLUXWAIT	0x04			/* waiting for a in flux kn */
54133741Sjmg#define KQ_ASYNC	0x08
55133741Sjmg#define KQ_CLOSING	0x10
56133741Sjmg#define	KQ_TASKSCHED	0x20			/* task scheduled */
57133741Sjmg#define	KQ_TASKDRAIN	0x40			/* waiting for task to drain */
58133741Sjmg	int		kq_knlistsize;		/* size of knlist */
59133741Sjmg	struct		klist *kq_knlist;	/* list of knotes */
60133741Sjmg	u_long		kq_knhashmask;		/* size of knhash */
61133741Sjmg	struct		klist *kq_knhash;	/* hash table for knotes */
62133741Sjmg	struct		task kq_task;
6359290Sjlemon};
6459290Sjlemon
6559290Sjlemon#endif /* !_SYS_EVENTVAR_H_ */
66