aboutsummaryrefslogtreecommitdiff
path: root/qemu-char.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-12-17 18:07:09 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-12-17 18:07:09 +0000
commit6a6533213d78dea4407fe6933ad489796b582599 (patch)
tree1e37b82b21a52c000d5d6de0494c168bd69d4307 /qemu-char.c
parente5fbe28e5424d26fc2c25d0a7ecb927d3c80d5e8 (diff)
parent29cd81ffe3679bec9a062505e5b0d9a12f3558a8 (diff)
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* KVM: synic support, split irqchip support * memory: cleanups, optimizations, ioeventfd emulation * SCSI: small fixes, vmw_pvscsi compatibility improvements * qemu_log cleanups * Coverity model improvements # gpg: Signature made Thu 17 Dec 2015 16:35:21 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (45 commits) coverity: Model g_memdup() coverity: Model g_poll() scsi: always call notifier on async cancellation scsi: use scsi_req_cancel_async when purging requests target-i386: kvm: clear unusable segments' flags in migration rcu: optimize rcu_read_lock memory: try to inline constant-length reads memory: inline a few small accessors memory: extract first iteration of address_space_read and address_space_write memory: split address_space_read and address_space_write memory: avoid unnecessary object_ref/unref memory: reorder MemoryRegion fields exec: make qemu_ram_ptr_length more similar to qemu_get_ram_ptr exec: always call qemu_get_ram_ptr within rcu_read_lock linux-user: convert DEBUG_SIGNAL logging to tracepoints linux-user: avoid "naked" qemu_log user: introduce "-d page" xtensa: avoid "naked" qemu_log tricore: avoid "naked" qemu_log ppc: cleanup logging ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qemu-char.c')
-rw-r--r--qemu-char.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 2969c44e84..66703e3f0a 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3484,6 +3484,9 @@ static void qemu_chr_parse_file_out(QemuOpts *opts, ChardevBackend *backend,
}
backend->u.file = g_new0(ChardevFile, 1);
backend->u.file->out = g_strdup(path);
+
+ backend->u.file->has_append = true;
+ backend->u.file->append = qemu_opt_get_bool(opts, "append", false);
}
static void qemu_chr_parse_stdio(QemuOpts *opts, ChardevBackend *backend,
@@ -4041,6 +4044,9 @@ QemuOptsList qemu_chardev_opts = {
},{
.name = "chardev",
.type = QEMU_OPT_STRING,
+ },{
+ .name = "append",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
@@ -4101,7 +4107,13 @@ static CharDriverState *qmp_chardev_open_file(const char *id,
ChardevFile *file = backend->u.file;
int flags, in = -1, out;
- flags = O_WRONLY | O_TRUNC | O_CREAT | O_BINARY;
+ flags = O_WRONLY | O_CREAT | O_BINARY;
+ if (file->has_append && file->append) {
+ flags |= O_APPEND;
+ } else {
+ flags |= O_TRUNC;
+ }
+
out = qmp_chardev_open_file_source(file->out, flags, errp);
if (out < 0) {
return NULL;