diff mbox series

[01/39] futex.2: Use syscall(SYS_...); for system calls without a wrapper

Message ID 20210510175546.28445-2-alx.manpages@gmail.com
State New
Headers show
Series man2: SYNOPSIS: Fix headers, use syscall(), and other fixes | expand

Commit Message

Alejandro Colomar \(man-pages\) May 10, 2021, 5:55 p.m. UTC
At the same time, document only headers that are required
for calling the function, or those that are specific to the

<unistd.h> is required for the syscall() prototype.
<sys/syscall.h> is required for the syscall name SYS_xxx.
<linux/futex.h> is specific to this syscall.

However, uint32_t is generic enough that it shouldn't be
documented here.  The system_data_types(7) page already documents
it, and is more precise about it.  The same goes for timespec.

As a general rule a man[23] page should document the header that
includes the prototype, and all of the headers that define macros
that should be used with the call.  However, the information about
types should be restricted to system_data_types(7) (and that page
should probably be improved by adding types), except for types
that are very specific to the call.  Otherwise, we're duplicating
info and it's then harder to maintain, and probably outdated in
the future.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
 man2/futex.2 | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
diff mbox series


diff --git a/man2/futex.2 b/man2/futex.2
index 389c25224..ada96c517 100644
--- a/man2/futex.2
+++ b/man2/futex.2
@@ -25,18 +25,22 @@  futex \- fast user-space locking
-.B #include <linux/futex.h>
-.B #include <stdint.h>
-.B #include <sys/time.h>
+.BR "#include <linux/futex.h>" "      /* Definition of " FUTEX_* " constants */"
+.BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
+.B #include <unistd.h>
-.BI "long futex(uint32_t *" uaddr ", int " futex_op ", uint32_t " val ,
-.BI "          const struct timespec *" timeout , \
+.BI "long syscall(SYS_futex, uint32_t *" uaddr ", int " futex_op \
+", uint32_t " val ,
+.BI "             const struct timespec *" timeout , \
 " \fR  /* or: \fBuint32_t \fIval2\fP */"
-.BI "          uint32_t *" uaddr2 ", uint32_t " val3 );
+.BI "             uint32_t *" uaddr2 ", uint32_t " val3 );
 .IR Note :
-There is no glibc wrapper for this system call; see NOTES.
+glibc provides no wrapper for
+.BR futex (),
+necessitating the use of
+.BR syscall (2).
 .BR futex ()
@@ -1695,9 +1699,6 @@  and a sixth argument was added in Linux 2.6.7.
 This system call is Linux-specific.
-Glibc does not provide a wrapper for this system call; call it using
-.BR syscall (2).
 Several higher-level programming abstractions are implemented via futexes,
 including POSIX semaphores and
 various POSIX threads synchronization mechanisms