[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/5] Add getfd and closefd monitor commands

From: Jamie Lokier
Subject: Re: [Qemu-devel] [PATCH 3/5] Add getfd and closefd monitor commands
Date: Sat, 11 Jul 2009 02:12:28 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

Avi Kivity wrote:
> >That misses the point though.  We process one command at a time in the 
> >monitor so we only need to buffer one fd at a time.  When we start to 
> >process multiple commands at once in the monitor, we'll do so with 
> >multiple monitor states and we'll want to have one fd per monitor state.
> Again I'm thinking of the client.  If two client threads issue commands 
> in parallel there'd be >1 fds on the wire.  But qemu can consume them 
> sequentially so I agree queue may hold just a single fd.

No, even though QEMU processes commands sequentially.

If the client sends

    "command_1_with_fd" + FD1
    "command_2_with_fd" + FD2

and then waits for the results of commands 1 and 2,
QEMU calls recvmsg() and will read

    "command_1_with_fd\r\ncommand_2_with_fd\r\n" + FD1 + FD2

unless QEMU is consuming only one byte at a time from the socket, and
dispatching commands as soon as it sees the line terminator.

If QEMU reads more than one byte at a time, and the client sends more
than one command without waiting for the previous one's result, QEMU
needs to buffer more FDs otherwise some will get lost.

-- Jamie

reply via email to

[Prev in Thread] Current Thread [Next in Thread]