On 06/19/2015 10:57 AM, Denis V. Lunev wrote:
From: Olga Krishtal <address@hidden>
The command creates FIFO pair that can be used with existing file
read/write interfaces to communicate with processes spawned via the
forthcoming guest-file-exec interface.
Signed-off-by: Olga Krishtal <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
Acked-by: Roman Kagan <address@hidden>
CC: Eric Blake <address@hidden>
CC: Michael Roth <address@hidden>
---
qga/commands-posix.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++---
qga/commands-win32.c | 8 ++++-
qga/qapi-schema.json | 44 ++++++++++++++++++++++++
3 files changed, 143 insertions(+), 5 deletions(-)
+
+ if (pipe(fd) != 0) {
+ error_set_errno(errp, errno, QERR_QGA_COMMAND_FAILED, "pipe() failed");
+ return NULL;
+ }
+
+ this_end = (mode == GUEST_PIPE_MODE_WRITE);
+ other_end = !this_end;
+
+ qemu_set_nonblock(fd[this_end]);
+
+ qemu_set_cloexec(fd[this_end]);
+ qemu_set_cloexec(fd[other_end]);
Would it be better to create a named FIFO somewhere in the file system,
so that you can reopen the connection even if the qga daemon is
restarted? By using just pipe(), your fds are rather ephemeral, but if
I understand correctly, the rest of the guest-file API tries to persist
across qga restart.