From: Joachim Schmitz <hidden> Date: 2016-06-15 22:54:46
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
From: Joachim Schmitz <hidden> Date: 2016-06-15 22:54:46
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 <redacted>
---
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%)
@@ -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.
diff --git a/compat/win32/poll.c b/compat/poll/poll.csimilarity index 100%rename from compat/win32/poll.crename to compat/poll/poll.cdiff --git a/compat/win32/poll.h b/compat/poll/poll.hsimilarity index 100%rename from compat/win32/poll.hrename to compat/poll/poll.h
--
1.7.12
From: Joachim Schmitz <hidden> Date: 2016-06-15 22:54:46
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 <redacted>
---
compat/poll/poll.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Joachim Schmitz <hidden> Date: 2016-06-15 22:54:46
This way it just got added to gnulib too the other day.
Signed-off-by: Joachim Schmitz <redacted>
---
compat/poll/poll.c | 5 +++++
1 file changed, 4 insertions(+)
From: Joachim Schmitz <hidden> Date: 2016-06-15 22:54:46
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 <redacted>
---
compat/poll/poll.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -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 thesimplestcase.*/-if(!pfd)+if(!pfd&&nfd){errno=EFAULT;return-1;