Source-Changes-HG archive

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

[src/thorpej-futex]: src/sys/sys Add definitions for FUTEX_NETBSD_RW_WAIT and...



details:   https://anonhg.NetBSD.org/src/rev/f210216a7476
branches:  thorpej-futex
changeset: 961119:f210216a7476
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Nov 03 16:05:51 2020 +0000

description:
Add definitions for FUTEX_NETBSD_RW_WAIT and FUTEX_NETBSD_RW_HANDOFF.
(Forgot to commit this file previously.)

diffstat:

 sys/sys/futex.h |  18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r e3343ca04f38 -r f210216a7476 sys/sys/futex.h
--- a/sys/sys/futex.h   Sun Nov 01 15:22:58 2020 +0000
+++ b/sys/sys/futex.h   Tue Nov 03 16:05:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: futex.h,v 1.4 2020/05/05 15:25:18 riastradh Exp $      */
+/*     $NetBSD: futex.h,v 1.4.2.1 2020/11/03 16:05:51 thorpej Exp $    */
 
 /*-
  * Copyright (c) 2018, 2019 The NetBSD Foundation, Inc.
@@ -86,6 +86,10 @@
 #define FUTEX_WAIT_REQUEUE_PI           11
 #define FUTEX_CMP_REQUEUE_PI            12
 
+/* These futex operations are NetBSD extensions. */
+#define FUTEX_NETBSD_RW_WAIT            64
+#define FUTEX_NETBSD_RW_HANDOFF                 65
+
 #define FUTEX_PRIVATE_FLAG             __BIT(7)
 #define FUTEX_CLOCK_REALTIME           __BIT(8)
 
@@ -133,6 +137,18 @@
 #define FUTEX_BITSET_MATCH_ANY  ((int)__BITS(0,31))
 
 /*
+ * The FUTEX_NETBSD_RW_WAIT and FUTEX_NETBSD_RW_HANDOFF operations
+ * define specific meanings for some of the futex word bits and val3.
+ *
+ * (futex & FUTEX_TID_MASK) is the owner in the write-locked case,
+ * and the count of readers in the read-locked case.
+ */
+#define FUTEX_RW_WRITE_LOCKED  FUTEX_SYNCOBJ_1
+#define FUTEX_RW_WRITE_WANTED  FUTEX_SYNCOBJ_0
+#define FUTEX_RW_READER                0
+#define FUTEX_RW_WRITER                1
+
+/*
  * The robust futex ABI consists of an array of 3 longwords, the address
  * of which is registered with the kernel on a per-thread basis:
  *



Home | Main Index | Thread Index | Old Index