I noticed that 'const' is used for both 'one' and 'zero' variables in the Examples section demo code of manpage 'futex(2)'.
The variables are both used in calls to 'atomic_compare_exchange_strong()' where the 'const' is discarded as it may write to the 'expected' parameter during a "failure" case.
Attached is the trivial patch to remove the offending qualifiers.
Cheers
diff --git a/man/man2/futex.2 b/man/man2/futex.2
index 70c3956ab..331646218 100644
--- a/man/man2/futex.2
+++ b/man/man2/futex.2
@@ -1822,8 +1822,8 @@ futex(uint32_t *uaddr, int futex_op, uint32_t val,
static void
fwait(uint32_t *futexp)
{
- long s;
- const uint32_t one = 1;
+ long s;
+ uint32_t one = 1;
\&
/* atomic_compare_exchange_strong(ptr, oldval, newval)
atomically performs the equivalent of:
@@ -1854,8 +1854,8 @@ fwait(uint32_t *futexp)
static void
fpost(uint32_t *futexp)
{
- long s;
- const uint32_t zero = 0;
+ long s;
+ uint32_t zero = 0;
\&
/* atomic_compare_exchange_strong() was described
in comments above. */