#ifndef _SYS_POLL_H_
#define _SYS_POLL_H_

struct pollfd {
	int	fd;		/* file descriptor being polled */
	short	events;		/* events requested */
	short	revents;	/* events returned */
};

#define	POLLIN		0x0001	/* any normal priority msg arrived */
#define	POLLRDNORM	0x0040	/* normal data arrived */
#define	POLLPRI		0x0002	/* priority msg arrived */
#define	POLLOUT		0x0004	/* normal data can now be sent */
#define	POLLWRNORM	POLLOUT	
#define	POLLRDBAND	0x0080	/* out-of-band data arrived */
#define	POLLWRBAND	0x0100	/* out-of-band data can be written */

struct pollhead;

struct polldat {
	struct polldat	*pd_next;	/* next in list */
	struct polldat	*pd_prev;	/* previous in list */
	struct polldat	*pd_chain;	/* others in this call */
	short		pd_events;	/* events we are looking for */
	struct pollhead	*pd_headp;	/* back-pointer to pollhead */
	void		(*pd_fn)();	/* function to call when event occurs */
	long		pd_arg;		/* argument to pass to function */
};

struct pollhead {
	struct polldat	*ph_list;
	struct polldat	*ph_dummy;
	short		ph_events;
	short		filler[11];
};

#endif
