Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys add KERNEL_LOCKED_P() macro
details: https://anonhg.NetBSD.org/src/rev/dec89aa64249
branches: trunk
changeset: 771641:dec89aa64249
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Nov 27 03:24:00 2011 +0000
description:
add KERNEL_LOCKED_P() macro
diffstat:
sys/kern/kern_lock.c | 10 ++++++++--
sys/sys/systm.h | 5 ++++-
2 files changed, 12 insertions(+), 3 deletions(-)
diffs (57 lines):
diff -r 511a4f7b7103 -r dec89aa64249 sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c Sun Nov 27 00:53:52 2011 +0000
+++ b/sys/kern/kern_lock.c Sun Nov 27 03:24:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lock.c,v 1.151 2011/07/17 20:54:52 joerg Exp $ */
+/* $NetBSD: kern_lock.c,v 1.152 2011/11/27 03:24:00 jmcneill Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.151 2011/07/17 20:54:52 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.152 2011/11/27 03:24:00 jmcneill Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -305,3 +305,9 @@
if (countp != NULL)
*countp = olocks;
}
+
+bool
+_kernel_locked_p(void)
+{
+ return __SIMPLELOCK_LOCKED_P(kernel_lock);
+}
diff -r 511a4f7b7103 -r dec89aa64249 sys/sys/systm.h
--- a/sys/sys/systm.h Sun Nov 27 00:53:52 2011 +0000
+++ b/sys/sys/systm.h Sun Nov 27 03:24:00 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: systm.h,v 1.252 2011/11/21 04:36:06 christos Exp $ */
+/* $NetBSD: systm.h,v 1.253 2011/11/27 03:24:00 jmcneill Exp $ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
@@ -489,6 +489,7 @@
void kernel_lock_init(void);
void _kernel_lock(int);
void _kernel_unlock(int, int *);
+bool _kernel_locked_p(void);
#ifdef _KERNEL
void kernconfig_lock_init(void);
@@ -504,9 +505,11 @@
_kernel_lock((count)); \
} while (/* CONSTCOND */ 0)
#define KERNEL_UNLOCK(all, lwp, p) _kernel_unlock((all), (p))
+#define KERNEL_LOCKED_P() _kernel_locked_p()
#else
#define KERNEL_LOCK(count, lwp) do {(void)(count); (void)(lwp);} while (/* CONSTCOND */ 0) /*NOP*/
#define KERNEL_UNLOCK(all, lwp, ptr) do {(void)(all); (void)(lwp); (void)(ptr);} while (/* CONSTCOND */ 0) /*NOP*/
+#define KERNEL_LOCKED_P() do { } while (/* CONSTCOND */ 0) /*NOP*/
#endif
#define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL)
Home |
Main Index |
Thread Index |
Old Index