Module Name: src
Committed By: riastradh
Date: Tue Apr 28 17:27:03 UTC 2020
Modified Files:
src/sys/kern: sys_futex.c
src/tests/lib/libc/sys: t_futex_ops.c
Log Message:
Make FUTEX_WAIT_BITSET(bitset=0) fail with EINVAL to match Linux.
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/sys_futex.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_futex_ops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/sys_futex.c
diff -u src/sys/kern/sys_futex.c:1.6 src/sys/kern/sys_futex.c:1.7
--- src/sys/kern/sys_futex.c:1.6 Tue Apr 28 16:22:25 2020
+++ src/sys/kern/sys_futex.c Tue Apr 28 17:27:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_futex.c,v 1.6 2020/04/28 16:22:25 riastradh Exp $ */
+/* $NetBSD: sys_futex.c,v 1.7 2020/04/28 17:27:03 riastradh Exp $ */
/*-
* Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.6 2020/04/28 16:22:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.7 2020/04/28 17:27:03 riastradh Exp $");
/*
* Futexes
@@ -1202,7 +1202,7 @@ futex_func_wait(bool shared, int *uaddr,
* us, then don't set anything up to wait -- just stop here.
*/
if (val3 == 0)
- return 0;
+ return EINVAL;
/* Optimistically test before anything else. */
if (!futex_test(uaddr, val))
Index: src/tests/lib/libc/sys/t_futex_ops.c
diff -u src/tests/lib/libc/sys/t_futex_ops.c:1.1 src/tests/lib/libc/sys/t_futex_ops.c:1.2
--- src/tests/lib/libc/sys/t_futex_ops.c:1.1 Sun Apr 26 18:53:33 2020
+++ src/tests/lib/libc/sys/t_futex_ops.c Tue Apr 28 17:27:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_futex_ops.c,v 1.1 2020/04/26 18:53:33 thorpej Exp $ */
+/* $NetBSD: t_futex_ops.c,v 1.2 2020/04/28 17:27:03 riastradh Exp $ */
/*-
* Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2019, 2020\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_futex_ops.c,v 1.1 2020/04/26 18:53:33 thorpej Exp $");
+__RCSID("$NetBSD: t_futex_ops.c,v 1.2 2020/04/28 17:27:03 riastradh Exp $");
#include <sys/fcntl.h>
#include <sys/mman.h>
@@ -632,9 +632,9 @@ ATF_TC_BODY(futex_wait_pointless_bitset,
{
futex_word = 1;
- /* This won't block because no bits are set. */
- ATF_REQUIRE(__futex(&futex_word, FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG,
- 1, NULL, NULL, 0, 0) == 0);
+ ATF_REQUIRE_ERRNO(EINVAL,
+ __futex(&futex_word, FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG,
+ 1, NULL, NULL, 0, 0) == -1);
}
static void