[libvirt] [PATCHv2 3/3] build: allow mingw compilation with virCommand

Eric Blake eblake at redhat.com
Sat Dec 11 00:07:44 UTC 2010


Allows compilation, but no creation of child processes yet.  Take it
one step at a time.

* src/util/util.c (virExecWithHook) [WIN32]: New dummy function.
* src/libvirt_private.syms: Export it.
---
 src/libvirt_private.syms |    1 +
 src/util/util.c          |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 840588a..2c17fd1 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -811,6 +811,7 @@ virEventAddHandle;
 virEventRemoveHandle;
 virExec;
 virExecDaemonize;
+virExecWithHook;
 virFileAbsPath;
 virFileDeletePid;
 virFileExists;
diff --git a/src/util/util.c b/src/util/util.c
index 7eb8662..6c83955 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -925,6 +925,28 @@ virExec(const char *const*argv ATTRIBUTE_UNUSED,
 }

 int
+virExecWithHook(const char *const*argv ATTRIBUTE_UNUSED,
+                const char *const*envp ATTRIBUTE_UNUSED,
+                const fd_set *keepfd ATTRIBUTE_UNUSED,
+                pid_t *retpid ATTRIBUTE_UNUSED,
+                int infd ATTRIBUTE_UNUSED,
+                int *outfd ATTRIBUTE_UNUSED,
+                int *errfd ATTRIBUTE_UNUSED,
+                int flags ATTRIBUTE_UNUSED,
+                virExecHook hook ATTRIBUTE_UNUSED,
+                void *data ATTRIBUTE_UNUSED,
+                char *pidfile ATTRIBUTE_UNUSED)
+{
+    /* Some day we can implement pieces of virExec on top of _spawn()
+     * or CreateProcess(), but we can't implement everything, since
+     * mingw completely lacks fork(), so we cannot run hook code in
+     * the child.  */
+    virUtilError(VIR_ERR_INTERNAL_ERROR,
+                 "%s", _("virExec is not implemented for WIN32"));
+    return -1;
+}
+
+int
 virExecDaemonize(const char *const*argv ATTRIBUTE_UNUSED,
                  const char *const*envp ATTRIBUTE_UNUSED,
                  const fd_set *keepfd ATTRIBUTE_UNUSED,
-- 
1.7.3.2




More information about the libvir-list mailing list