bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] accept4: Support SOCK_NONBLOCK, if defined


From: Eric Blake
Subject: Re: [PATCH] accept4: Support SOCK_NONBLOCK, if defined
Date: Tue, 20 Aug 2019 11:42:05 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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