git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/4] Support non-WIN32 systems lacking poll()
@ 2012-09-17  6:48 Joachim Schmitz
  2012-09-17  6:53 ` [PATCH v6 1/4] make poll available for other platforms lacking it Joachim Schmitz
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17  6:48 UTC (permalink / raw)
  To: git

Here's now my updated series of patches to make the win32 implementation of 
poll() available to other platforms:

1 - make poll available for other platforms lacking it by moving it into a 
separate directory and adjusting Makefile
2 - fix some win32 specific dependencies in poll.c by #ifdef the inclusion 
of two header files
3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in 
gnulib recently
4 - make poll() work on platforms that can't recv() on a non-socket, namely 
HP NonStop, as fixed in gnulib recently


Bye, Jojo 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v6 1/4] make poll available for other platforms lacking it
  2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
@ 2012-09-17  6:53 ` Joachim Schmitz
  2012-09-17  6:56 ` [PATCH v6 2/4] fix some win32 specific dependencies in poll.c Joachim Schmitz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17  6:53 UTC (permalink / raw)
  To: git

move poll.[ch] out of compat/win32/ into compat/poll/ and adjust
Makefile with the changed paths. Adding comments to Makefile about how/when
to enable it and add logic for this

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
---
 Makefile                      | 20 +++++++++++++++-----
 compat/{win32 => poll}/poll.c |  0
 compat/{win32 => poll}/poll.h |  0
 3 files changed, 15 insertions(+), 5 deletions(-)
 rename compat/{win32 => poll}/poll.c (100%)
 rename compat/{win32 => poll}/poll.h (100%)

diff --git a/Makefile b/Makefile
index ac49320..7893297 100644
--- a/Makefile
+++ b/Makefile
@@ -152,6 +152,11 @@ all::
 #
 # Define NO_MMAP if you want to avoid mmap.
 #
+# Define NO_SYS_POLL_H if you don't have sys/poll.h.
+#
+# Define NO_POLL if you do not have or don't want to use poll().
+# This also implies NO_SYS_POLL_H.
+#
 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
 #
 # Define NO_PREAD if you have a problem with pread() system call (e.g.
@@ -598,10 +603,10 @@ LIB_H += compat/bswap.h
 LIB_H += compat/cygwin.h
 LIB_H += compat/mingw.h
 LIB_H += compat/obstack.h
+LIB_H += compat/poll/poll.h
 LIB_H += compat/precompose_utf8.h
 LIB_H += compat/terminal.h
 LIB_H += compat/win32/dirent.h
-LIB_H += compat/win32/poll.h
 LIB_H += compat/win32/pthread.h
 LIB_H += compat/win32/syslog.h
 LIB_H += connected.h
@@ -1220,7 +1225,7 @@ ifeq ($(uname_S),Windows)
  NO_PREAD = YesPlease
  NEEDS_CRYPTO_WITH_SSL = YesPlease
  NO_LIBGEN_H = YesPlease
- NO_SYS_POLL_H = YesPlease
+ NO_POLL_H = YesPlease
  NO_SYMLINK_HEAD = YesPlease
  NO_IPV6 = YesPlease
  NO_UNIX_SOCKETS = YesPlease
@@ -1261,7 +1266,7 @@ ifeq ($(uname_S),Windows)
  BASIC_CFLAGS 
= -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE 
 -DHAVE_STRING_H
-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
  COMPAT_OBJS = compat/msvc.o compat/winansi.o \
   compat/win32/pthread.o compat/win32/syslog.o \
-  compat/win32/poll.o compat/win32/dirent.o
+  compat/win32/dirent.o
  COMPAT_CFLAGS 
= -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex 
 -Icompat/win32
-DSTRIP_EXTENSION=\".exe\"
  BASIC_LDFLAGS 
= -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
  EXTLIBS = user32.lib advapi32.lib shell32.lib wininet.lib ws2_32.lib
@@ -1316,7 +1321,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
  NO_PREAD = YesPlease
  NEEDS_CRYPTO_WITH_SSL = YesPlease
  NO_LIBGEN_H = YesPlease
- NO_SYS_POLL_H = YesPlease
+ NO_POLL_H = YesPlease
  NO_SYMLINK_HEAD = YesPlease
  NO_UNIX_SOCKETS = YesPlease
  NO_SETENV = YesPlease
@@ -1351,7 +1356,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
  COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
  COMPAT_OBJS += compat/mingw.o compat/winansi.o \
   compat/win32/pthread.o compat/win32/syslog.o \
-  compat/win32/poll.o compat/win32/dirent.o
+  compat/win32/dirent.o
  EXTLIBS += -lws2_32
  PTHREAD_LIBS =
  X = .exe
@@ -1605,6 +1610,11 @@ ifdef NO_GETTEXT
  BASIC_CFLAGS += -DNO_GETTEXT
  USE_GETTEXT_SCHEME ?= fallthrough
 endif
+ifdef NO_POLL
+ NO_SYS_POLL_H = YesPlease
+ COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
+ COMPAT_OBJS += compat/poll/poll.o
+endif
 ifdef NO_STRCASESTR
  COMPAT_CFLAGS += -DNO_STRCASESTR
  COMPAT_OBJS += compat/strcasestr.o
diff --git a/compat/win32/poll.c b/compat/poll/poll.c
similarity index 100%
rename from compat/win32/poll.c
rename to compat/poll/poll.c
diff --git a/compat/win32/poll.h b/compat/poll/poll.h
similarity index 100%
rename from compat/win32/poll.h
rename to compat/poll/poll.h
-- 
1.7.12 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v6 2/4] fix some win32 specific dependencies in poll.c
  2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
  2012-09-17  6:53 ` [PATCH v6 1/4] make poll available for other platforms lacking it Joachim Schmitz
