qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 25/26] tests: replace qemu_set_nonblock()


From: Marc-André Lureau
Subject: Re: [PATCH v2 25/26] tests: replace qemu_set_nonblock()
Date: Wed, 27 Apr 2022 14:33:19 +0400

Hi

On Wed, Apr 27, 2022 at 1:41 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 26/04/2022 11.27, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > The call is POSIX-specific. Use the dedicated GLib API.
>
> g_unix_set_fd_nonblocking() is also available on Unix-like systems according
> to its name, I suppose? So what's the advantage of this change?
>

This is a preliminary patch before the last patch
(20220426092715.3931705-1-marcandre.lureau@redhat.com/20220426092715.3931705-27-marcandre.lureau@redhat.com/">https://patchew.org/QEMU/20220426092715.3931705-1-marcandre.lureau@redhat.com/20220426092715.3931705-27-marcandre.lureau@redhat.com/)

We should reserve qemu_socket_set_*block() usage to socket-like fd.

thanks


>   Thomas
>
>
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >   tests/qtest/vhost-user-test.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c
> > index ee30f5479648..a2cec8768462 100644
> > --- a/tests/qtest/vhost-user-test.c
> > +++ b/tests/qtest/vhost-user-test.c
> > @@ -302,6 +302,7 @@ static int chr_can_read(void *opaque)
> >
> >   static void chr_read(void *opaque, const uint8_t *buf, int size)
> >   {
> > +    g_autoptr(GError) err = NULL;
> >       TestServer *s = opaque;
> >       CharBackend *chr = &s->chr;
> >       VhostUserMsg msg;
> > @@ -394,7 +395,8 @@ static void chr_read(void *opaque, const uint8_t *buf, 
> > int size)
> >            * The receive function forces it to be blocking,
> >            * so revert it back to non-blocking.
> >            */
> > -        qemu_set_nonblock(fd);
> > +        g_unix_set_fd_nonblocking(fd, true, &err);
> > +        g_assert_no_error(err);
> >           break;
> >
> >       case VHOST_USER_SET_LOG_BASE:
>




reply via email to

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