Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Make FUTEX_WAIT_BITSET(bitset=0) fail with EINVAL to match L...



details:   https://anonhg.NetBSD.org/src/rev/efb5e5401c5b
branches:  trunk
changeset: 971580:efb5e5401c5b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Apr 28 17:27:03 2020 +0000

description:
Make FUTEX_WAIT_BITSET(bitset=0) fail with EINVAL to match Linux.

diffstat:

 sys/kern/sys_futex.c             |   6 +++---
 tests/lib/libc/sys/t_futex_ops.c |  10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diffs (58 lines):

diff -r 414e807f87c6 -r efb5e5401c5b sys/kern/sys_futex.c
--- a/sys/kern/sys_futex.c      Tue Apr 28 17:26:01 2020 +0000
+++ b/sys/kern/sys_futex.c      Tue Apr 28 17:27:03 2020 +0000
@@ -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 @@
         * 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))
diff -r 414e807f87c6 -r efb5e5401c5b tests/lib/libc/sys/t_futex_ops.c
--- a/tests/lib/libc/sys/t_futex_ops.c  Tue Apr 28 17:26:01 2020 +0000
+++ b/tests/lib/libc/sys/t_futex_ops.c  Tue Apr 28 17:27:03 2020 +0000
@@ -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 @@
 {
 
        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



Home | Main Index | Thread Index | Old Index