[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock |
Date: |
Wed, 21 Nov 2018 15:28:29 +0400 |
Hi
On Wed, Nov 21, 2018 at 3:22 PM Li Qiang <address@hidden> wrote:
>
> The fcntl will change the flags directly, use qemu_set_nonblock()
> instead.
qemu_set_nonblock() will preserve the existing flags. And on windows,
it will register the FD to the event loop.
that's a reasonable thing to do, is this fixing an actual bug?
>
> Signed-off-by: Li Qiang <address@hidden>
> ---
> net/tap.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/tap.c b/net/tap.c
> index cc8525f154..e8aadd8d4b 100644
> --- a/net/tap.c
> +++ b/net/tap.c
> @@ -592,7 +592,7 @@ int net_init_bridge(const Netdev *netdev, const char
> *name,
> return -1;
> }
>
> - fcntl(fd, F_SETFL, O_NONBLOCK);
> + qemu_set_nonblock(fd);
> vnet_hdr = tap_probe_vnet_hdr(fd);
> s = net_tap_fd_init(peer, "bridge", name, fd, vnet_hdr);
>
> @@ -707,7 +707,7 @@ static void net_init_tap_one(const NetdevTapOptions *tap,
> NetClientState *peer,
> }
> return;
> }
> - fcntl(vhostfd, F_SETFL, O_NONBLOCK);
> + qemu_set_nonblock(vhostfd);
> }
> options.opaque = (void *)(uintptr_t)vhostfd;
>
> @@ -791,7 +791,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> return -1;
> }
>
> - fcntl(fd, F_SETFL, O_NONBLOCK);
> + qemu_set_nonblock(fd);
>
> vnet_hdr = tap_probe_vnet_hdr(fd);
>
> @@ -839,7 +839,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
> goto free_fail;
> }
>
> - fcntl(fd, F_SETFL, O_NONBLOCK);
> + qemu_set_nonblock(fd);
>
> if (i == 0) {
> vnet_hdr = tap_probe_vnet_hdr(fd);
> @@ -887,7 +887,7 @@ free_fail:
> return -1;
> }
>
> - fcntl(fd, F_SETFL, O_NONBLOCK);
> + qemu_set_nonblock(fd);
> vnet_hdr = tap_probe_vnet_hdr(fd);
>
> net_init_tap_one(tap, peer, "bridge", name, ifname,
> --
> 2.11.0
>
>
--
Marc-André Lureau
- [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Li Qiang, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock,
Marc-André Lureau <=
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Li Qiang, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Daniel P . Berrangé, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Michael S. Tsirkin, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Markus Armbruster, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Eric Blake, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Michael S. Tsirkin, 2018/11/21
- Re: [Qemu-devel] [PATCH] net: tap: use qemu_set_nonblock, Jason Wang, 2018/11/21