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#include <signal.h> 10#include <sys/time.h> 11 12 13typedef unsigned long nfds_t; 14 15struct pollfd { 16 int fd; 17 short events; /* events to look for */ 18 short revents; /* events that occured */ 19}; 20 21/* events & revents - compatible with the B_SELECT_xxx definitions in Drivers.h */ 22#define POLLIN 0x0001 /* any readable data available */ 23#define POLLOUT 0x0002 /* file descriptor is writeable */ 24#define POLLRDNORM POLLIN 25#define POLLWRNORM POLLOUT 26#define POLLRDBAND 0x0008 /* priority readable data */ 27#define POLLWRBAND 0x0010 /* priority data can be written */ 28#define POLLPRI 0x0020 /* high priority readable data */ 29 30/* revents only */ 31#define POLLERR 0x0004 /* errors pending */ 32#define POLLHUP 0x0080 /* disconnected */ 33#define POLLNVAL 0x1000 /* invalid file descriptor */ 34 35 36#ifdef __cplusplus 37extern "C" { 38#endif 39 40extern int poll(struct pollfd *fds, nfds_t numfds, int timeout); 41extern int ppoll(struct pollfd *fds, nfds_t numfds, 42 const struct timespec *timeout, const sigset_t *sigMask); 43 44#ifdef __cplusplus 45} 46#endif 47 48 49 50#endif /* _POLL_H */ 51