mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuhotplugmock: Mock fd passing to qemu via 'SCM_RIGHTS'
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
654486bd57
commit
5b5162072c
@ -288,7 +288,7 @@ qemuMonitorIOProcess(qemuMonitor *mon)
|
|||||||
|
|
||||||
|
|
||||||
/* Call this function while holding the monitor lock. */
|
/* Call this function while holding the monitor lock. */
|
||||||
static int
|
int
|
||||||
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
||||||
const char *data,
|
const char *data,
|
||||||
size_t len,
|
size_t len,
|
||||||
|
@ -96,3 +96,10 @@ struct _qemuMonitor {
|
|||||||
|
|
||||||
void
|
void
|
||||||
qemuMonitorResetCommandID(qemuMonitor *mon);
|
qemuMonitorResetCommandID(qemuMonitor *mon);
|
||||||
|
|
||||||
|
int
|
||||||
|
qemuMonitorIOWriteWithFD(qemuMonitor *mon,
|
||||||
|
const char *data,
|
||||||
|
size_t len,
|
||||||
|
int fd)
|
||||||
|
G_GNUC_NO_INLINE;
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
#include "virmock.h"
|
#include "virmock.h"
|
||||||
#include <fcntl.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 bool (*real_virFileExists)(const char *path);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -107,3 +110,14 @@ qemuProcessPrepareHostBackendChardevHotplug(virDomainObj *vm,
|
|||||||
testQemuPrepareHostBackendChardevOne,
|
testQemuPrepareHostBackendChardevOne,
|
||||||
vm);
|
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 */
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user