@ 2012-09-17  6:56 ` Joachim Schmitz
  2012-09-17  7:02 ` [PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL Joachim Schmitz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17  6:56 UTC (permalink / raw)
  To: git

In order for non-win32 platforms to be able to use poll.c, #ifdef the
inclusion of two header files in the same manner as it's done elsewhere
in git.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
---
 compat/poll/poll.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index 9e7a25c..e4b8319 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL
  2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
  2012-09-17  6:53 ` [PATCH v6 1/4] make poll available for other platforms lacking it Joachim Schmitz
  2012-09-17  6:56 ` [PATCH v6 2/4] fix some win32 specific dependencies in poll.c Joachim Schmitz
@ 2012-09-17  7:02 ` Joachim Schmitz
  2012-09-17  7:03 ` [PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket Joachim Schmitz
  2012-09-17 21:03 ` [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Junio C Hamano
  4 siblings, 0 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17  7:02 UTC (permalink / raw)
  To: git

If poll() is used as a milli-second sleep, like in help.c, by passing a NULL
in the 1st and a 0 in the 2nd arg, it exits with EFAULT.

As per Paolo Bonzini, the original author, this is a bug and to be fixed 
like
in this commit, which is not to exit if the 2nd arg is 0. It got fixed in
gnulib in the same manner the other day.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
---
 compat/poll/poll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compat/poll/poll.c b/compat/win32/poll.c
index 403eaa7..9e7a25c 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -349,7 +349,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout)

   /* EFAULT is not necessary to implement, but let's do it in the
      simplest case. */
-  if (!pfd)
+  if (!pfd && nfd)
     {
       errno = EFAULT;
       return -1;
-- 
1.7.12 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket
  2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
                   ` (2 preceding siblings ...)
  2012-09-17  7:02 ` [PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL Joachim Schmitz
@ 2012-09-17  7:03 ` Joachim Schmitz
  2012-09-17 21:03 ` [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Junio C Hamano
  4 siblings, 0 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17  7:03 UTC (permalink / raw)
  To: git

This way it just got added to gnulib too the other day.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
---
 compat/poll/poll.c | 5 +++++
 1 file changed, 4 insertions(+)

diff --git a/compat/poll/poll.c b/compat/poll/poll.c
index e4b8319..10a204e 100644
--- a/compat/poll/poll.c
+++ b/compat/poll/poll.c
@@ -306,6 +306,10 @@ compute_revents (int fd, int sought, fd_set *rfds, 
fd_set *wfds, fd_set *efds)
         || socket_errno == ECONNABORTED || socket_errno == ENETRESET)
  happened |= POLLHUP;

+      /* some systems can't use recv() on non-socket, including HP NonStop 
*/
+      else if (socket_errno == ENOTSOCK)
+ happened |= (POLLIN | POLLRDNORM) & sought;
+
       else
  happened |= POLLERR;
     }
-- 
1.7.12 

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v6 0/4] Support non-WIN32 systems lacking poll()
  2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
                   ` (3 preceding siblings ...)
  2012-09-17  7:03 ` [PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket Joachim Schmitz
@ 2012-09-17 21:03 ` Junio C Hamano
  2012-09-17 21:10   ` [PATCH v7 " Joachim Schmitz
  4 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2012-09-17 21:03 UTC (permalink / raw)
  To: Joachim Schmitz; +Cc: git

I really wanted to take a look at this series, but with the broken
patches I cannot.

Try again, please, perhaps first sending patches to yourself and
make sure they come out without losing leading SP for context lines
and such.

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()
  2012-09-17 21:03 ` [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Junio C Hamano
@ 2012-09-17 21:10   ` Joachim Schmitz
  2012-09-17 21:34     ` Joachim Schmitz
  0 siblings, 1 reply; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17 21:10 UTC (permalink / raw)
  To: git

Here's now my updated series of patches to make the win32 implementation of
poll() available to other platforms:

1 - make poll available for other platforms lacking it by moving it into a
separate directory and adjusting Makefile
2 - fix some win32 specific dependencies in poll.c by #ifdef the inclusion
of two header files
3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in
gnulib recently
4 - make poll() work on platforms that can't recv() on a non-socket, namely
HP NonStop, as fixed in gnulib recently

Hopefully without whitespace issues...

Bye, Jojo 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()
  2012-09-17 21:10   ` [PATCH v7 " Joachim Schmitz
@ 2012-09-17 21:34     ` Joachim Schmitz
  2012-09-17 22:38       ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-17 21:34 UTC (permalink / raw)
  To: git

Joachim Schmitz wrote:
> Here's now my updated series of patches to make the win32 implementation
> of poll() available to other platforms:
> 
> 1 - make poll available for other platforms lacking it by moving it into
> a separate directory and adjusting Makefile
> 2 - fix some win32 specific dependencies in poll.c by #ifdef the
> inclusion of two header files
> 3 - poll() exits too early with EFAULT if 1st arg is NULL, as fixed in
> gnulib recently
> 4 - make poll() work on platforms that can't recv() on a non-socket,
> namely HP NonStop, as fixed in gnulib recently
> 
> Hopefully without whitespace issues...
> 
> Bye, Jojo

Posted but not properly chained... hope that doesn't matter?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()
  2012-09-17 21:34     ` Joachim Schmitz
@ 2012-09-17 22:38       ` Junio C Hamano
  2012-09-18  6:22         ` Joachim Schmitz
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2012-09-17 22:38 UTC (permalink / raw)
  To: Joachim Schmitz; +Cc: git

"Joachim Schmitz" <jojo@schmitz-digital.de> writes:

> Posted but not properly chained... hope that doesn't matter?

Something small like this it doesn't. I am not into bureaucracy ;-)

Thanks.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()
  2012-09-17 22:38       ` Junio C Hamano
@ 2012-09-18  6:22         ` Joachim Schmitz
  0 siblings, 0 replies; 10+ messages in thread
From: Joachim Schmitz @ 2012-09-18  6:22 UTC (permalink / raw)
  To: 'Junio C Hamano'; +Cc: git

> From: Junio C Hamano [mailto:gitster@pobox.com]
> Sent: Tuesday, September 18, 2012 12:39 AM
> To: Joachim Schmitz
> Cc: git@vger.kernel.org
> Subject: Re: [PATCH v7 0/4] Support non-WIN32 systems lacking poll()
> 
> "Joachim Schmitz" <jojo@schmitz-digital.de> writes:
> 
> > Posted but not properly chained... hope that doesn't matter?
> 
> Something small like this it doesn't. I am not into bureaucracy ;-)

Phew ;-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-09-18  6:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17  6:48 [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Joachim Schmitz
2012-09-17  6:53 ` [PATCH v6 1/4] make poll available for other platforms lacking it Joachim Schmitz
2012-09-17  6:56 ` [PATCH v6 2/4] fix some win32 specific dependencies in poll.c Joachim Schmitz
2012-09-17  7:02 ` [PATCH v6 3/4] poll() exits too early with EFAULT if 1st arg is NULL Joachim Schmitz
2012-09-17  7:03 ` [PATCH v6 4/4] make poll() work on platforms that can't recv() on a non-socket Joachim Schmitz
2012-09-17 21:03 ` [PATCH v6 0/4] Support non-WIN32 systems lacking poll() Junio C Hamano
2012-09-17 21:10   ` [PATCH v7 " Joachim Schmitz
2012-09-17 21:34     ` Joachim Schmitz
2012-09-17 22:38       ` Junio C Hamano
2012-09-18  6:22         ` Joachim Schmitz

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).