[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Questions around SocketChardev member is_unix
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] Questions around SocketChardev member is_unix |
Date: |
Thu, 23 Mar 2017 17:20:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 23/03/2017 16:57, Markus Armbruster wrote:
> qmp_chardev_open_socket() initializes SocketChardev member is_unix like
> this:
>
> s->is_unix = sock->addr->type == SOCKET_ADDRESS_KIND_UNIX;
>
> Its only use is
>
> if (s->is_unix) {
> qemu_chr_set_feature(chr, QEMU_CHAR_FEATURE_FD_PASS);
> }
>
> Same function. Should @is_unix be a local variable instead of a member?
Yes, and same for s->client.is_unix (block/nbd.c) and vd->is_unix
(ui/vnc.c). It seems to be an artifact of pre-QIOChannel code.
> It opens the connection like this:
>
> qio_channel_socket_connect_async(sioc, s->addr,
> qemu_chr_socket_connected,
> chr, NULL);
>
> or like this:
>
> if (qio_channel_socket_listen_sync(sioc, s->addr, errp) < 0) {
> goto error;
> }
>
> Looks like it supports all SocketAddressKind, including
> SOCKET_ADDRESS_KIND_FD.
>
> If you use SOCKET_ADDRESS_KIND_FD, QEMU_CHAR_FEATURE_FD_PASS is not
> set. Should it be set?
Probably it should do getsockname and set it dependent on the address
family in the result.
Paolo