From: Eric Blake <eblake@redhat.com>
To: bug-gnulib@gnu.org
Subject: Re: [PATCH] accept4: Support SOCK_NONBLOCK, if defined
Date: Tue, 20 Aug 2019 11:42:05 -0500 [thread overview]
Message-ID: <279546c7-1881-6f2b-239d-657786947182@redhat.com> (raw)
In-Reply-To: <20190820163727.5189-1-eblake@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 1025 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-08-20 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-20 16:37 [PATCH] accept4: Support SOCK_NONBLOCK, if defined Eric Blake
2019-08-20 16:42 ` Eric Blake [this message]
2019-08-20 19:33 ` Bruno Haible
2019-08-20 18:01 ` Richard W.M. Jones
2019-08-20 19:29 ` Bruno Haible
2019-08-20 19:32 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=279546c7-1881-6f2b-239d-657786947182@redhat.com \
--to=eblake@redhat.com \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).