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