public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH v4 3/5] Linux: Add close_range
Date: Wed, 24 Mar 2021 22:42:53 +0000	[thread overview]
Message-ID: <87r1k4yxzm.fsf@alyssa.is> (raw)
In-Reply-To: <20210310152633.3916978-3-adhemerval.zanella@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]

Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:

> diff --git a/manual/llio.texi b/manual/llio.texi
> index c0a53e1a6e..c1f54f4a8a 100644
> --- a/manual/llio.texi
> +++ b/manual/llio.texi
> @@ -284,6 +284,48 @@ of trying to close its underlying file descriptor with @code{close}.
>  This flushes any buffered output and updates the stream object to
>  indicate that it is closed.
>  
> +@deftypefun int close_range (unsigned int @var{lowfd}, unsigned int @var{maxfd}, int @var{flags})
> +@standards{Linux, unistd.h}
> +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{@acsfd{}}}
> +@c This is a syscall for Linux v5.9.  There is no fallback emulation for
> +@c older kernels.
> +
> +The function @code{close_range} closes the file descriptor from @var{lowfd}
> +to @var{maxfd} (inclusive).  This function is similar to call @code{close} in
> +specified file descriptor range depending on the @var{flags}.
> +
> +This is function is only supportted on recent Linux versions and @theglibc{}

Typo here: "supportted"

> +does not provide any fallback (the application will need to handle possible
> +@code{ENOSYS}).
> +
> +The @var{flags} add options on how the files are closes.  Linux currently
> +supports:
> +
> +@vtable @code
> +@item CLOSE_RANGE_UNSHARE
> +Unshare the file descriptor table before closing file descriptors.
> +@end vtable
> +
> +The normal return value from @code{close_range} is @math{0}; a value
> +of @math{-1} is returned in case of failure.  The following @code{errno} error
> +conditions are defined for this function:
> +
> +@table @code
> +@item EINVAL
> +The @var{lowfd} value is larger than @var{maxfd} or an unsupported @var{flags}
> +is used.
> +
> +@item ENOMEM
> +Either there is not enough memory for the operation, or the process is
> +out of address space.
> +
> +@item EMFILE
> +The process has too many files open.
> +The maximum number of file descriptors is controlled by the
> +@end table
> +@end deftypefun
> +
> +
>  @node I/O Primitives
>  @section Input and Output Primitives

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2021-03-24 22:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 15:26 [PATCH v4 1/5] support: Add support_stack_alloc Adhemerval Zanella
2021-03-10 15:26 ` [PATCH v4 2/5] support: Add xclone Adhemerval Zanella
2021-03-10 15:26 ` [PATCH v4 3/5] Linux: Add close_range Adhemerval Zanella
2021-03-24 22:42   ` Alyssa Ross [this message]
2021-03-10 15:26 ` [PATCH v4 4/5] io: Add closefrom [BZ #10353] Adhemerval Zanella
2021-03-10 21:54   ` Joseph Myers
2021-03-11 11:24     ` Adhemerval Zanella
2021-03-10 15:26 ` [PATCH v4 5/5] posix: Add posix_spawn_file_actions_closefrom_np Adhemerval Zanella
2021-03-10 16:10 ` [PATCH v4 1/5] support: Add support_stack_alloc Florian Weimer
2021-03-12 13:24   ` Adhemerval Zanella
2021-03-12 13:35     ` Florian Weimer
2021-03-12 14:01       ` 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=87r1k4yxzm.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --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).