[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] virsh: fix mingw failure on creating nonblocking pipe



* .gnulib: Update to latest, for nonblocking module.
* bootstrap.conf (gnulib_modules): Add nonblocking.
* src/util/util.c (virSetBlocking): Defer to gnulib.
---

Matthias, does this work for you on your mingw build?  So far,
I have only tested that it cross-compiles, and that the new
gnulib module passes its self-test when run in isolation on mingw.

 .gnulib         |    2 +-
 bootstrap.conf  |    1 +
 src/util/util.c |   22 ++--------------------
 3 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/.gnulib b/.gnulib
index 790645d..dec3475 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 790645d837f8084991421107fba639b110d58335
+Subproject commit dec3475763be252103922a887920012eeb32dc26
diff --git a/bootstrap.conf b/bootstrap.conf
index 733c354..ca0c3de 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -49,6 +49,7 @@ mkstemp
 mkstemps
 mktempd
 netdb
+nonblocking
 perror
 physmem
 pipe-posix
diff --git a/src/util/util.c b/src/util/util.c
index 035036b..e54b02b 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -77,6 +77,7 @@
 #include "verify.h"
 #include "files.h"
 #include "command.h"
+#include "nonblocking.h"

 #ifndef NSIG
 # define NSIG 32
@@ -246,26 +247,7 @@ virArgvToString(const char *const *argv)
 }

 int virSetBlocking(int fd, bool blocking) {
-#ifndef WIN32
-    int flags;
-    if ((flags = fcntl(fd, F_GETFL)) < 0)
-        return -1;
-    if (blocking)
-        flags &= ~O_NONBLOCK;
-    else
-        flags |= O_NONBLOCK;
-    if ((fcntl(fd, F_SETFL, flags)) < 0)
-        return -1;
-#else
-    unsigned long flag = blocking ? 0 : 1;
-
-    /* This is actually Gnulib's replacement rpl_ioctl function.
-     * We can't call ioctlsocket directly in any case.
-     */
-    if (ioctl (fd, FIONBIO, (void *) &flag) == -1)
-        return -1;
-#endif
-    return 0;
+    return set_nonblocking_flag (fd, blocking);
 }

 int virSetNonBlock(int fd) {
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]