[libvirt] [PATCH] virsh: fix mingw startup

Eric Blake eblake at redhat.com
Wed Apr 6 19:47:34 UTC 2011


* .gnulib: Update to latest, for pipe2.
* bootstrap.conf (gnulib_modules): Add pipe2.
* src/util/event_poll.c (virEventPollInit): Use it, to avoid
problematic virSetCloseExec on mingw.
---

The gnulib changes to pipe2 are now in.

* .gnulib f796520...2255b86 (4):
  > verify: use _Static_assert if available
  > Remove leftover generated .h files after config.status changed.
  > Ensure to rebuild generated .h files when config.status has changed.
  > pipe2: Relicense under LGPLv2+.

This assumes that my earlier .gnulib modification patch is also in:
https://www.redhat.com/archives/libvir-list/2011-April/msg00297.html
although I can rebase as needed.

 .gnulib               |    2 +-
 bootstrap.conf        |    3 ++-
 src/util/event_poll.c |    7 ++-----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/.gnulib b/.gnulib
index f796520..2255b86 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit f79652003534e496bca1e49922ca521f12ca8051
+Subproject commit 2255b865130df1feadea60779babd6889285186e
diff --git a/bootstrap.conf b/bootstrap.conf
index 11d2199..95136ac 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -54,6 +54,7 @@ nonblocking
 perror
 physmem
 pipe-posix
+pipe2
 poll
 posix-shell
 pthread
diff --git a/src/util/event_poll.c b/src/util/event_poll.c
index 91000e2..cd1ff4a 100644
--- a/src/util/event_poll.c
+++ b/src/util/event_poll.c
@@ -29,6 +29,7 @@
 #include <sys/time.h>
 #include <errno.h>
 #include <unistd.h>
+#include <fcntl.h>

 #include "threads.h"
 #include "logging.h"
@@ -657,11 +658,7 @@ int virEventPollInit(void)
         return -1;
     }

-    if (pipe(eventLoop.wakeupfd) < 0 ||
-        virSetNonBlock(eventLoop.wakeupfd[0]) < 0 ||
-        virSetNonBlock(eventLoop.wakeupfd[1]) < 0 ||
-        virSetCloseExec(eventLoop.wakeupfd[0]) < 0 ||
-        virSetCloseExec(eventLoop.wakeupfd[1]) < 0) {
+    if (pipe2(eventLoop.wakeupfd, O_CLOEXEC | O_NONBLOCK) < 0) {
         virReportSystemError(errno, "%s",
                              _("Unable to setup wakeup pipe"));
         return -1;
-- 
1.7.4




More information about the libvir-list mailing list