FreeTDS API: include/fakepoll.h Source File

FreeTDS API

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
fakepoll.h
Go to the documentation of this file.
1 /* $Id: fakepoll.h,v 1.5 2011-05-16 08:51:40 freddy77 Exp $ */
2
7 #if !defined(_FAKE_POLL_H) && !defined(HAVE_POLL)
8 #define _FAKE_POLL_H
9
10 #include <config.h>
11
12 #if HAVE_LIMITS_H
13 #include <limits.h>
14 #endif
15
16 #if HAVE_SYS_SELECT_H
17 #include <sys/select.h>
18 #endif
19
20 #if defined(_WIN32)
21 #include <winsock2.h>
22 #endif
23
24 #if defined(__VMS)
25 #include <time.h> /* FD_SETSIZE is in here */
26 #endif
27
28 #if !defined(FD_SETSIZE)
29 # if !defined(OPEN_MAX)
30 # error cannot establish FD_SETSIZE
31 # endif
32 #define FD_SETSIZE OPEN_MAX
33 #endif
34
35 #ifndef _WIN32
36 /* poll flags */
37 # define POLLIN 0x0001
38 # define POLLOUT 0x0004
39 # define POLLERR 0x0008
40
41 /* synonyms */
42 # define POLLNORM POLLIN
43 # define POLLPRI POLLIN
44 # define POLLRDNORM POLLIN
45 # define POLLRDBAND POLLIN
46 # define POLLWRNORM POLLOUT
47 # define POLLWRBAND POLLOUT
48
49 /* ignored */
50 # define POLLHUP 0x0010
51 # define POLLNVAL 0x0020
52 typedef struct pollfd {
53 int fd; /* file descriptor to poll */
54 short events; /* events of interest on fd */
55 short revents; /* events that occurred on fd */
56 } pollfd_t;
57
58 #else /* Windows */
59 /*
60 * Windows use different constants then Unix
61 * Newer version have a WSAPoll which is equal to Unix poll
62 */
63 # if !defined(POLLRDNORM) && !defined(POLLWRNORM)
64 # define POLLIN 0x0300
65 # define POLLOUT 0x0010
66 # define POLLERR 0x0001
67 # define POLLRDNORM 0x0100
68 # define POLLWRNORM 0x0010
69 typedef struct pollfd {
70 SOCKET fd; /* file descriptor to poll */
71 short events; /* events of interest on fd */
72 short revents; /* events that occurred on fd */
73 } pollfd_t;
74 # else
75 typedef struct pollfd pollfd_t;
76 # endif
77 #endif
78
79 int fakepoll(struct pollfd fds[], int nfds, int timeout);
80
81 #endif
pollfd
Definition: fakepoll.h:52