* [PATCH] Fixed compilation with Visual Studio by including poll.h
@ 2012-04-20 20:37 Sven Strickroth
2012-04-20 20:47 ` Jeff King
0 siblings, 1 reply; 6+ messages in thread
From: Sven Strickroth @ 2012-04-20 20:37 UTC (permalink / raw)
To: git; +Cc: gitster
upload-archive.c and upload-pack.c use pollfd struct and POLLIN constant
which are defined in poll.h. However, poll.h is not included.
Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
builtin/upload-archive.c | 1 +
upload-pack.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c
index b928beb..6226bbb 100644
--- a/builtin/upload-archive.c
+++ b/builtin/upload-archive.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 2006 Franck Bui-Huu
*/
+#include "poll.h"
#include "cache.h"
#include "builtin.h"
#include "archive.h"
diff --git a/upload-pack.c b/upload-pack.c
index bb08e2e..79f9f8f 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1,3 +1,4 @@
+#include "poll.h"
#include "cache.h"
#include "refs.h"
#include "pkt-line.h"
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Fixed compilation with Visual Studio by including poll.h
2012-04-20 20:37 [PATCH] Fixed compilation with Visual Studio by including poll.h Sven Strickroth
@ 2012-04-20 20:47 ` Jeff King
2012-04-20 21:26 ` Sven Strickroth
2012-04-20 21:51 ` Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Jeff King @ 2012-04-20 20:47 UTC (permalink / raw)
To: Sven Strickroth; +Cc: git, gitster
On Fri, Apr 20, 2012 at 10:37:19PM +0200, Sven Strickroth wrote:
> upload-archive.c and upload-pack.c use pollfd struct and POLLIN constant
> which are defined in poll.h. However, poll.h is not included.
This should already be included by git-compat-util.h:
$ grep -C1 poll.h git-compat-util.h
#ifndef NO_SYS_POLL_H
#include <sys/poll.h>
#else
#include <poll.h>
#endif
It looks like we will prefer sys/poll.h if it exists. The official XSI
location is "poll.h", but I guess in practice they are equivalent on
most systems if you have both (certainly on Linux, poll.h just includes
sys/poll.h).
Does your environments have a sys/poll.h that exists isn't sufficient to
use poll? Maybe we need to tweak git-compat-util to include both if they
both exist.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fixed compilation with Visual Studio by including poll.h
2012-04-20 20:47 ` Jeff King
@ 2012-04-20 21:26 ` Sven Strickroth
2012-04-20 21:58 ` Erik Faye-Lund
2012-04-20 21:51 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Sven Strickroth @ 2012-04-20 21:26 UTC (permalink / raw)
To: Jeff King; +Cc: git
Windows does not have sys/poll.h. I have to use the one from compat/win32.
The problem is that
NO_SYS_POLL_H
is defined in compat/msvc.h in my environment.
And in git-compat-util.h
#ifndef NO_SYS_POLL_H
#include <sys/poll.h>
#else
#include <poll.h>
#endif
is before
#elif defined(_MSC_VER)
#include "compat/msvc.h"
. Moving it down, solves the issue for me. (Suppose this is a fix for my
scenario only).
diff --git a/git-compat-util.h b/git-compat-util.h
index ed11ad8..a96849c 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -111,11 +111,6 @@
#include <regex.h>
#include <utime.h>
#include <syslog.h>
-#ifndef NO_SYS_POLL_H
-#include <sys/poll.h>
-#else
-#include <poll.h>
-#endif
#if defined(__MINGW32__)
/* pull in Windows compatibility stuff */
#include "compat/mingw.h"
@@ -152,6 +147,11 @@
#define _ALL_SOURCE 1
#endif
#endif
+#ifndef NO_SYS_POLL_H
+#include <sys/poll.h>
+#else
+#include <poll.h>
+#endif
#ifndef NO_LIBGEN_H
#include <libgen.h>
--
Best regards,
Sven Strickroth
ClamAV, a GPL anti-virus toolkit http://www.clamav.net
PGP key id F5A9D4C4 @ any key-server
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Fixed compilation with Visual Studio by including poll.h
2012-04-20 20:47 ` Jeff King
2012-04-20 21:26 ` Sven Strickroth
@ 2012-04-20 21:51 ` Junio C Hamano
2012-04-20 23:23 ` Jeff King
1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2012-04-20 21:51 UTC (permalink / raw)
To: Jeff King; +Cc: Sven Strickroth, git
Jeff King <peff@peff.net> writes:
> On Fri, Apr 20, 2012 at 10:37:19PM +0200, Sven Strickroth wrote:
>
>> upload-archive.c and upload-pack.c use pollfd struct and POLLIN constant
>> which are defined in poll.h. However, poll.h is not included.
>
> This should already be included by git-compat-util.h:
Thanks for a bit of sanity.
> $ grep -C1 poll.h git-compat-util.h
> #ifndef NO_SYS_POLL_H
> #include <sys/poll.h>
> #else
> #include <poll.h>
> #endif
>
> It looks like we will prefer sys/poll.h if it exists. The official XSI
> location is "poll.h", but I guess in practice they are equivalent on
> most systems if you have both (certainly on Linux, poll.h just includes
> sys/poll.h).
There actually is no preference between the two from _our_ side. It is
up to the builder to know and define necessary make variables.
> Does your environments have a sys/poll.h that exists isn't sufficient to
> use poll? Maybe we need to tweak git-compat-util to include both if they
> both exist.
Both? I guess, but I suspect that on most sane systems one would
include the other if there are both provided (iow, just so that you can
complile sources written both for XSI and for systems in the field).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fixed compilation with Visual Studio by including poll.h
2012-04-20 21:26 ` Sven Strickroth
@ 2012-04-20 21:58 ` Erik Faye-Lund
0 siblings, 0 replies; 6+ messages in thread
From: Erik Faye-Lund @ 2012-04-20 21:58 UTC (permalink / raw)
To: Sven Strickroth; +Cc: Jeff King, git
On Fri, Apr 20, 2012 at 11:26 PM, Sven Strickroth
<sven.strickroth@tu-clausthal.de> wrote:
> Windows does not have sys/poll.h. I have to use the one from compat/win32.
>
> The problem is that
> NO_SYS_POLL_H
> is defined in compat/msvc.h in my environment.
> And in git-compat-util.h
> #ifndef NO_SYS_POLL_H
> #include <sys/poll.h>
> #else
> #include <poll.h>
> #endif
> is before
> #elif defined(_MSC_VER)
> #include "compat/msvc.h"
> . Moving it down, solves the issue for me. (Suppose this is a fix for my
> scenario only).
>
NO_SYS_POLL_H shouldn't be defined in compat/msvc.h, it should be
defined by the build-system. Our Makefile already does this inside the
"ifeq ($(uname_S),Windows)"-block.
How are you building Git?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fixed compilation with Visual Studio by including poll.h
2012-04-20 21:51 ` Junio C Hamano
@ 2012-04-20 23:23 ` Jeff King
0 siblings, 0 replies; 6+ messages in thread
From: Jeff King @ 2012-04-20 23:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sven Strickroth, git
On Fri, Apr 20, 2012 at 02:51:58PM -0700, Junio C Hamano wrote:
> > It looks like we will prefer sys/poll.h if it exists. The official XSI
> > location is "poll.h", but I guess in practice they are equivalent on
> > most systems if you have both (certainly on Linux, poll.h just includes
> > sys/poll.h).
>
> There actually is no preference between the two from _our_ side. It is
> up to the builder to know and define necessary make variables.
I say "prefer" only because if you set nothing, you get "sys/poll.h". So
it is up to the builder to say "no, I do not have that non-standard
location. Use the standard one instead". Which seems a little backwards.
Of course "standard" here is just what POSIX says; sys/poll.h may be
much more standard in the real world (I don't know).
> > Does your environments have a sys/poll.h that exists isn't sufficient to
> > use poll? Maybe we need to tweak git-compat-util to include both if they
> > both exist.
>
> Both? I guess, but I suspect that on most sane systems one would
> include the other if there are both provided (iow, just so that you can
> complile sources written both for XSI and for systems in the field).
I would think one or the other would be fine. But the fact that Sven's
patch works makes me think that he has sys/poll.h, but it is not
sufficient. Hopefully including "poll.h" would be enough, but it's not
clear to me.
-Peff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-20 23:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20 20:37 [PATCH] Fixed compilation with Visual Studio by including poll.h Sven Strickroth
2012-04-20 20:47 ` Jeff King
2012-04-20 21:26 ` Sven Strickroth
2012-04-20 21:58 ` Erik Faye-Lund
2012-04-20 21:51 ` Junio C Hamano
2012-04-20 23:23 ` Jeff King
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 NNTP newsgroup(s).