diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-05-26 18:12:00 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2021-05-26 18:12:00 +0000 |
commit | 5f6edc87c039a326278b5488d465f3b93e7e66c6 (patch) | |
tree | 000b6778cd3b601b925cfe41b3e05187582e20d8 /lib/libc/sys | |
parent | f0f3f7a34d266055284ff12f8a5984f03d28ba35 (diff) |
Fix the return value for the FUTEX_WAIT/FUTEX_WAIT_PRIVATE futex(2)
operation. System calls should return -1 and set errno when they fail.
They should not return an errno value directly. This matches how
the Linux version of futex(2) behaves and what Mesa expects. This fixes
a bug in Mesa where a timeout wouldn't be reported properly.
Technically this is an ABI break. But libc and libpthread were changed
to be compatible with both the old and new ABI, and code outside of base
almost certainly expects Linux compatible behaviour. If you have not
rebuilt libc and the last few days, upgrade using a snap.
Mesa issue discovered by jsg@
ok mpi@, deraadt@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/futex.2 | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/sys/futex.2 b/lib/libc/sys/futex.2 index 6dfc12f0617..dfe45adc4ce 100644 --- a/lib/libc/sys/futex.2 +++ b/lib/libc/sys/futex.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: futex.2,v 1.5 2019/01/18 05:06:37 cheloha Exp $ +.\" $OpenBSD: futex.2,v 1.6 2021/05/26 18:11:59 kettenis Exp $ .\" .\" Copyright (c) 2017 Martin Pieuchot .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: January 18 2019 $ +.Dd $Mdocdate: May 26 2021 $ .Dt FUTEX 2 .Os .Sh NAME @@ -98,7 +98,10 @@ returns zero if woken by a matching .Dv FUTEX_WAKE or .Dv FUTEX_REQUEUE -call, otherwise an error number is returned to indicate the error. +call. +Otherwise, a value of \-1 is returned and +.Va errno +is set to indicate the error. .Sh ERRORS .Fn futex will fail if: |