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 | |
23 | typedef struct pollfd { |
24 | int fd; |
25 | short events; |
26 | short revents; |
27 | } pollfd_t; |
28 | |
29 | #define POLLIN 0x0001 |
30 | #define POLLPRI 0x0002 |
31 | #define POLLOUT 0x0004 |
32 | #define POLLRDNORM 0x0040 |
33 | #define POLLWRNORM POLLOUT |
34 | #define POLLRDBAND 0x0080 |
35 | #define POLLWRBAND 0x0100 |
36 | #define POLLNORM POLLRDNORM |
37 | |
38 | /* Return ONLY events (NON testable) */ |
39 | |
40 | #define POLLERR 0x0008 |
41 | #define POLLHUP 0x0010 |
42 | #define POLLNVAL 0x0020 |
43 | |
20ce7b12 |
44 | int poll (struct pollfd *, unsigned long, int); |
cf7fe8a2 |
45 | |
46 | #ifndef HAS_POLL |
47 | # define HAS_POLL |
48 | #endif |
49 | |
50 | #endif /* HAS_SELECT */ |
51 | |
52 | #endif /* I_POLL */ |
53 | |
54 | #endif /* POLL_H */ |
55 | |