All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Mark Wielaard <mark@klomp.org>
Cc: linux-man@vger.kernel.org, "Alexandra Hájková" <ahajkova@redhat.com>
Subject: Re: [PATCH v2] close_range.2: Add _GNU_SOURCE and unistd.h to SYNOPSIS
Date: Mon, 12 Feb 2024 00:49:32 +0100	[thread overview]
Message-ID: <ZcldDOM_i6u742Pf@debian> (raw)
In-Reply-To: <20240211232903.1622396-1-mark@klomp.org>

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

Hi Mark,

On Mon, Feb 12, 2024 at 12:29:03AM +0100, Mark Wielaard wrote:
> close_range is defined in unistd.h when _GNU_SOURCE is defined.
> The linux/close_range.h include file only defines the (linux specific)
> flags constants. The flags argument is an int, not an unsigned int, in
> the glibc wrapper. Use the close_range library call in the example code
> instead of syscall.
> 
> Fixes: 71a62d6c3c56 ("close_range.2: Glibc added a wrapper recently")
> Fixes: c2356ba085ed ("close_range.2: Glibc 2.34 has added a close_range() wrapper")
> 
> Reported-by: Alexandra Hájková <ahajkova@redhat.com>
> Signed-off-by: Mark Wielaard <mark@klomp.org>

Thanks!  LGTM, but please check a small comment below.

> ---
>  man2/close_range.2 | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/man2/close_range.2 b/man2/close_range.2
> index 380a47365..62b728e96 100644
> --- a/man2/close_range.2
> +++ b/man2/close_range.2
> @@ -11,10 +11,13 @@ Standard C library
>  .RI ( libc ", " \-lc )
>  .SH SYNOPSIS
>  .nf
> -.B #include <linux/close_range.h>
> +.BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
> +.B #include <unistd.h>
> +.P
> +.BR "#include <linux/close_range.h>" "  /* For the flags constants */"

Could you please format the comment like other pages that do the same
thing?  See for example membarrier(2).

Have a lovely night!
Alex

>  .P
>  .BI "int close_range(unsigned int " first ", unsigned int " last ,
> -.BI "                unsigned int " flags );
> +.BI "                int " flags );
>  .fi
>  .SH DESCRIPTION
>  The
> @@ -205,7 +208,6 @@ result from the calls to
>  #include <limits.h>
>  #include <stdio.h>
>  #include <stdlib.h>
> -#include <sys/syscall.h>
>  #include <unistd.h>
>  \&
>  /* Show the contents of the symbolic links in /proc/self/fd */
> @@ -259,7 +261,7 @@ main(int argc, char *argv[])
>  \&
>      printf("========= About to call close_range() =======\en");
>  \&
> -    if (syscall(SYS_close_range, 3, \[ti]0U, 0) == \-1) {
> +    if (close_range(3, \[ti]0U, 0) == \-1) {
>          perror("close_range");
>          exit(EXIT_FAILURE);
>      }
> -- 
> 2.39.3
> 
> 

-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

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

  reply	other threads:[~2024-02-11 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 23:29 [PATCH v2] close_range.2: Add _GNU_SOURCE and unistd.h to SYNOPSIS Mark Wielaard
2024-02-11 23:49 ` Alejandro Colomar [this message]
2024-02-12  0:05   ` Mark Wielaard
2024-02-12  1:49     ` Alejandro Colomar
2024-02-12 12:06       ` Mark Wielaard

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=ZcldDOM_i6u742Pf@debian \
    --to=alx@kernel.org \
    --cc=ahajkova@redhat.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mark@klomp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.