git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH v2] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact

From
Joachim Schmitz <jojo@schmitz-digital.de>
Date
Sep 4, 2012, 11:49 UTC
Message-ID
<002701cd8a93$50773e30$f165ba90$@schmitz-digital.de>
In-Reply-To
<7vboi0yswz.fsf@alter.siamese.dyndns.org>
Show 17 quoted lines
> From: Junio C Hamano [mailto:gitster@pobox.com]
> Sent: Friday, August 24, 2012 9:47 PM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org; 'Erik Faye-Lund'
> Subject: Re: [PATCH v2] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact
> 
> "Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> 
> > Different, but related question: would poll.[ch] be allowed to #include "git-compat-util.h"?
> 
> Seeing other existing generic wrappers directly under compat/,
> e.g. fopen.c, mkdtemp.c, doing so, I would say why not.
> 
> Windows folks (I see Erik is already CC'ed, which is good ;-),
> please work with Joachim to make sure such a move won't break your
> builds.  I believe that it should just be the matter of updating a
> couple of paths in the top-level Makefile.
Haven't heard anything from the Windows folks yet.

I'd prefer to move compat/win32/poll.[ch] into compat/poll. Then adjust a few paths in Makefile and that would be the 1st patch

A 2nd patch would be my already proposed ones that make this usable for others (me in this case ;-)), namely wrapping 2 #inludes.
diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index 403eaa7..49541f1 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -24,7 +24,9 @@
 # pragma GCC diagnostic ignored "-Wtype-limits"
 #endif

-#include <malloc.h>
+#if defined(WIN32)
+# include <malloc.h>
+#endif

 #include <sys/types.h>

@@ -48,7 +50,9 @@
 #else
 # include <sys/time.h>
 # include <sys/socket.h>
-# include <sys/select.h>
+# ifndef NO_SYS_SELECT_H
+#  include <sys/select.h>
+# endif
 # include <unistd.h>
 #endif

--
1.7.12
Previous: Junio C Hamano
Message 5 of 5 in “RE: [PATCH v2] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact”
  1. Joachim SchmitzAug 24, 2012
  2. Junio C HamanoAug 24, 2012
  3. Joachim SchmitzAug 24, 2012
  4. Junio C HamanoAug 24, 2012
  5. Joachim SchmitzSep 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.