Questions around SocketChardev member is_unix
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?
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?
Quoted 5 lines · Markus Armbruster
qmp_chardev_open_socket()initializes SocketChardev memberis_unixlike this:s->is_unix = sock->addr->type == SOCKET_ADDRESS_KIND_UNIX;
Quoted 7 lines
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.
Quoted 12 lines
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; }
Quoted 5 lines
Looks like it supports all SocketAddressKind, including
SOCKET_ADDRESS_KIND_FD.If you use
SOCKET_ADDRESS_KIND_FD,QEMU_CHAR_FEATURE_FD_PASSis not set. Should it be set?
Probably it should do getsockname and set it dependent on the address family in the result.
Paolo