From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 1/3] compat/poll: prepare for targeting Windows Vista
Date: Wed, 03 Oct 2018 12:43:41 -0700 (PDT) [thread overview]
Message-ID: <1c2dba41189e97c2dfa7d98da3b52589eb9091cc.1538595818.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.44.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>
Windows Vista (and later) actually have a working poll(), but we still
cannot use it because it only works on sockets.
So let's detect when we are targeting Windows Vista and undefine those
constants, and define `pollfd` so that we can declare our own pollfd
struct.
We also need to make sure that we override those constants *after*
`winsock2.h` has been `#include`d (otherwise we would not really
override those constants).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
compat/poll/poll.c | 6 +++---
compat/poll/poll.h | 15 +++++++++++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index 7ed3fbbea1..ad5dcde439 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -29,9 +29,6 @@
#include <sys/types.h>
-/* Specification. */
-#include <poll.h>
-
#include <errno.h>
#include <limits.h>
#include <assert.h>
@@ -55,6 +52,9 @@
# include <unistd.h>
#endif
+/* Specification. */
+#include "poll.h"
+
#ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h>
#endif
diff --git a/compat/poll/poll.h b/compat/poll/poll.h
index cd1995292a..1e1597360f 100644
--- a/compat/poll/poll.h
+++ b/compat/poll/poll.h
@@ -21,6 +21,21 @@
#ifndef _GL_POLL_H
#define _GL_POLL_H
+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
+/* Vista has its own, socket-only poll() */
+#undef POLLIN
+#undef POLLPRI
+#undef POLLOUT
+#undef POLLERR
+#undef POLLHUP
+#undef POLLNVAL
+#undef POLLRDNORM
+#undef POLLRDBAND
+#undef POLLWRNORM
+#undef POLLWRBAND
+#define pollfd compat_pollfd
+#endif
+
/* fake a poll(2) environment */
#define POLLIN 0x0001 /* any readable data available */
#define POLLPRI 0x0002 /* OOB/Urgent readable data */
--
gitgitgadget
next prev parent reply other threads:[~2018-10-03 19:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 19:43 [PATCH 0/3] mingw: require Windows Vista or later (and fix the Windows CI builds) Johannes Schindelin via GitGitGadget
2018-10-03 19:43 ` Johannes Schindelin via GitGitGadget [this message]
2018-10-03 19:43 ` [PATCH 2/3] mingw: set _WIN32_WINNT explicitly for Git for Windows Johannes Schindelin via GitGitGadget
2018-10-03 19:43 ` [PATCH 3/3] mingw: bump the minimum Windows version to Vista Johannes Schindelin via GitGitGadget
2018-10-10 14:08 ` Ævar Arnfjörð Bjarmason
2018-10-11 6:24 ` Junio C Hamano
2019-10-14 11:46 ` Johannes Schindelin
2019-10-14 11:58 ` Johannes Schindelin
2019-10-14 11:54 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c2dba41189e97c2dfa7d98da3b52589eb9091cc.1538595818.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).