FreeTDS API: include/freetds/replacements/poll.h Source File

FreeTDS API

Loading...
Searching...
No Matches
poll.h
Go to the documentation of this file.
1
4
5#if !defined(_tdsguard_g3Yr0q7NdWY6GI4uTB9PNx_) && !defined(HAVE_POLL)
6#define _tdsguard_g3Yr0q7NdWY6GI4uTB9PNx_
7
8#include <freetds/pushvis.h>
9
10#ifndef _WIN32
11/* poll flags */
12# define POLLIN 0x0001
13# define POLLOUT 0x0004
14# define POLLERR 0x0008
15
16/* synonyms */
17# define POLLNORM POLLIN
18# define POLLPRI POLLIN
19# define POLLRDNORM POLLIN
20# define POLLRDBAND POLLIN
21# define POLLWRNORM POLLOUT
22# define POLLWRBAND POLLOUT
23
24/* ignored */
25# define POLLHUP 0x0010
26# define POLLNVAL 0x0020
27 typedef struct pollfd {
28 int fd; /* file descriptor to poll */
29 short events; /* events of interest on fd */
30 short revents; /* events that occurred on fd */
31} pollfd_t;
32
33#else /* Windows */
34/*
35 * Windows use different constants than Unix
36 * Newer version have a WSAPoll which is equal to Unix poll
37 */
38# if !defined(POLLRDNORM) && !defined(POLLWRNORM)
39# define POLLIN 0x0300
40# define POLLOUT 0x0010
41# define POLLERR 0x0001
42# define POLLHUP 0x0002
43# define POLLNVAL 0x0004
44# define POLLRDNORM 0x0100
45# define POLLWRNORM 0x0010
46typedef struct pollfd {
47 SOCKET fd; /* file descriptor to poll */
48 short events; /* events of interest on fd */
49 short revents; /* events that occurred on fd */
50} pollfd_t;
51# else
52typedef struct pollfd pollfd_t;
53# endif
54#endif
55
56#undef poll
57int tds_poll(struct pollfd fds[], size_t nfds, int timeout);
58#define poll(fds, nfds, timeout) tds_poll(fds, nfds, timeout)
59
60#include <freetds/popvis.h>
61
62#endif
pollfd
Definition poll.h:27