On Wed, Apr 15, 2020 at 3:07 AM Adalbert Lazăr <ala...@bitdefender.com> wrote: > > This is used by the VM introspection object, after handshake, to hand > over the file descriptor to KVM. > > CC: "Marc-André Lureau" <marcandre.lur...@redhat.com> > CC: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Adalbert Lazăr <ala...@bitdefender.com>
patch looks ok, Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com> Though I wonder about potential conflicts of fd usage here.. > --- > chardev/char-socket.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/chardev/char-socket.c b/chardev/char-socket.c > index 22ab242748..76d0fb8839 100644 > --- a/chardev/char-socket.c > +++ b/chardev/char-socket.c > @@ -1499,6 +1499,21 @@ static bool char_socket_get_reconnecting(Object *obj, > Error **errp) > return s->reconnect_time > 0; > } > > +static void > +char_socket_get_fd(Object *obj, Visitor *v, const char *name, void *opaque, > + Error **errp) > +{ > + int fd = -1; > + SocketChardev *s = SOCKET_CHARDEV(obj); > + QIOChannelSocket *sock = QIO_CHANNEL_SOCKET(s->sioc); > + > + if (sock) { > + fd = sock->fd; > + } > + > + visit_type_int32(v, name, &fd, errp); > +} > + > static int tcp_chr_reconnect_time(Chardev *chr, int secs) > { > SocketChardev *s = SOCKET_CHARDEV(chr); > @@ -1539,6 +1554,9 @@ static void char_socket_class_init(ObjectClass *oc, > void *data) > object_class_property_add_bool(oc, "reconnecting", > char_socket_get_reconnecting, > NULL, &error_abort); > + > + object_class_property_add(oc, "fd", "int32", char_socket_get_fd, > + NULL, NULL, NULL, &error_abort); > } > > static const TypeInfo char_socket_type_info = { > -- Marc-André Lureau