{"thread":{"id":"31317","subject":"[PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","startedAt":"2012-08-22T15:15:07Z","lastAt":"2012-08-22T19:59:03Z","messageCount":5,"participants":["Joachim Schmitz","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"197586","messageId":"002101cd8078$eb2eb4f0$c18c1ed0$@schmitz-digital.de","threadId":"31317","inReplyTo":null,"subject":"[PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-22T15:15:07Z","receivedAt":"2012-08-22T15:15:07Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n Makefile            | 18 ++++++++++++++----\n compat/win32/poll.c |  8 ++++++--\n 2 files changed, 20 insertions(+), 6 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 6b0c961..2af4db3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -152,6 +152,11 @@ all::\n #\n # Define NO_MMAP if you want to avoid mmap.\n #\n+# Define NO_SYS_POLL_H if you don't have sys/poll.h.\n+#\n+# Define NO_POLL if you do not have or do not want to use poll.\n+# This also implies NO_SYS_POLL_H.\n+#\n # Define NO_PTHREADS if you do not have or do not want to use Pthreads.\n #\n # Define NO_PREAD if you have a problem with pread() system call (e.g.\n@@ -1216,7 +1221,7 @@ ifeq ($(uname_S),Windows)\n        NO_PREAD = YesPlease\n        NEEDS_CRYPTO_WITH_SSL = YesPlease\n        NO_LIBGEN_H = YesPlease\n-       NO_SYS_POLL_H = YesPlease\n+       NO_POLL = YesPlease\n        NO_SYMLINK_HEAD = YesPlease\n        NO_IPV6 = YesPlease\n        NO_UNIX_SOCKETS = YesPlease\n@@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)\n        BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild\n-Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H\n-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE\n        COMPAT_OBJS = compat/msvc.o compat/winansi.o \\\n                compat/win32/pthread.o compat/win32/syslog.o \\\n-               compat/win32/poll.o compat/win32/dirent.o\n+               compat/win32/dirent.o\n        COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H\n-DHAVE_ALLOCA_H -Icompat -Icompat/regex -Icompat/win32\n-DSTRIP_EXTENSION=\\\".exe\\\"\n        BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE\n-NODEFAULTLIB:MSVCRT.lib\n        EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib\n@@ -1312,7 +1317,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n        NO_PREAD = YesPlease\n        NEEDS_CRYPTO_WITH_SSL = YesPlease\n        NO_LIBGEN_H = YesPlease\n-       NO_SYS_POLL_H = YesPlease\n+       NO_POLL = YesPlease\n        NO_SYMLINK_HEAD = YesPlease\n        NO_UNIX_SOCKETS = YesPlease\n        NO_SETENV = YesPlease\n@@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n        COMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n                compat/win32/pthread.o compat/win32/syslog.o \\\n-               compat/win32/poll.o compat/win32/dirent.o\n+               compat/win32/dirent.o\n        EXTLIBS += -lws2_32\n        PTHREAD_LIBS =\n        X = .exe\n@@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT\n        BASIC_CFLAGS += -DNO_GETTEXT\n        USE_GETTEXT_SCHEME ?= fallthrough\n endif\n+ifdef NO_POLL\n+       NO_SYS_POLL_H = YesPlease\n+       COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h\n+       COMPAT_OBJS += compat/win32/poll.c\n+endif\n ifdef NO_STRCASESTR\n        COMPAT_CFLAGS += -DNO_STRCASESTR\n        COMPAT_OBJS += compat/strcasestr.o\ndiff --git a/compat/win32/poll.c b/compat/win32/poll.c\nindex 403eaa7..49541f1 100644\n--- a/compat/win32/poll.c\n+++ b/compat/win32/poll.c\n@@ -24,7 +24,9 @@\n # pragma GCC diagnostic ignored \"-Wtype-limits\"\n #endif\n\n-#include <malloc.h>\n+#if defined(WIN32)\n+# include <malloc.h>\n+#endif\n\n #include <sys/types.h>\n\n@@ -48,7 +50,9 @@\n #else\n # include <sys/time.h>\n # include <sys/socket.h>\n-# include <sys/select.h>\n+# ifndef NO_SYS_SELECT_H\n+#  include <sys/select.h>\n+# endif\n # include <unistd.h>\n #endif\n\n--\n1.7.12\n\nHP NonStop is using this, patch to add this is to follow.\n\nBye, Jojo\n"},{"id":"197598","messageId":"7vd32ialzo.fsf@alter.siamese.dyndns.org","threadId":"31317","inReplyTo":"002101cd8078$eb2eb4f0$c18c1ed0$@schmitz-digital.de","subject":"Re: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-22T17:13:15Z","receivedAt":"2012-08-22T17:13:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n\n> Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n> ---\n>  Makefile            | 18 ++++++++++++++----\n>  compat/win32/poll.c |  8 ++++++--\n>  2 files changed, 20 insertions(+), 6 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 6b0c961..2af4db3 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -152,6 +152,11 @@ all::\n>  #\n>  # Define NO_MMAP if you want to avoid mmap.\n>  #\n> +# Define NO_SYS_POLL_H if you don't have sys/poll.h.\n> +#\n> +# Define NO_POLL if you do not have or do not want to use poll.\n> +# This also implies NO_SYS_POLL_H.\n\nDo you really need to have both?  I suspect \"If you do not have a\nusable sys/poll.h, set NO_SYS_POLL_H\" may be a simpler alternative,\nbut there must be a reason why you had to add a new one instead of\ngoing that route.  It would be a good idea to describe that reason\nin the log message above, in the space before your Sign-off.\n\n> @@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)\n>         BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild\n> -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H\n> -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE\n>         COMPAT_OBJS = compat/msvc.o compat/winansi.o \\\n>                 compat/win32/pthread.o compat/win32/syslog.o \\\n> -               compat/win32/poll.o compat/win32/dirent.o\n> +               compat/win32/dirent.o\n>         COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H\n> ...\n> @@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n>         COMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n>         COMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n>                 compat/win32/pthread.o compat/win32/syslog.o \\\n> -               compat/win32/poll.o compat/win32/dirent.o\n> +               compat/win32/dirent.o\n>         EXTLIBS += -lws2_32\n> ...\n> @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT\n> ...\n> +ifdef NO_POLL\n> +       NO_SYS_POLL_H = YesPlease\n> +       COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h\n> +       COMPAT_OBJS += compat/win32/poll.c\n> +endif\n\nIn general, I think this is a good direction to go.  If the existing\nemulation in win32/poll.c turns out to be usable across platforms\nand not windows specific, sharing it would be a good idea.\n\nBut if the emulation is no longer windows specific, shouldn't you\nalso move it outside compat/win32/ and somewhere more generic?\n\n> diff --git a/compat/win32/poll.c b/compat/win32/poll.c\n> index 403eaa7..49541f1 100644\n> --- a/compat/win32/poll.c\n> +++ b/compat/win32/poll.c\n> @@ -24,7 +24,9 @@\n>  # pragma GCC diagnostic ignored \"-Wtype-limits\"\n>  #endif\n>\n> -#include <malloc.h>\n> +#if defined(WIN32)\n> +# include <malloc.h>\n> +#endif\n\nHrm, are the Windows folks OK with this?  MINGW and MSVC are\naffected; Cygwin should be OK, I think.\n\n>  #include <sys/types.h>\n>\n> @@ -48,7 +50,9 @@\n>  #else\n>  # include <sys/time.h>\n>  # include <sys/socket.h>\n> -# include <sys/select.h>\n> +# ifndef NO_SYS_SELECT_H\n> +#  include <sys/select.h>\n> +# endif\n>  # include <unistd.h>\n>  #endif\n"},{"id":"197611","messageId":"003501cd808d$bd21b7a0$376526e0$@schmitz-digital.de","threadId":"31317","inReplyTo":"7vd32ialzo.fsf@alter.siamese.dyndns.org","subject":"RE: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-22T17:44:10Z","receivedAt":"2012-08-22T17:44:10Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Junio C Hamano [mailto:gitster@pobox.com]\n> Sent: Wednesday, August 22, 2012 7:13 PM\n> To: Joachim Schmitz\n> Cc: git@vger.kernel.org; Erik Faye-Lund; Johannes Sixt; Marius Storm-Olsen\n> Subject: Re: [PATCH] Support non-WIN32 system lacking poll() while keeping\n> the WIN32 part intact\n> \n> \"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n> \n> > Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n> > ---\n> >  Makefile            | 18 ++++++++++++++----\n> >  compat/win32/poll.c |  8 ++++++--\n> >  2 files changed, 20 insertions(+), 6 deletions(-)\n> >\n> > diff --git a/Makefile b/Makefile\n> > index 6b0c961..2af4db3 100644\n> > --- a/Makefile\n> > +++ b/Makefile\n> > @@ -152,6 +152,11 @@ all::\n> >  #\n> >  # Define NO_MMAP if you want to avoid mmap.\n> >  #\n> > +# Define NO_SYS_POLL_H if you don't have sys/poll.h.\n> > +#\n> > +# Define NO_POLL if you do not have or do not want to use poll.\n> > +# This also implies NO_SYS_POLL_H.\n> \n> Do you really need to have both?  I suspect \"If you do not have a usable\n> sys/poll.h, set NO_SYS_POLL_H\" may be a simpler alternative, but there\nmust\n\nHmm, Not having <sys/poll.h> and not having poll() are different thinks,\naren't they?\n\nUsing NO_SYS_POL_H so far only affects BASIC_CFLAGS:\nifdef NO_SYS_POLL_H\n        BASIC_CFLAGS += -DNO_SYS_POLL_H\nendif\n\nIt does not add compat/win32/poll.c to COMPAT_OBJS, NO_POLL does that.\n\n> be a reason why you had to add a new one instead of going that route.  It\nwould\n> be a good idea to describe that reason in the log message above, in the\nspace\n> before your Sign-off.\n> \n> > @@ -1257,7 +1262,7 @@ ifeq ($(uname_S),Windows)\n> >         BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild\n> > -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H\n> > -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE\n> >         COMPAT_OBJS = compat/msvc.o compat/winansi.o \\\n> >                 compat/win32/pthread.o compat/win32/syslog.o \\\n> > -               compat/win32/poll.o compat/win32/dirent.o\n> > +               compat/win32/dirent.o\n> >         COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -\n> DHAVE_STRING_H\n> > ...\n> > @@ -1347,7 +1352,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n> >         COMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n> >         COMPAT_OBJS += compat/mingw.o compat/winansi.o \\\n> >                 compat/win32/pthread.o compat/win32/syslog.o \\\n> > -               compat/win32/poll.o compat/win32/dirent.o\n> > +               compat/win32/dirent.o\n> >         EXTLIBS += -lws2_32\n> > ...\n> > @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT ...\n> > +ifdef NO_POLL\n> > +       NO_SYS_POLL_H = YesPlease\n> > +       COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h\n> > +       COMPAT_OBJS += compat/win32/poll.c endif\n> \n> In general, I think this is a good direction to go.  If the existing\nemulation in\n> win32/poll.c turns out to be usable across platforms and not windows\nspecific,\n> sharing it would be a good idea.\n> \n> But if the emulation is no longer windows specific, shouldn't you also\nmove it\n> outside compat/win32/ and somewhere more generic?\n\nShould be possible. Esp. as with the current setup make issues a warning:\n\nMakefile:2329: target `compat/win32/poll.c' doesn't match the target pattern\n\nHaven't yet been able to spot where that comes from.\n\n> > diff --git a/compat/win32/poll.c b/compat/win32/poll.c index\n> > 403eaa7..49541f1 100644\n> > --- a/compat/win32/poll.c\n> > +++ b/compat/win32/poll.c\n> > @@ -24,7 +24,9 @@\n> >  # pragma GCC diagnostic ignored \"-Wtype-limits\"\n> >  #endif\n> >\n> > -#include <malloc.h>\n> > +#if defined(WIN32)\n> > +# include <malloc.h>\n> > +#endif\n> \n> Hrm, are the Windows folks OK with this?  MINGW and MSVC are affected;\n> Cygwin should be OK, I think.\n\nI stole that define from another place in git (compat/nedmalloc/nedmalloc.c\"\nline 36), there too it was used to hide <malloc.h>, so I assumed it to be\nthe proper method?\n \n> >  #include <sys/types.h>\n> >\n> > @@ -48,7 +50,9 @@\n> >  #else\n> >  # include <sys/time.h>\n> >  # include <sys/socket.h>\n> > -# include <sys/select.h>\n> > +# ifndef NO_SYS_SELECT_H\n> > +#  include <sys/select.h>\n> > +# endif\n> >  # include <unistd.h>\n> >  #endif\n"},{"id":"197612","messageId":"7vfw7e95sy.fsf@alter.siamese.dyndns.org","threadId":"31317","inReplyTo":"003501cd808d$bd21b7a0$376526e0$@schmitz-digital.de","subject":"Re: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-22T17:48:13Z","receivedAt":"2012-08-22T17:48:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n\n>> Do you really need to have both?  I suspect \"If you do not have a usable\n>> sys/poll.h, set NO_SYS_POLL_H\" may be a simpler alternative, but there\n> must\n>\n> Hmm, Not having <sys/poll.h> and not having poll() are different thinks,\n> aren't they?\n\nAhh, OK, I forgot the other combination: working poll() but inclusion\nof sys/poll.h is unnecessary.  OK.\n"},{"id":"197653","messageId":"004301cd80a0$94fddc00$bef99400$@schmitz-digital.de","threadId":"31317","inReplyTo":"7vd32ialzo.fsf@alter.siamese.dyndns.org","subject":"RE: [PATCH] Support non-WIN32 system lacking poll() while keeping the WIN32 part intact","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-08-22T19:59:03Z","receivedAt":"2012-08-22T19:59:03Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"> From: Joachim Schmitz [mailto:jojo@schmitz-digital.de]\n> Sent: Wednesday, August 22, 2012 7:44 PM\n> To: 'Junio C Hamano'\n> Cc: 'git@vger.kernel.org'; 'Erik Faye-Lund'; 'Johannes Sixt'; 'Marius\nStorm-\n> Olsen'\n> Subject: RE: [PATCH] Support non-WIN32 system lacking poll() while keeping\n> the WIN32 part intact\n> \n> > From: Junio C Hamano [mailto:gitster@pobox.com]\n> > Sent: Wednesday, August 22, 2012 7:13 PM\n> > To: Joachim Schmitz\n> > Cc: git@vger.kernel.org; Erik Faye-Lund; Johannes Sixt; Marius\n> > Storm-Olsen\n> > Subject: Re: [PATCH] Support non-WIN32 system lacking poll() while\n> > keeping the WIN32 part intact\n> >\n> > \"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n> >\n> > > Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n> > > ---\n> > >  Makefile            | 18 ++++++++++++++----\n> > >  compat/win32/poll.c |  8 ++++++--\n> > >  2 files changed, 20 insertions(+), 6 deletions(-)\n> > >\n> > > diff --git a/Makefile b/Makefile\n...\n> > > @@ -1601,6 +1606,11 @@ ifdef NO_GETTEXT ...\n> > > +ifdef NO_POLL\n> > > +       NO_SYS_POLL_H = YesPlease\n> > > +       COMPAT_CFLAGS += -DNO_POLL -Icompat/win32 # so it find poll.h\n> > > +       COMPAT_OBJS += compat/win32/poll.c\n\nThis is of course wrong! Needs to be poll.o, not poll.c\n\n> > > endif\n> >\n> > In general, I think this is a good direction to go.  If the existing\n> > emulation in win32/poll.c turns out to be usable across platforms and\n> > not windows specific, sharing it would be a good idea.\n> >\n> > But if the emulation is no longer windows specific, shouldn't you also\n> > move it outside compat/win32/ and somewhere more generic?\n> \n> Should be possible. Esp. as with the current setup make issues a warning:\n> \n> Makefile:2329: target `compat/win32/poll.c' doesn't match the target\npattern\n> \n> Haven't yet been able to spot where that comes from.\n\nSee above.\n \n"}]}