qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [qemu-devel]The problem of QMP command getfd.


From: Li Zhang
Subject: Re: [Qemu-devel] [qemu-devel]The problem of QMP command getfd.
Date: Mon, 28 Jan 2013 22:16:43 +0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2

On 2013年01月28日 21:28, Stefan Hajnoczi wrote:
On Mon, Jan 28, 2013 at 03:27:01PM +0800, Li Zhang wrote:
Hi all,

I am trying to executing qmp command getfd according to qmp-commands.hx.

{ "execute": "getfd", "arguments": { "fdname": "fd1" } }

Every time, it returns the error.

{
     "error": {
         "class": "GenericError",
         "desc": "No file descriptor supplied via SCM_RIGHTS"
     }
}

This error is related with SCM_RIGHTS.
I don't know about SCM at all.

Can anyone give some hints about this?
The "getfd" command allows the client to pass a file descriptor to QEMU
and give it a name.  Later that file descriptor can be used by QEMU.

The QMP client must send '{ "execute": "getfd", "arguments": { "fdname":
"fd1" } }' together with SCM_RIGHTS CMSG.  You are getting the error
because you sent the "getfd" command but forgot to include a file
descriptor using SCM_RIGHTS.

SCM_RIGHTS is a feature of UNIX domain sockets.  It allows one process
to pass a file descriptor to another process through the UNIX domain
socket.  See "man 7 unix" and "man 3 cmsg" for details.

Look at monitor.c:qmp_getfd() to understand how this works.  The QEMU
code to receive a passed file descriptor is in
qemu-char.c:unix_process_msgfd().
Thanks a lot for your detailed explanation and suggestions.
I will look into the code to understand how it works.

Thanks
--Li

Stefan




reply via email to

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