Commit | Line | Data |
cf7fe8a2 |
1 | /* |
2 | * poll.h |
3 | * |
4 | * Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved. |
5 | * This program is free software; you can redistribute it and/or |
6 | * modify it under the same terms as Perl itself. |
7 | * |
8 | */ |
9 | |
10 | #ifndef POLL_H |
11 | # define POLL_H |
12 | |
13 | #if defined(I_POLL) || defined(POLLWRBAND) |
14 | # include <poll.h> |
15 | # ifndef HAS_POLL |
16 | # define HAS_POLL |
17 | # endif |
18 | #else |
19 | #ifdef HAS_SELECT |
20 | |
21 | |
22 | /* We shall emulate poll using select */ |
23 | |
24 | #define EMULATE_POLL_WITH_SELECT |
25 | |
26 | typedef struct pollfd { |
27 | int fd; |
28 | short events; |
29 | short revents; |
30 | } pollfd_t; |
31 | |
32 | #define POLLIN 0x0001 |
33 | #define POLLPRI 0x0002 |
34 | #define POLLOUT 0x0004 |
35 | #define POLLRDNORM 0x0040 |
36 | #define POLLWRNORM POLLOUT |
37 | #define POLLRDBAND 0x0080 |
38 | #define POLLWRBAND 0x0100 |
39 | #define POLLNORM POLLRDNORM |
40 | |
41 | /* Return ONLY events (NON testable) */ |
42 | |
43 | #define POLLERR 0x0008 |
44 | #define POLLHUP 0x0010 |
45 | #define POLLNVAL 0x0020 |
46 | |
47 | int poll _((struct pollfd *, unsigned long, int)); |
48 | |
49 | #ifndef HAS_POLL |
50 | # define HAS_POLL |
51 | #endif |
52 | |
53 | #endif /* HAS_SELECT */ |
54 | |
55 | #endif /* I_POLL */ |
56 | |
57 | #endif /* POLL_H */ |
58 | |