summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2007-02-26 19:05:13 +0000
committerrwatson <rwatson@FreeBSD.org>2007-02-26 19:05:13 +0000
commit03d72b2dffe3c18aef2d89e8059a2982ca0a85bc (patch)
treeb0d07b1430cd348c6a16bffecbac2f181cd33755 /sys/kern
parent7816149d47ddbc9978f65564980e2ba4bdc52693 (diff)
downloadFreeBSD-src-03d72b2dffe3c18aef2d89e8059a2982ca0a85bc.zip
FreeBSD-src-03d72b2dffe3c18aef2d89e8059a2982ca0a85bc.tar.gz
Add rw_wowned() interface to rwlock(9), allowing a kernel thread to
determine if it holds an exclusive rwlock reference or not. This is non-ideal, but recursion scenarios in the network stack currently require it. Approved by: jhb
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_rwlock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index a59de60..18e9a54 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -108,6 +108,13 @@ rw_sysinit(void *arg)
rw_init(args->ra_rw, args->ra_desc);
}
+int
+rw_wowned(struct rwlock *rw)
+{
+
+ return (rw_wowner(rw) == curthread);
+}
+
void
_rw_wlock(struct rwlock *rw, const char *file, int line)
{
OpenPOWER on IntegriCloud