FreeTDS API
Loading...
Searching...
No Matches
poll.h
Go to the documentation of this file.
1
5#if !defined(_tdsguard_g3Yr0q7NdWY6GI4uTB9PNx_) && !defined(HAVE_POLL)
6#define _tdsguard_g3Yr0q7NdWY6GI4uTB9PNx_
7
8#include <config.h>
9
10#if HAVE_LIMITS_H
11#include <limits.h>
12#endif
13
14#if HAVE_SYS_SELECT_H
15#include <sys/select.h>
16#endif
17
18#if defined(_WIN32)
19#include <winsock2.h>
20#endif
21
22#if defined(__VMS)
23#include <time.h> /* FD_SETSIZE is in here */
24#endif
25
26#if !defined(FD_SETSIZE)
27# if !defined(OPEN_MAX)
28# error cannot establish FD_SETSIZE
29# endif
30#define FD_SETSIZE OPEN_MAX
31#endif
32
33#include <freetds/pushvis.h>
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
52typedef 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 than 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 POLLHUP 0x0002
68# define POLLNVAL 0x0004
69# define POLLRDNORM 0x0100
70# define POLLWRNORM 0x0010
71typedef struct pollfd {
72 SOCKET fd; /* file descriptor to poll */
73 short events; /* events of interest on fd */
74 short revents; /* events that occurred on fd */
75} pollfd_t;
76# else
77typedef struct pollfd pollfd_t;
78# endif
79#endif
80
81#undef poll
82int tds_poll(struct pollfd fds[], size_t nfds, int timeout);
83#define poll(fds, nfds, timeout) tds_poll(fds, nfds, timeout)
84
85#include <freetds/popvis.h>
86
87#endif
Definition poll.h:52