This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta.pod: Move diagnostic in file
[perl5.git] / dist / IO / poll.h
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(HAS_POLL) && defined(I_POLL)) || defined(POLLWRBAND)
14 #  include <poll.h>
15 #elif (defined(HAS_POLL) && defined(I_SYS_POLL))
16 #  include <sys/poll.h>
17 #else
18 #ifdef HAS_SELECT
19
20
21 /* We shall emulate poll using select */
22
23 #define EMULATE_POLL_WITH_SELECT
24
25 #ifdef poll
26 # undef poll
27 #endif
28 #define poll Perl_my_poll
29
30 typedef struct pollfd {
31     int fd;
32     short events;
33     short revents;
34 } pollfd_t;
35
36 #define POLLIN          0x0001
37 #define POLLPRI         0x0002
38 #define POLLOUT         0x0004
39 #define POLLRDNORM      0x0040
40 #define POLLWRNORM      POLLOUT
41 #define POLLRDBAND      0x0080
42 #define POLLWRBAND      0x0100
43 #define POLLNORM        POLLRDNORM
44
45 /* Return ONLY events (NON testable) */
46
47 #define POLLERR         0x0008
48 #define POLLHUP         0x0010
49 #define POLLNVAL        0x0020
50
51 int poll (struct pollfd *, unsigned long, int);
52
53 #ifndef HAS_POLL
54 #  define HAS_POLL
55 #endif
56
57 #endif /* HAS_SELECT */
58
59 #endif /* I_POLL */
60
61 #endif /* POLL_H */
62