From 4bb5bc44011e2920e6dc181e848c5f5e1a7ff81d Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Tue, 9 Jul 2019 18:02:59 +0200 Subject: [PATCH] Add Windows WSAPool declaration, associated struct and constants. It allows 100% poll compatible POSIX API on Windows. --- win32/include/winapi/winsock2.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/win32/include/winapi/winsock2.h b/win32/include/winapi/winsock2.h index 6fd33106..365ace64 100644 --- a/win32/include/winapi/winsock2.h +++ b/win32/include/winapi/winsock2.h @@ -1428,6 +1428,29 @@ extern "C" { #define WSAGETSELECTEVENT(lParam) LOWORD(lParam) #define WSAGETSELECTERROR(lParam) HIWORD(lParam) +/* #if (_WIN32_WINNT >= 0x0600) */ +#define POLLRDNORM 0x0100 +#define POLLRDBAND 0x0200 +#define POLLIN (POLLRDNORM | POLLRDBAND) +#define POLLPRI 0x0400 + +#define POLLWRNORM 0x0010 +#define POLLOUT (POLLWRNORM) +#define POLLWRBAND 0x0020 + +#define POLLERR 0x0001 +#define POLLHUP 0x0002 +#define POLLNVAL 0x0004 + +typedef struct pollfd { + SOCKET fd; + SHORT events; + SHORT revents; +} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD; + +WINSOCK_API_LINKAGE int WSAAPI WSAPoll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout); +/* #endif // (_WIN32_WINNT >= 0x0600) */ + #ifdef __cplusplus } #endif