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