2010-11-04 00:46:47 +03:00
|
|
|
/*
|
2012-07-19 22:11:40 +04:00
|
|
|
* Copyright 2002-2012 Haiku, Inc. All Rights Reserved.
|
2010-11-04 00:46:47 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-10-28 21:46:30 +03:00
|
|
|
#ifndef _POLL_H
|
|
|
|
#define _POLL_H
|
2010-11-04 00:46:47 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2021-06-18 21:01:13 +03:00
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
|
2002-10-28 21:46:30 +03:00
|
|
|
typedef unsigned long nfds_t;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
struct pollfd {
|
2002-10-29 08:39:54 +03:00
|
|
|
int fd;
|
|
|
|
short events; /* events to look for */
|
|
|
|
short revents; /* events that occured */
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2002-10-29 06:36:14 +03:00
|
|
|
/* events & revents - compatible with the B_SELECT_xxx definitions in Drivers.h */
|
2002-10-28 21:46:30 +03:00
|
|
|
#define POLLIN 0x0001 /* any readable data available */
|
2002-10-29 06:36:14 +03:00
|
|
|
#define POLLOUT 0x0002 /* file descriptor is writeable */
|
|
|
|
#define POLLRDNORM POLLIN
|
2002-10-28 21:46:30 +03:00
|
|
|
#define POLLWRNORM POLLOUT
|
2002-10-29 06:36:14 +03:00
|
|
|
#define POLLRDBAND 0x0008 /* priority readable data */
|
|
|
|
#define POLLWRBAND 0x0010 /* priority data can be written */
|
|
|
|
#define POLLPRI 0x0020 /* high priority readable data */
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2002-10-28 21:46:30 +03:00
|
|
|
/* revents only */
|
2002-10-29 06:36:14 +03:00
|
|
|
#define POLLERR 0x0004 /* errors pending */
|
|
|
|
#define POLLHUP 0x0080 /* disconnected */
|
|
|
|
#define POLLNVAL 0x1000 /* invalid file descriptor */
|
2002-10-28 21:46:30 +03:00
|
|
|
|
|
|
|
|
2002-10-26 17:22:40 +04:00
|
|
|
#ifdef __cplusplus
|
2021-06-18 21:01:13 +03:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int poll(struct pollfd *fds, nfds_t numfds, int timeout);
|
|
|
|
extern int ppoll(struct pollfd *fds, nfds_t numfds,
|
|
|
|
const struct timespec *timeout, const sigset_t *sigMask);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2002-10-26 17:22:40 +04:00
|
|
|
#endif
|
2021-06-18 21:01:13 +03:00
|
|
|
|
|
|
|
|
2002-10-26 17:22:40 +04:00
|
|
|
|
2002-10-28 21:46:30 +03:00
|
|
|
#endif /* _POLL_H */
|