From: Sergey Bugaev <bugaevc@gmail.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, Samuel Thibault <samuel.thibault@gnu.org>
Subject: Re: [PATCH] io: Refactor close_range and closefrom
Date: Mon, 8 Nov 2021 17:13:23 +0300 [thread overview]
Message-ID: <CAN9u=HcsFgij6+6CDWM39opHPyjUcstq=jwf71KocvPwZFXo1Q@mail.gmail.com> (raw)
In-Reply-To: <20211108135800.2189664-1-adhemerval.zanella@linaro.org>
Hello,
I hope it's appropriate for me to leave some comments on the patch...
On Mon, Nov 8, 2021 at 4:58 PM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
> +#if __ASSUME_CLOSE_RANGE
> +static inline _Bool __closefrom_fallback (int __lowfd, _Bool dirfd_fallback)
> +{
> + return true;
> +}
My understanding is that this will get called if we assume close_range
is available, but it still somehow fails. Should it maybe return false
in this case, to cause closefrom to fail/abort, rather than silently
succeeding?
> +stub_warning (close_range)
Wouldn't this warn that "close_range is not implemented and will
always fail"? I'd expect that warning for a stub that always fails
with ENOSYS, but not for a working (if non-atomic etc) implementation.
> --- a/posix/unistd.h
> +++ b/posix/unistd.h
> @@ -1199,6 +1199,17 @@ int getentropy (void *__buffer, size_t __length) __wur
> __attr_access ((__write_only__, 1, 2));
> #endif
>
> +#ifdef __USE_GNU
> +/* Close all file descriptors in the range FD up to MAX_FD. The flag FLAGS
> + are define by the CLOSE_RANGE prefix. This function behaves like close
> + on the range, but in a fail-safe where it will either fail and not close
> + any file descriptor or close all of them. Gaps where the file descriptor
Is this (either closes everything or nothing) an appropriate thing to
promise in the common header? Similarly, if the default implementation
accepts no flags, should the common description mention "the
CLOSE_RANGE prefix"?
Sergey
next prev parent reply other threads:[~2021-11-08 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 13:58 Adhemerval Zanella
2021-11-08 14:13 ` Sergey Bugaev [this message]
2021-11-08 14:55 ` Adhemerval Zanella
2021-11-08 15:13 ` Sergey Bugaev
2021-11-08 17:04 ` Adhemerval Zanella
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAN9u=HcsFgij6+6CDWM39opHPyjUcstq=jwf71KocvPwZFXo1Q@mail.gmail.com' \
--to=bugaevc@gmail.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.org \
--cc=samuel.thibault@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).