On 8/20/19 11:37 AM, Eric Blake wrote: > Ideally, we would improve our replacement <sys/socket.h> to define a > replacement SOCK_NONBLOCK on all platforms, and teach socket() to > honor it as well; but that's a bigger task. In the meantime, if the > platform already has SOCK_NONBLOCK, we should honor it when doing a > fallback. >
>
> +#if SOCK_CLOEXEC
> + if (flags & SOCK_NONBLOCK)
> + {
> + int fcntl_flags;
> +
> + if ((fcntl_flags = fcntl (fd, F_GETFL, 0)) < 0
> + || fcntl (fd, F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
Hmm, I guess it would be better to make the accept4 module depend on
nonblocking, and call set_nonblocking() instead of open-coding the
Unix-only solution (but this works for now as long as mingw lacks
SOCK_NONBLOCK natively, and as long as we don't have <sys/socket.h>
declaring a replacement SOCK_NONBLOCK)...
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
