
On Thu, Mar 10, 2016 at 19:31:56 +0100, Marc-André Lureau wrote:
When debug-threads is enabled, individual threads are given a separate name (on Linux)
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1140121
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> --- src/qemu/qemu_command.c | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ee06479..96be9e1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5333,6 +5333,36 @@ qemuAppendKeyWrapMachineParms(virBuffer *buf, virQEMUCapsPtr qemuCaps, }
static int +qemuBuildNameCommandLine(virCommandPtr cmd, + virQEMUDriverConfigPtr cfg, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + char *name_args;
The name_args variable is not necessary since...
+ + virCommandAddArg(cmd, "-name"); + + virBufferAsprintf(&buf, "%s", def->name); + + if (cfg->setProcessName && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) + virBufferAsprintf(&buf, ",process=qemu:%s", def->name); + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NAME_DEBUG_THREADS)) + virBufferAddLit(&buf, ",debug-threads=on"); +
you can simplify the following code
+ if (virBufferCheckError(&buf) < 0) + return -1; + + name_args = virBufferContentAndReset(&buf); + virCommandAddArg(cmd, name_args); + VIR_FREE(name_args);
to just virCommandAddArgBuffer(cmd, &buf);
+ + return 0; +}
ACK with that tweak. Jirka