aboutsummaryrefslogtreecommitdiffstats
path: root/man2
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-05-10 19:55:10 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2021-05-11 17:18:08 +1200
commit0aa385fe2517ebe598e5bbf786d1c48c944bc187 (patch)
treea806831bc2f85fff4e6e6eb1674bd5159da5ed7a /man2
parent1cf69258ad61c546bd4145b45f1e77b8510cd876 (diff)
downloadman-pages-0aa385fe2517ebe598e5bbf786d1c48c944bc187.tar.gz
futex.2: Use syscall(SYS_...); for system calls without a wrapper
At the same time, document only headers that are required for calling the function, or those that are specific to the function: <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> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Diffstat (limited to 'man2')
-rw-r--r--man2/futex.221
1 files changed, 11 insertions, 10 deletions
diff --git a/man2/futex.2 b/man2/futex.2
index 389c25224b..ada96c517d 100644
--- a/man2/futex.2
+++ b/man2/futex.2
@@ -25,18 +25,22 @@ futex \- fast user-space locking
.SH SYNOPSIS
.nf
.PP
-.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>
.PP
-.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 );
.fi
.PP
.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).
.SH DESCRIPTION
The
.BR futex ()
@@ -1695,9 +1699,6 @@ and a sixth argument was added in Linux 2.6.7.
.SH CONFORMING TO
This system call is Linux-specific.
.SH NOTES
-Glibc does not provide a wrapper for this system call; call it using
-.BR syscall (2).
-.PP
Several higher-level programming abstractions are implemented via futexes,
including POSIX semaphores and
various POSIX threads synchronization mechanisms