diff options
author | Mark Wielaard <mark@klomp.org> | 2024-02-12 13:07:04 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2024-02-18 14:13:36 +0100 |
commit | 2fe73d74a661e7a9122482b840150e6ef867cdd6 (patch) | |
tree | 6d3064b60f625d4634c2ffc1c32b2f8bd1d66b1c | |
parent | 8de121d7446dfbec2e0f70054711693ddef49bf9 (diff) | |
download | man-pages-2fe73d74a661e7a9122482b840150e6ef867cdd6.tar.gz |
close_range.2: Add _GNU_SOURCE and <unistd.h> to SYNOPSIS
close_range() is defined in <unistd.h> when _GNU_SOURCE is defined.
The <linux/close_range.h> header 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>
[alx: ffix]
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man2/close_range.2 | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/man2/close_range.2 b/man2/close_range.2 index 380a473653..b0c9ef66ed 100644 --- a/man2/close_range.2 +++ b/man2/close_range.2 @@ -11,10 +11,14 @@ 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 -.BI "int close_range(unsigned int " first ", unsigned int " last , -.BI " unsigned int " flags ); +.BR "#include <linux/close_range.h>" " /* Definition of " CLOSE_RANGE_* " +.BR "" " constants */" +.P +.BI "int close_range(unsigned int " first ", unsigned int " last \ +", int " flags ); .fi .SH DESCRIPTION The @@ -205,7 +209,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 +262,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); } |