xref: /haiku/headers/posix/poll.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _POLL_H
6 #define _POLL_H
7 
8 
9 typedef unsigned long nfds_t;
10 
11 struct pollfd {
12 	int		fd;
13 	short	events;		/* events to look for */
14 	short	revents;	/* events that occured */
15 };
16 
17 /* events & revents - compatible with the B_SELECT_xxx definitions in Drivers.h */
18 #define	POLLIN		0x0001		/* any readable data available */
19 #define	POLLOUT		0x0002		/* file descriptor is writeable */
20 #define	POLLRDNORM	POLLIN
21 #define	POLLWRNORM	POLLOUT
22 #define	POLLRDBAND	0x0008		/* priority readable data */
23 #define	POLLWRBAND	0x0010		/* priority data can be written */
24 #define	POLLPRI		0x0020		/* high priority readable data */
25 
26 /* revents only */
27 #define	POLLERR		0x0004		/* errors pending */
28 #define	POLLHUP		0x0080		/* disconnected */
29 #define	POLLNVAL	0x1000		/* invalid file descriptor */
30 
31 
32 extern
33 #ifdef __cplusplus
34 "C"
35 #endif
36 int poll(struct pollfd *fds, nfds_t numfds, int timeout);
37 
38 #endif /* _POLL_H */
39