summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2023-05-12 20:48:31 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2023-05-13 16:42:04 +0100
commit9908c076ab3fafa18f00c866840819d52bc6b00f (patch)
tree8bad59cda6291f9d0d68bae8b262b907522d8052
parent94f98400bf950aa9835ff9b04c724f2aa3ebd0fc (diff)
downloadlibgit2-9908c076ab3fafa18f00c866840819d52bc6b00f.tar.gz
posix: use WSAPoll on win32
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/util/git2_features.h.in1
-rw-r--r--src/util/posix.h3
3 files changed, 10 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a00ab600a..e9de94b52 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -89,8 +89,12 @@ check_function_exists(getloadavg GIT_RAND_GETLOADAVG)
# poll
-check_symbol_exists(poll poll.h GIT_IO_POLL)
-check_symbol_exists(select sys/select.h GIT_IO_SELECT)
+if(WIN32)
+ set(GIT_IO_WSAPOLL 1)
+else()
+ check_symbol_exists(poll poll.h GIT_IO_POLL)
+ check_symbol_exists(select sys/select.h GIT_IO_SELECT)
+endif()
# determine architecture of the machine
diff --git a/src/util/git2_features.h.in b/src/util/git2_features.h.in
index cf955122c..a84ea8956 100644
--- a/src/util/git2_features.h.in
+++ b/src/util/git2_features.h.in
@@ -62,6 +62,7 @@
#cmakedefine GIT_RAND_GETLOADAVG 1
#cmakedefine GIT_IO_POLL 1
+#cmakedefine GIT_IO_WSAPOLL 1
#cmakedefine GIT_IO_SELECT 1
#endif
diff --git a/src/util/posix.h b/src/util/posix.h
index f516bb3cc..74707453a 100644
--- a/src/util/posix.h
+++ b/src/util/posix.h
@@ -198,6 +198,9 @@ extern const char *p_gai_strerror(int ret);
#ifdef GIT_IO_POLL
# include <poll.h>
# define p_poll poll
+#elif GIT_IO_WSAPOLL
+# include <winsock2.h>
+# define p_poll WSAPoll
#else
# define POLLIN 0x01
# define POLLPRI 0x02