Skip to content

Commit

Permalink
net: tap: use qemu_set_nonblock
Browse files Browse the repository at this point in the history
The fcntl will change the flags directly, use qemu_set_nonblock()
instead.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Li Qiang <liq3ea@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
  • Loading branch information
Li Qiang authored and jasowang committed Mar 29, 2019
1 parent c6bf50f commit ab79237
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/tap.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -887,7 +887,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);

net_init_tap_one(tap, peer, "bridge", name, ifname,
Expand Down

0 comments on commit ab79237

Please sign in to comment.