We don't want to be dealing with real FDs thus we mock
'qemuMonitorIOWriteWithFD' to do the same thing as when no FD is being
passed.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor.c | 2 +-
src/qemu/qemu_monitor_priv.h | 7 +++++++
tests/qemuhotplugmock.c | 14 ++++++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index f514998ba5..dc81e41783 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -288,7 +288,7 @@ qemuMonitorIOProcess(qemuMonitor *mon)
/* Call this function while holding the monitor lock. */
-static int
+int
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
const char *data,
size_t len,
diff --git a/src/qemu/qemu_monitor_priv.h b/src/qemu/qemu_monitor_priv.h
index 606aa79fbd..70f5f16e72 100644
--- a/src/qemu/qemu_monitor_priv.h
+++ b/src/qemu/qemu_monitor_priv.h
@@ -96,3 +96,10 @@ struct _qemuMonitor {
void
qemuMonitorResetCommandID(qemuMonitor *mon);
+
+int
+qemuMonitorIOWriteWithFD(qemuMonitor *mon,
+ const char *data,
+ size_t len,
+ int fd)
+ G_GNUC_NO_INLINE;
diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c
index e3f0715058..d618ff9d06 100644
--- a/tests/qemuhotplugmock.c
+++ b/tests/qemuhotplugmock.c
@@ -28,6 +28,9 @@
#include "virmock.h"
#include <fcntl.h>
+#define LIBVIRT_QEMU_MONITOR_PRIV_H_ALLOW
+#include "qemu/qemu_monitor_priv.h"
+
static bool (*real_virFileExists)(const char *path);
static void
@@ -107,3 +110,14 @@ qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm,
testQemuPrepareHostBackendChardevOne,
vm);
}
+
+
+/* we don't really want to send fake FDs across the monitor */
+int
+qemuMonitorIOWriteWithFD(qemuMonitor *mon,
+ const char *data,
+ size_t len,
+ int fd G_GNUC_UNUSED)
+{
+ return write(mon->fd, data, len); /* sc_avoid_write */
+}
--
2.34.1