-
Notifications
You must be signed in to change notification settings - Fork 1
/
poll.h
69 lines (51 loc) · 1.27 KB
/
poll.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* poll.h
*
* Copyright (c) 1997-8 Graham Barr <[email protected]>. All rights reserved.
* This program is free software; you can redistribute it and/or
* modify it under the same terms as Perl itself.
*
*/
#ifndef POLL_H
# define POLL_H
#if (defined(HAS_POLL) && defined(I_POLL)) || (defined(POLLWRBAND) && !defined(_WIN32))
# include <poll.h>
#elif (defined(HAS_POLL) && defined(I_SYS_POLL))
# include <sys/poll.h>
#else
#ifdef HAS_SELECT
/* We shall emulate poll using select */
#define EMULATE_POLL_WITH_SELECT
#ifdef _WIN32
# include <winsock2.h>
#endif
#ifdef poll
# undef poll
#endif
#define poll Perl_my_poll
#if WINVER < 0x0600
typedef struct pollfd {
int fd;
short events;
short revents;
} pollfd_t;
#define POLLIN 0x0001
#define POLLPRI 0x0002
#define POLLOUT 0x0004
#define POLLRDNORM 0x0040
#define POLLWRNORM POLLOUT
#define POLLRDBAND 0x0080
#define POLLWRBAND 0x0100
#define POLLNORM POLLRDNORM
/* Return ONLY events (NON testable) */
#define POLLERR 0x0008
#define POLLHUP 0x0010
#define POLLNVAL 0x0020
#endif
int poll (struct pollfd *, unsigned long, int);
#ifndef HAS_POLL
# define HAS_POLL
#endif
#endif /* HAS_SELECT */
#endif /* I_POLL */
#endif /* POLL_H */