Skip to contentSkip to conversation

Fix build on Windows

PATCH In review Johannes Sixt 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix build on Windows

This adds the necessary #defines so that the programs can be built, but since the poll emulation is not extended to support POLLOUT and POLLNVAL, the resulting programs will most likely not function properly. (The test does not check them, yet.)

---
 compat/mingw.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
compat/mingw.h +5 -0
index 3b2477b..f27a7b6 100644
@@ -23,6 +23,9 @@ typedef int pid_t;
 #define WEXITSTATUS(x) ((x) & 0xff)
 #define WTERMSIG(x) SIGTERM
 
+#define EWOULDBLOCK EAGAIN
+#define SHUT_WR SD_SEND
+
 #define SIGHUP 1
 #define SIGQUIT 3
 #define SIGKILL 9
@@ -50,6 +53,8 @@ struct pollfd {
 };
 #define POLLIN 1
 #define POLLHUP 2
+#define POLLOUT 4
+#define POLLNVAL 8
 #endif
 
 typedef void (__cdecl *sig_handler_t)(int);
Signature · 1 line
1.7.1.402.gf1eeb
#1 lore raw
Quoted 4 lines · Johannes Sixt

This adds the necessary #defines so that the programs can be built, but since the poll emulation is not extended to support POLLOUT and POLLNVAL, the resulting programs will most likely not function properly. (The test does not check them, yet.)

The code doesn't really need POLLNVAL (Its just there for "can't happen" case). POLLOUT is needed. I looked at poll emulation code: It returning EINVAL causes transfer loop to fail quick.

I think its possible to write the loop in terms of select instead of poll. Would this be better for Git on Windows?

-Ilari

#2 lore raw
Quoted 6 lines · Ilari Liusvaara

The code doesn't really need POLLNVAL (Its just there for "can't happen" case). POLLOUT is needed. I looked at poll emulation code: It returning EINVAL causes transfer loop to fail quick.

I think its possible to write the loop in terms of select instead of poll. Would this be better for Git on Windows?

No. select does not work with pipes on Windows.

-- Hannes