From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z60a5-000266-H6 for qemu-devel@nongnu.org; Fri, 19 Jun 2015 13:59:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z60a0-0000H0-HY for qemu-devel@nongnu.org; Fri, 19 Jun 2015 13:59:57 -0400 Received: from mx2.parallels.com ([199.115.105.18]:47462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z60a0-0000Ge-BG for qemu-devel@nongnu.org; Fri, 19 Jun 2015 13:59:52 -0400 Message-ID: <5584588A.7050808@openvz.org> Date: Fri, 19 Jun 2015 20:59:38 +0300 From: "Denis V. Lunev" MIME-Version: 1.0 References: <1434733075-24240-1-git-send-email-den@openvz.org> <1434733075-24240-3-git-send-email-den@openvz.org> <55845297.4020605@redhat.com> In-Reply-To: <55845297.4020605@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/10] qga: implement guest-pipe-open command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Olga Krishtal , qemu-devel@nongnu.org, Michael Roth On 19/06/15 20:34, Eric Blake wrote: > On 06/19/2015 10:57 AM, Denis V. Lunev wrote: >> From: Olga Krishtal >> >> 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 >> Signed-off-by: Denis V. Lunev >> Acked-by: Roman Kagan >> CC: Eric Blake >> CC: Michael Roth >> --- >> 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. > this will not help IMHO Let us assume that we have a FIFO on a filesystem and we have a process which uses this FIFO as stdout. If QGA will exit that process will blown up with SIGPIPE on any write attempt. Den