Merge pull request #729 from wtfrank/charting-submit
[mono.git] / mono / utils / mono-poll.h
1 #ifndef MONO_POLL_H
2 #define MONO_POLL_H
3
4 #include <mono/utils/mono-publib.h>
5
6 #include <config.h>
7 #ifdef HAVE_SYS_TIME_H
8 #include <sys/time.h>
9 #endif
10 #include <sys/types.h>
11 #ifdef HAVE_UNISTD_H
12 #include <unistd.h>
13 #endif
14
15 #ifdef HAVE_POLL
16 #include <sys/poll.h>
17
18 #define MONO_POLLIN             POLLIN
19 #define MONO_POLLPRI            POLLPRI
20 #define MONO_POLLOUT            POLLOUT
21 #define MONO_POLLERR            POLLERR
22 #define MONO_POLLHUP            POLLHUP
23 #define MONO_POLLNVAL           POLLNVAL
24
25 typedef struct pollfd mono_pollfd;
26
27 #else
28
29 #ifdef HOST_WIN32
30 #include <windows.h>
31 #endif
32 #define MONO_POLLIN             1
33 #define MONO_POLLPRI            2
34 #define MONO_POLLOUT            4
35 #define MONO_POLLERR            8
36 #define MONO_POLLHUP            0x10
37 #define MONO_POLLNVAL           0x20
38
39 typedef struct {
40         int fd;
41         short events;
42         short revents;
43 } mono_pollfd;
44
45 #endif
46
47 MONO_API int mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout);
48
49 #endif /* MONO_POLL_H */
50