diff options
author | rwatson <rwatson@FreeBSD.org> | 2007-02-26 19:05:13 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2007-02-26 19:05:13 +0000 |
commit | 03d72b2dffe3c18aef2d89e8059a2982ca0a85bc (patch) | |
tree | b0d07b1430cd348c6a16bffecbac2f181cd33755 | |
parent | 7816149d47ddbc9978f65564980e2ba4bdc52693 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/kern/kern_rwlock.c | 7 | ||||
-rw-r--r-- | sys/sys/rwlock.h | 1 |
2 files changed, 8 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) { diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h index 98692a7..13a5436 100644 --- a/sys/sys/rwlock.h +++ b/sys/sys/rwlock.h @@ -124,6 +124,7 @@ void rw_init(struct rwlock *rw, const char *name); void rw_destroy(struct rwlock *rw); void rw_sysinit(void *arg); +int rw_wowned(struct rwlock *rw); void _rw_wlock(struct rwlock *rw, const char *file, int line); void _rw_wunlock(struct rwlock *rw, const char *file, int line); void _rw_rlock(struct rwlock *rw, const char *file, int line); |