2010-02-13 Jb Evain <jbevain@novell.com>
[mono-project.git] / mono / utils / mono-poll.h
blob1d4c82afa5f8e09a1f56dd5afc3001a60b994800
1 #ifndef MONO_POLL_H
2 #define MONO_POLL_H
4 #include <config.h>
5 #ifdef HAVE_SYS_TIME_H
6 #include <sys/time.h>
7 #endif
8 #include <sys/types.h>
9 #ifdef HAVE_UNISTD_H
10 #include <unistd.h>
11 #endif
13 #ifdef HAVE_POLL
14 #include <sys/poll.h>
16 #define MONO_POLLIN POLLIN
17 #define MONO_POLLPRI POLLPRI
18 #define MONO_POLLOUT POLLOUT
19 #define MONO_POLLERR POLLERR
20 #define MONO_POLLHUP POLLHUP
21 #define MONO_POLLNVAL POLLNVAL
23 typedef struct pollfd mono_pollfd;
25 #else
27 #ifdef HOST_WIN32
28 #include <windows.h>
29 #endif
30 #define MONO_POLLIN 1
31 #define MONO_POLLPRI 2
32 #define MONO_POLLOUT 4
33 #define MONO_POLLERR 8
34 #define MONO_POLLHUP 0x10
35 #define MONO_POLLNVAL 0x20
37 typedef struct {
38 int fd;
39 short events;
40 short revents;
41 } mono_pollfd;
43 #endif
45 int mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout);
47 #endif /* MONO_POLL_H */