From 5f6edc87c039a326278b5488d465f3b93e7e66c6 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 26 May 2021 18:12:00 +0000 Subject: 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@ --- lib/libc/sys/futex.2 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') 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: -- cgit v1.2.3