public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v3 2/4] Linux: Add close_range
Date: Tue, 09 Mar 2021 19:30:28 +0100	[thread overview]
Message-ID: <87o8fsyybf.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <93a493d0-7041-5c43-bd8c-361e3619abc5@linaro.org> (Adhemerval Zanella's message of "Tue, 9 Mar 2021 14:53:17 -0300")

* Adhemerval Zanella:

>>> diff --git a/sysdeps/unix/sysv/linux/bits/unistd_ext.h b/sysdeps/unix/sysv/linux/bits/unistd_ext.h
>>> index c315cc5cb8..799c59512c 100644
>>> --- a/sysdeps/unix/sysv/linux/bits/unistd_ext.h
>>> +++ b/sysdeps/unix/sysv/linux/bits/unistd_ext.h
>>> @@ -33,4 +33,15 @@
>>>     not detached and has not been joined.  */
>>>  extern __pid_t gettid (void) __THROW;
>>>  
>>> +/* Unshare the file descriptor table before closing file descriptors.  */I d
>>> +#define CLOSE_RANGE_UNSHARE     (1U << 1)
>> 
>> Needs to be indented.
>> 
>> Please include <linux/close_range.h> if available.  It's a separate
>> header so that we can use it.
>> 
>> I think if you do that, the consistency check won't add much value
>> because it can't really test anything.
>
> I am not very found of adding Linux headers, specially on installed
> headers; but it seems we are already doing it for statx.h. I have 
> added:
>
> --
> #ifdef __has_include
> # if __has_include ("linux/close_range.h")
> #  include "linux/close_range.h"
> # endif
> #endif
> #ifndef CLOSE_RANGE_UNSHARE
> # define CLOSE_RANGE_UNSHARE (1U << 1)
> #endif
> --
>
> This is very recent kernel and it will take some time until we get
> the minimum kernel near the one that starts to provide the close_range
> flags (v5.9).  So I think the consistent check would be useful to
> system that do not use use the latest kernel headers.

My point was that if the kernel headers are too old, there is nothing to
check, and if they contain CLOSE_RANGE_UNSHARE, the built-in definition
is not checked either.  But then the risk of divergence is greatly
reduced with this approach.

Thanks,
Florian


  reply	other threads:[~2021-03-09 18:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-23 16:36 [PATCH v3 1/4] support: Add xclone Adhemerval Zanella
2020-12-23 16:36 ` [PATCH v3 2/4] Linux: Add close_range Adhemerval Zanella
2021-03-09  9:47   ` Florian Weimer
2021-03-09 10:02     ` Christian Brauner
2021-03-09 17:53     ` Adhemerval Zanella
2021-03-09 18:30       ` Florian Weimer [this message]
2020-12-23 16:36 ` [PATCH v3 3/4] io: Add closefrom [BZ #10353] Adhemerval Zanella
2021-03-09 10:23   ` Florian Weimer
2021-03-09 19:07     ` Adhemerval Zanella
2020-12-23 16:36 ` [PATCH v3 4/4] posix: Add posix_spawn_file_actions_closefrom Adhemerval Zanella
2021-03-09 10:45   ` Florian Weimer
2021-03-09 19:48     ` Adhemerval Zanella
2021-03-09 20:00       ` Florian Weimer
2021-03-09 20:04         ` Adhemerval Zanella
2021-03-09  9:19 ` [PATCH v3 1/4] support: Add xclone Florian Weimer
2021-03-09 16:17   ` 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=87o8fsyybf.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.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).