On 04/05/2011 09:31 AM, Eric Blake wrote:
On 04/05/2011 09:03 AM, Daniel P. Berrange wrote:
> The virSetCloseExec API returns -1 on Win32 since it cannot
> possibly work. Avoid calling it from the event loop since
> is not required in this case.
Well, it _could_ work if gnulib would relax a couple modules to LGPLv2+
instead of their current LGPLv3+.
Meanwhile, mingw _does_ let us create a pipe already non-inheritible
(that is, pipe2(fds, O_CLOEXEC) _does_ work on mingw as an LGPLv2+
gnulib solution).
If you don't mind, I'd rather conditionally NAK this patch and try the
pipe2 approach instead, since the added in-function #ifdefs detract from
readability.
Like so, except that this is pending a gnulib license change first (I
was wrong, gnulib's pipe2 is still LGPLv3+ at the moment).
diff --git i/bootstrap.conf w/bootstrap.conf
index 11d2199..95136ac 100644
--- i/bootstrap.conf
+++ w/bootstrap.conf
@@ -54,6 +54,7 @@ nonblocking
perror
physmem
pipe-posix
+pipe2
poll
posix-shell
pthread
diff --git i/src/util/event_poll.c w/src/util/event_poll.c
index 91000e2..cd1ff4a 100644
--- i/src/util/event_poll.c
+++ w/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;
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org