4 * poll(2) emulation for Windows
6 * This emulates just-enough poll functionality on Windows to work in the
7 * context of the openssl(1) program. This is not a replacement for
8 * POSIX.1-2001 poll(2).
10 * Dongsheng Song <dongsheng.song@gmail.com>
11 * Brent Cook <bcook@openbsd.org>
14 #ifndef LIBCRYPTOCOMPAT_POLL_H
15 #define LIBCRYPTOCOMPAT_POLL_H
18 #include_next <poll.h>
23 /* Type used for the number of file descriptors. */
24 typedef unsigned long int nfds_t;
26 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
27 /* Data structure describing a polling request. */
29 int fd; /* file descriptor */
30 short events; /* requested events */
31 short revents; /* returned events */
34 /* Event types that can be polled */
35 #define POLLIN 0x001 /* There is data to read. */
36 #define POLLPRI 0x002 /* There is urgent data to read. */
37 #define POLLOUT 0x004 /* Writing now will not block. */
39 # define POLLRDNORM 0x040 /* Normal data may be read. */
40 # define POLLRDBAND 0x080 /* Priority data may be read. */
41 # define POLLWRNORM 0x100 /* Writing now will not block. */
42 # define POLLWRBAND 0x200 /* Priority data may be written. */
44 /* Event types always implicitly polled. */
45 #define POLLERR 0x008 /* Error condition. */
46 #define POLLHUP 0x010 /* Hung up. */
47 #define POLLNVAL 0x020 /* Invalid polling request. */
55 int poll(struct pollfd *pfds, nfds_t nfds, int timeout);
61 #endif /* HAVE_POLL */
63 #endif /* LIBCRYPTOCOMPAT_POLL_H */