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 | |
69077c19 |
13 | #if (defined(HAS_POLL) && defined(I_POLL)) || defined(POLLWRBAND) |
cf7fe8a2 |
14 | # include <poll.h> |
cf7fe8a2 |
15 | #else |
16 | #ifdef HAS_SELECT |
17 | |
18 | |
19 | /* We shall emulate poll using select */ |
20 | |
21 | #define EMULATE_POLL_WITH_SELECT |
22 | |
d2d53deb |
23 | #ifdef poll |
24 | # undef poll |
25 | #endif |
26 | #define poll Perl_my_poll |
27 | |
cf7fe8a2 |
28 | typedef struct pollfd { |
29 | int fd; |
30 | short events; |
31 | short revents; |
32 | } pollfd_t; |
33 | |
34 | #define POLLIN 0x0001 |
35 | #define POLLPRI 0x0002 |
36 | #define POLLOUT 0x0004 |
37 | #define POLLRDNORM 0x0040 |
38 | #define POLLWRNORM POLLOUT |
39 | #define POLLRDBAND 0x0080 |
40 | #define POLLWRBAND 0x0100 |
41 | #define POLLNORM POLLRDNORM |
42 | |
43 | /* Return ONLY events (NON testable) */ |
44 | |
45 | #define POLLERR 0x0008 |
46 | #define POLLHUP 0x0010 |
47 | #define POLLNVAL 0x0020 |
48 | |
20ce7b12 |
49 | int poll (struct pollfd *, unsigned long, int); |
cf7fe8a2 |
50 | |
51 | #ifndef HAS_POLL |
52 | # define HAS_POLL |
53 | #endif |
54 | |
55 | #endif /* HAS_SELECT */ |
56 | |
57 | #endif /* I_POLL */ |
58 | |
59 | #endif /* POLL_H */ |
60 | |