{"thread":{"id":"31561","subject":"[PATCH v6 0/4] Support non-WIN32 systems lacking poll()","startedAt":"2012-09-17T06:48:08Z","lastAt":"2012-09-18T06:22:37Z","messageCount":10,"participants":["Joachim Schmitz","Junio C Hamano"],"isPatch":true,"patchVersion":6,"patchTotal":4},"messages":[{"id":"199196","messageId":"k36h3i$ihb$1@ger.gmane.org","threadId":"31561","inReplyTo":null,"subject":"[PATCH v6 0/4] Support non-WIN32 systems lacking poll()","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T06:48:08Z","receivedAt":"2012-09-17T06:48:08Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"Here's now my updated series of patches to make the win32 implementation of \npoll() available to other platforms:\n\n1 - make poll available for other platforms lacking it by moving it into a \nseparate directory and adjusting Makefile\n2 - fix some win32 specific dependencies in poll.c by #ifdef the inclusion \nof two header files\n3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in \ngnulib recently\n4 - make poll() work on platforms that can't recv() on a non-socket, namely \nHP NonStop, as fixed in gnulib recently\n\n\nBye, Jojo \n"},{"id":"199198","messageId":"k36hdm$kti$1@ger.gmane.org","threadId":"31561","inReplyTo":"k36h3i$ihb$1@ger.gmane.org","subject":"[PATCH v6 1/4] make poll available for other platforms lacking it","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T06:53:26Z","receivedAt":"2012-09-17T06:53:26Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"move poll.[ch] out of compat/win32/ into compat/poll/ and adjust\nMakefile with the changed paths. Adding comments to Makefile about how/when\nto enable it and add logic for this\n\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n Makefile                      | 20 +++++++++++++++-----\n compat/{win32 => poll}/poll.c |  0\n compat/{win32 => poll}/poll.h |  0\n 3 files changed, 15 insertions(+), 5 deletions(-)\n rename compat/{win32 => poll}/poll.c (100%)\n rename compat/{win32 => poll}/poll.h (100%)\n\ndiff --git a/Makefile b/Makefile\nindex ac49320..7893297 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 don't 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@@ -598,10 +603,10 @@ LIB_H += compat/bswap.h\n LIB_H += compat/cygwin.h\n LIB_H += compat/mingw.h\n LIB_H += compat/obstack.h\n+LIB_H += compat/poll/poll.h\n LIB_H += compat/precompose_utf8.h\n LIB_H += compat/terminal.h\n LIB_H += compat/win32/dirent.h\n-LIB_H += compat/win32/poll.h\n LIB_H += compat/win32/pthread.h\n LIB_H += compat/win32/syslog.h\n LIB_H += connected.h\n@@ -1220,7 +1225,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_H = YesPlease\n  NO_SYMLINK_HEAD = YesPlease\n  NO_IPV6 = YesPlease\n  NO_UNIX_SOCKETS = YesPlease\n@@ -1261,7 +1266,7 @@ ifeq ($(uname_S),Windows)\n  BASIC_CFLAGS \n= -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE \n -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 \n= -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex \n -Icompat/win32\n-DSTRIP_EXTENSION=\\\".exe\\\"\n  BASIC_LDFLAGS \n= -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib\n  EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib\n@@ -1316,7 +1321,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_H = YesPlease\n  NO_SYMLINK_HEAD = YesPlease\n  NO_UNIX_SOCKETS = YesPlease\n  NO_SETENV = YesPlease\n@@ -1351,7 +1356,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@@ -1605,6 +1610,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/poll\n+ COMPAT_OBJS += compat/poll/poll.o\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/poll/poll.c\nsimilarity index 100%\nrename from compat/win32/poll.c\nrename to compat/poll/poll.c\ndiff --git a/compat/win32/poll.h b/compat/poll/poll.h\nsimilarity index 100%\nrename from compat/win32/poll.h\nrename to compat/poll/poll.h\n-- \n1.7.12 \n"},{"id":"199199","messageId":"k36hj7$m15$1@ger.gmane.org","threadId":"31561","inReplyTo":"k36h3i$ihb$1@ger.gmane.org","subject":"[PATCH v6 2/4] fix some win32 specific dependencies in poll.c","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T06:56:28Z","receivedAt":"2012-09-17T06:56:28Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"In order for non-win32 platforms to be able to use poll.c, #ifdef the\ninclusion of two header files in the same manner as it's done elsewhere\nin git.\n\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n compat/poll/poll.c | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/poll/poll.c b/compat/poll/poll.c\nindex 9e7a25c..e4b8319 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/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"},{"id":"199201","messageId":"k36hu7$oaj$1@ger.gmane.org","threadId":"31561","inReplyTo":"k36h3i$ihb$1@ger.gmane.org","subject":"[PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T07:02:20Z","receivedAt":"2012-09-17T07:02:20Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"If poll() is used as a milli-second sleep, like in help.c, by passing a NULL\nin the 1st and a 0 in the 2nd arg, it exits with EFAULT.\n\nAs per Paolo Bonzini, the original author, this is a bug and to be fixed \nlike\nin this commit, which is not to exit if the 2nd arg is 0. It got fixed in\ngnulib in the same manner the other day.\n\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n compat/poll/poll.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/compat/poll/poll.c b/compat/win32/poll.c\nindex 403eaa7..9e7a25c 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/poll.c\n@@ -349,7 +349,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)\n\n   /* EFAULT is not necessary to implement, but let's do it in the\n      simplest case. */\n-  if (!pfd)\n+  if (!pfd && nfd)\n     {\n       errno = EFAULT;\n       return -1;\n-- \n1.7.12 \n"},{"id":"199200","messageId":"k36i16$ou1$1@ger.gmane.org","threadId":"31561","inReplyTo":"k36h3i$ihb$1@ger.gmane.org","subject":"[PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T07:03:53Z","receivedAt":"2012-09-17T07:03:53Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"This way it just got added to gnulib too the other day.\n\nSigned-off-by: Joachim Schmitz <jojo@schmitz-digital.de>\n---\n compat/poll/poll.c | 5 +++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/compat/poll/poll.c b/compat/poll/poll.c\nindex e4b8319..10a204e 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/poll.c\n@@ -306,6 +306,10 @@ compute_revents (int fd, int sought, fd_set *rfds, \nfd_set *wfds, fd_set *efds)\n         || socket_errno == ECONNABORTED || socket_errno == ENETRESET)\n  happened |= POLLHUP;\n\n+      /* some systems can't use recv() on non-socket, including HP NonStop \n*/\n+      else if (socket_errno == ENOTSOCK)\n+ happened |= (POLLIN | POLLRDNORM) & sought;\n+\n       else\n  happened |= POLLERR;\n     }\n-- \n1.7.12 \n"},{"id":"199287","messageId":"7v392gtl8g.fsf@alter.siamese.dyndns.org","threadId":"31561","inReplyTo":"k36h3i$ihb$1@ger.gmane.org","subject":"Re: [PATCH v6 0/4] Support non-WIN32 systems lacking poll()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-17T21:03:59Z","receivedAt":"2012-09-17T21:03:59Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I really wanted to take a look at this series, but with the broken\npatches I cannot.\n\nTry again, please, perhaps first sending patches to yourself and\nmake sure they come out without losing leading SP for context lines\nand such.\n\nThanks.\n"},{"id":"199289","messageId":"k383ka$nme$1@ger.gmane.org","threadId":"31561","inReplyTo":"7v392gtl8g.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T21:10:21Z","receivedAt":"2012-09-17T21:10:21Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"Here's now my updated series of patches to make the win32 implementation of\npoll() available to other platforms:\n\n1 - make poll available for other platforms lacking it by moving it into a\nseparate directory and adjusting Makefile\n2 - fix some win32 specific dependencies in poll.c by #ifdef the inclusion\nof two header files\n3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in\ngnulib recently\n4 - make poll() work on platforms that can't recv() on a non-socket, namely\nHP NonStop, as fixed in gnulib recently\n\nHopefully without whitespace issues...\n\nBye, Jojo \n"},{"id":"199296","messageId":"k3851v$3po$1@ger.gmane.org","threadId":"31561","inReplyTo":"k383ka$nme$1@ger.gmane.org","subject":"Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-17T21:34:41Z","receivedAt":"2012-09-17T21:34:41Z","isPatch":true,"sender":{"key":"jojo@schmitz-digital.de","avatar":"https://avatars.githubusercontent.com/u/1786669?v=4"},"body":"Joachim Schmitz wrote:\n> Here's now my updated series of patches to make the win32 implementation\n> of poll() available to other platforms:\n> \n> 1 - make poll available for other platforms lacking it by moving it into\n> a separate directory and adjusting Makefile\n> 2 - fix some win32 specific dependencies in poll.c by #ifdef the\n> inclusion of two header files\n> 3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in\n> gnulib recently\n> 4 - make poll() work on platforms that can't recv() on a non-socket,\n> namely HP NonStop, as fixed in gnulib recently\n> \n> Hopefully without whitespace issues...\n> \n> Bye, Jojo\n\nPosted but not properly chained... hope that doesn't matter?\n"},{"id":"199303","messageId":"7v4nmws29r.fsf@alter.siamese.dyndns.org","threadId":"31561","inReplyTo":"k3851v$3po$1@ger.gmane.org","subject":"Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-17T22:38:56Z","receivedAt":"2012-09-17T22:38:56Z","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> Posted but not properly chained... hope that doesn't matter?\n\nSomething small like this it doesn't. I am not into bureaucracy ;-)\n\nThanks.\n"},{"id":"199333","messageId":"000001cd9566$00581db0$01085910$@schmitz-digital.de","threadId":"31561","inReplyTo":"7v4nmws29r.fsf@alter.siamese.dyndns.org","subject":"RE: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()","fromName":"Joachim Schmitz","fromEmail":"jojo@schmitz-digital.de","sentAt":"2012-09-18T06:22:37Z","receivedAt":"2012-09-18T06:22:37Z","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: Tuesday, September 18, 2012 12:39 AM\n> To: Joachim Schmitz\n> Cc: git@vger.kernel.org\n> Subject: Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()\n> \n> \"Joachim Schmitz\" <jojo@schmitz-digital.de> writes:\n> \n> > Posted but not properly chained... hope that doesn't matter?\n> \n> Something small like this it doesn't. I am not into bureaucracy ;-)\n\nPhew ;-)\n"}]}