00001
00002 #if !defined(_FAKE_POLL_H) && !defined(HAVE_POLL)
00003 #define _FAKE_POLL_H
00004
00005 #if HAVE_CONFIG_H
00006 #include <config.h>
00007 #endif
00008
00009
00010 #if HAVE_LIMITS_H
00011 #include <limits.h>
00012 #endif
00013
00014 #if HAVE_SYS_SELECT_H
00015 #include <sys/select.h>
00016 #endif
00017
00018 #if defined(_WIN32)
00019 #include <winsock2.h>
00020 #endif
00021
00022 #if defined(__VMS)
00023 #include <time.h>
00024 #endif
00025
00026 #if !defined(FD_SETSIZE)
00027 # if !defined(OPEN_MAX)
00028 # error cannot establish FD_SETSIZE
00029 # endif
00030 #define FD_SETSIZE OPEN_MAX
00031 #endif
00032
00033 #ifndef _WIN32
00034
00035 # define POLLIN 0x0001
00036 # define POLLOUT 0x0004
00037 # define POLLERR 0x0008
00038
00039
00040 # define POLLNORM POLLIN
00041 # define POLLPRI POLLIN
00042 # define POLLRDNORM POLLIN
00043 # define POLLRDBAND POLLIN
00044 # define POLLWRNORM POLLOUT
00045 # define POLLWRBAND POLLOUT
00046
00047
00048 # define POLLHUP 0x0010
00049 # define POLLNVAL 0x0020
00050 typedef struct pollfd {
00051 int fd;
00052 short events;
00053 short revents;
00054 } pollfd_t;
00055
00056 #else
00057
00058
00059
00060
00061 # if !defined(POLLRDNORM) && !defined(POLLWRNORM)
00062 # define POLLIN 0x0300
00063 # define POLLOUT 0x0010
00064 # define POLLERR 0x0001
00065 # define POLLRDNORM 0x0100
00066 # define POLLWRNORM 0x0010
00067 typedef struct pollfd {
00068 SOCKET fd;
00069 short events;
00070 short revents;
00071 } pollfd_t;
00072 # else
00073 typedef struct pollfd pollfd_t;
00074 # endif
00075 #endif
00076
00077 int fakepoll(struct pollfd fds[], int nfds, int timeout);
00078
00079 #endif