summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-11-16 21:51:17 +0000
committerpjd <pjd@FreeBSD.org>2011-11-16 21:51:17 +0000
commita3e664d830a8cf18b39de7e24de3b6945e09d802 (patch)
tree0f843eda4349e58b83edfddade168cfeeb527616
parent8f7796960e5324d9006d05ab644c421a3428a863 (diff)
downloadFreeBSD-src-a3e664d830a8cf18b39de7e24de3b6945e09d802.zip
FreeBSD-src-a3e664d830a8cf18b39de7e24de3b6945e09d802.tar.gz
Constify arguments for locking KPIs where possible.
This enables locking consumers to pass their own structures around as const and be able to assert locks embedded into those structures. Reviewed by: ed, kib, jhb
-rw-r--r--share/man/man9/lock.912
-rw-r--r--share/man/man9/mutex.910
-rw-r--r--share/man/man9/rmlock.96
-rw-r--r--share/man/man9/rwlock.914
-rw-r--r--share/man/man9/sx.96
-rw-r--r--sys/kern/kern_lock.c29
-rw-r--r--sys/kern/kern_mutex.c23
-rw-r--r--sys/kern/kern_rmlock.c10
-rw-r--r--sys/kern/kern_rwlock.c24
-rw-r--r--sys/kern/kern_sx.c22
-rw-r--r--sys/kern/subr_witness.c7
-rw-r--r--sys/sys/lock.h8
-rw-r--r--sys/sys/lockmgr.h6
-rw-r--r--sys/sys/mutex.h2
-rw-r--r--sys/sys/rmlock.h2
-rw-r--r--sys/sys/rwlock.h4
-rw-r--r--sys/sys/sx.h2
17 files changed, 95 insertions, 92 deletions
diff --git a/share/man/man9/lock.9 b/share/man/man9/lock.9
index c94612a..049de42 100644
--- a/share/man/man9/lock.9
+++ b/share/man/man9/lock.9
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 16, 2009
+.Dd November 16, 2011
.Dt LOCK 9
.Os
.Sh NAME
@@ -60,20 +60,20 @@
.Ft void
.Fn lockmgr_disown "struct lock *lkp"
.Ft void
-.Fn lockmgr_printinfo "struct lock *lkp"
+.Fn lockmgr_printinfo "const struct lock *lkp"
.Ft int
-.Fn lockmgr_recursed "struct lock *lkp"
+.Fn lockmgr_recursed "const struct lock *lkp"
.Ft int
.Fn lockmgr_rw "struct lock *lkp" "u_int flags" "struct rwlock *ilk"
.Ft int
-.Fn lockmgr_waiters "struct lock *lkp"
+.Fn lockmgr_waiters "const struct lock *lkp"
.Ft int
-.Fn lockstatus "struct lock *lkp"
+.Fn lockstatus "const struct lock *lkp"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
-.Fn lockmgr_assert "struct lock *lkp" "int what"
+.Fn lockmgr_assert "const struct lock *lkp" "int what"
.Sh DESCRIPTION
The
.Fn lockinit
diff --git a/share/man/man9/mutex.9 b/share/man/man9/mutex.9
index d1e7438..628939f 100644
--- a/share/man/man9/mutex.9
+++ b/share/man/man9/mutex.9
@@ -28,7 +28,7 @@
.\" from BSDI $Id: mutex.4,v 1.1.2.3 1998/04/27 22:53:13 ewv Exp $
.\" $FreeBSD$
.\"
-.Dd December 21, 2006
+.Dd November 16, 2011
.Dt MUTEX 9
.Os
.Sh NAME
@@ -83,16 +83,16 @@
.Ft int
.Fn mtx_sleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
.Ft int
-.Fn mtx_initialized "struct mtx *mutex"
+.Fn mtx_initialized "const struct mtx *mutex"
.Ft int
-.Fn mtx_owned "struct mtx *mutex"
+.Fn mtx_owned "const struct mtx *mutex"
.Ft int
-.Fn mtx_recursed "struct mtx *mutex"
+.Fn mtx_recursed "const struct mtx *mutex"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
-.Fn mtx_assert "struct mtx *mutex" "int what"
+.Fn mtx_assert "const struct mtx *mutex" "int what"
.In sys/kernel.h
.Fn MTX_SYSINIT "name" "struct mtx *mtx" "const char *description" "int opts"
.Sh DESCRIPTION
diff --git a/share/man/man9/rmlock.9 b/share/man/man9/rmlock.9
index 2e68b07..bc20d70 100644
--- a/share/man/man9/rmlock.9
+++ b/share/man/man9/rmlock.9
@@ -26,7 +26,7 @@
.\" $FreeBSD$
.\"
.\" Based on rwlock.9 man page
-.Dd November 10, 2007
+.Dd November 16, 2011
.Dt RMLOCK 9
.Os
.Sh NAME
@@ -63,7 +63,7 @@
.Ft void
.Fn rm_wunlock "struct rmlock *rm"
.Ft int
-.Fn rm_wowned "struct rmlock *rm"
+.Fn rm_wowned "const struct rmlock *rm"
.In sys/kernel.h
.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" "int opts"
.Sh DESCRIPTION
@@ -208,7 +208,7 @@ This functions destroys a lock previously initialized with
The
.Fa rm
lock must be unlocked.
-.It Fn rm_wowned "struct rmlock *rm"
+.It Fn rm_wowned "const struct rmlock *rm"
This function returns a non-zero value if the current thread owns an
exclusive lock on
.Fa rm .
diff --git a/share/man/man9/rwlock.9 b/share/man/man9/rwlock.9
index 5039a42..f7da699 100644
--- a/share/man/man9/rwlock.9
+++ b/share/man/man9/rwlock.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 1, 2008
+.Dd November 16, 2011
.Dt RWLOCK 9
.Os
.Sh NAME
@@ -78,14 +78,14 @@
.Ft int
.Fn rw_sleep "void *chan" "struct rwlock *rw" "int priority" "const char *wmesg" "int timo"
.Ft int
-.Fn rw_initialized "struct rwlock *rw"
+.Fn rw_initialized "const struct rwlock *rw"
.Ft int
-.Fn rw_wowned "struct rwlock *rw"
+.Fn rw_wowned "const struct rwlock *rw"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
-.Fn rw_assert "struct rwlock *rw" "int what"
+.Fn rw_assert "const struct rwlock *rw" "int what"
.In sys/kernel.h
.Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
.Sh DESCRIPTION
@@ -231,7 +231,7 @@ while waiting for an event.
For more details on the parameters to this function,
see
.Xr sleep 9 .
-.It Fn rw_initialized "struct rwlock *rw"
+.It Fn rw_initialized "const struct rwlock *rw"
This function returns non-zero if
.Fa rw
has been initialized, and zero otherwise.
@@ -241,11 +241,11 @@ This functions destroys a lock previously initialized with
The
.Fa rw
lock must be unlocked.
-.It Fn rw_wowned "struct rwlock *rw"
+.It Fn rw_wowned "const struct rwlock *rw"
This function returns a non-zero value if the current thread owns an
exclusive lock on
.Fa rw .
-.It Fn rw_assert "struct rwlock *rw" "int what"
+.It Fn rw_assert "const struct rwlock *rw" "int what"
This function allows assertions specified in
.Fa what
to be made about
diff --git a/share/man/man9/sx.9 b/share/man/man9/sx.9
index c75c6a7..b998749 100644
--- a/share/man/man9/sx.9
+++ b/share/man/man9/sx.9
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 28, 2009
+.Dd November 16, 2011
.Dt SX 9
.Os
.Sh NAME
@@ -88,12 +88,12 @@
.Ft "struct thread *"
.Fn sx_xholder "struct sx *sx"
.Ft int
-.Fn sx_xlocked "struct sx *sx"
+.Fn sx_xlocked "const struct sx *sx"
.Pp
.Cd "options INVARIANTS"
.Cd "options INVARIANT_SUPPORT"
.Ft void
-.Fn sx_assert "struct sx *sx" "int what"
+.Fn sx_assert "const struct sx *sx" "int what"
.In sys/kernel.h
.Fn SX_SYSINIT "name" "struct sx *sx" "const char *description"
.Sh DESCRIPTION
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index ddd55bb..459811e 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -131,15 +131,16 @@ CTASSERT(LK_UNLOCKED == (LK_UNLOCKED &
#define lockmgr_xlocked(lk) \
(((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == (uintptr_t)curthread)
-static void assert_lockmgr(struct lock_object *lock, int how);
+static void assert_lockmgr(const struct lock_object *lock, int how);
#ifdef DDB
-static void db_show_lockmgr(struct lock_object *lock);
+static void db_show_lockmgr(const struct lock_object *lock);
#endif
-static void lock_lockmgr(struct lock_object *lock, int how);
+static void lock_lockmgr(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
-static int owner_lockmgr(struct lock_object *lock, struct thread **owner);
+static int owner_lockmgr(const struct lock_object *lock,
+ struct thread **owner);
#endif
-static int unlock_lockmgr(struct lock_object *lock);
+static int unlock_lockmgr(struct lock_object *lock);
struct lock_class lock_class_lockmgr = {
.lc_name = "lockmgr",
@@ -165,7 +166,7 @@ SYSCTL_UINT(_debug_lockmgr, OID_AUTO, loops, CTLFLAG_RW, &alk_loops, 0, "");
#endif
static __inline struct thread *
-lockmgr_xholder(struct lock *lk)
+lockmgr_xholder(const struct lock *lk)
{
uintptr_t x;
@@ -335,7 +336,7 @@ wakeupshlk(struct lock *lk, const char *file, int line)
}
static void
-assert_lockmgr(struct lock_object *lock, int what)
+assert_lockmgr(const struct lock_object *lock, int what)
{
panic("lockmgr locks do not support assertions");
@@ -357,7 +358,7 @@ unlock_lockmgr(struct lock_object *lock)
#ifdef KDTRACE_HOOKS
static int
-owner_lockmgr(struct lock_object *lock, struct thread **owner)
+owner_lockmgr(const struct lock_object *lock, struct thread **owner)
{
panic("lockmgr locks do not support owner inquiring");
@@ -1260,7 +1261,7 @@ _lockmgr_disown(struct lock *lk, const char *file, int line)
}
void
-lockmgr_printinfo(struct lock *lk)
+lockmgr_printinfo(const struct lock *lk)
{
struct thread *td;
uintptr_t x;
@@ -1289,7 +1290,7 @@ lockmgr_printinfo(struct lock *lk)
}
int
-lockstatus(struct lock *lk)
+lockstatus(const struct lock *lk)
{
uintptr_t v, x;
int ret;
@@ -1319,7 +1320,7 @@ FEATURE(invariant_support,
#endif
void
-_lockmgr_assert(struct lock *lk, int what, const char *file, int line)
+_lockmgr_assert(const struct lock *lk, int what, const char *file, int line)
{
int slocked = 0;
@@ -1412,12 +1413,12 @@ lockmgr_chain(struct thread *td, struct thread **ownerp)
}
static void
-db_show_lockmgr(struct lock_object *lock)
+db_show_lockmgr(const struct lock_object *lock)
{
struct thread *td;
- struct lock *lk;
+ const struct lock *lk;
- lk = (struct lock *)lock;
+ lk = (const struct lock *)lock;
db_printf(" state: ");
if (lk->lk_lock == LK_UNLOCKED)
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 041b480..7666116 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -85,14 +85,15 @@ __FBSDID("$FreeBSD$");
#define mtx_owner(m) ((struct thread *)((m)->mtx_lock & ~MTX_FLAGMASK))
-static void assert_mtx(struct lock_object *lock, int what);
+static void assert_mtx(const struct lock_object *lock, int what);
#ifdef DDB
-static void db_show_mtx(struct lock_object *lock);
+static void db_show_mtx(const struct lock_object *lock);
#endif
static void lock_mtx(struct lock_object *lock, int how);
static void lock_spin(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
-static int owner_mtx(struct lock_object *lock, struct thread **owner);
+static int owner_mtx(const struct lock_object *lock,
+ struct thread **owner);
#endif
static int unlock_mtx(struct lock_object *lock);
static int unlock_spin(struct lock_object *lock);
@@ -134,10 +135,10 @@ struct mtx blocked_lock;
struct mtx Giant;
void
-assert_mtx(struct lock_object *lock, int what)
+assert_mtx(const struct lock_object *lock, int what)
{
- mtx_assert((struct mtx *)lock, what);
+ mtx_assert((const struct mtx *)lock, what);
}
void
@@ -174,9 +175,9 @@ unlock_spin(struct lock_object *lock)
#ifdef KDTRACE_HOOKS
int
-owner_mtx(struct lock_object *lock, struct thread **owner)
+owner_mtx(const struct lock_object *lock, struct thread **owner)
{
- struct mtx *m = (struct mtx *)lock;
+ const struct mtx *m = (const struct mtx *)lock;
*owner = mtx_owner(m);
return (mtx_unowned(m) == 0);
@@ -693,7 +694,7 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
*/
#ifdef INVARIANT_SUPPORT
void
-_mtx_assert(struct mtx *m, int what, const char *file, int line)
+_mtx_assert(const struct mtx *m, int what, const char *file, int line)
{
if (panicstr != NULL || dumping)
@@ -871,12 +872,12 @@ mutex_init(void)
#ifdef DDB
void
-db_show_mtx(struct lock_object *lock)
+db_show_mtx(const struct lock_object *lock)
{
struct thread *td;
- struct mtx *m;
+ const struct mtx *m;
- m = (struct mtx *)lock;
+ m = (const struct mtx *)lock;
db_printf(" flags: {");
if (LOCK_CLASS(lock) == &lock_class_mtx_spin)
diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index 1c7337d..181825a 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -69,10 +69,10 @@ static __inline void compiler_memory_barrier(void) {
__asm __volatile("":::"memory");
}
-static void assert_rm(struct lock_object *lock, int what);
+static void assert_rm(const struct lock_object *lock, int what);
static void lock_rm(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
-static int owner_rm(struct lock_object *lock, struct thread **owner);
+static int owner_rm(const struct lock_object *lock, struct thread **owner);
#endif
static int unlock_rm(struct lock_object *lock);
@@ -93,7 +93,7 @@ struct lock_class lock_class_rm = {
};
static void
-assert_rm(struct lock_object *lock, int what)
+assert_rm(const struct lock_object *lock, int what)
{
panic("assert_rm called");
@@ -115,7 +115,7 @@ unlock_rm(struct lock_object *lock)
#ifdef KDTRACE_HOOKS
static int
-owner_rm(struct lock_object *lock, struct thread **owner)
+owner_rm(const struct lock_object *lock, struct thread **owner)
{
panic("owner_rm called");
@@ -227,7 +227,7 @@ rm_destroy(struct rmlock *rm)
}
int
-rm_wowned(struct rmlock *rm)
+rm_wowned(const struct rmlock *rm)
{
if (rm->lock_object.lo_flags & RM_SLEEPABLE)
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c
index 1037f34..a4d3e96 100644
--- a/sys/kern/kern_rwlock.c
+++ b/sys/kern/kern_rwlock.c
@@ -67,12 +67,12 @@ SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, "");
#ifdef DDB
#include <ddb/ddb.h>
-static void db_show_rwlock(struct lock_object *lock);
+static void db_show_rwlock(const struct lock_object *lock);
#endif
-static void assert_rw(struct lock_object *lock, int what);
+static void assert_rw(const struct lock_object *lock, int what);
static void lock_rw(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
-static int owner_rw(struct lock_object *lock, struct thread **owner);
+static int owner_rw(const struct lock_object *lock, struct thread **owner);
#endif
static int unlock_rw(struct lock_object *lock);
@@ -121,10 +121,10 @@ struct lock_class lock_class_rw = {
#endif
void
-assert_rw(struct lock_object *lock, int what)
+assert_rw(const struct lock_object *lock, int what)
{
- rw_assert((struct rwlock *)lock, what);
+ rw_assert((const struct rwlock *)lock, what);
}
void
@@ -157,9 +157,9 @@ unlock_rw(struct lock_object *lock)
#ifdef KDTRACE_HOOKS
int
-owner_rw(struct lock_object *lock, struct thread **owner)
+owner_rw(const struct lock_object *lock, struct thread **owner)
{
- struct rwlock *rw = (struct rwlock *)lock;
+ const struct rwlock *rw = (const struct rwlock *)lock;
uintptr_t x = rw->rw_lock;
*owner = rw_wowner(rw);
@@ -223,7 +223,7 @@ rw_sysinit_flags(void *arg)
}
int
-rw_wowned(struct rwlock *rw)
+rw_wowned(const struct rwlock *rw)
{
return (rw_wowner(rw) == curthread);
@@ -1011,7 +1011,7 @@ out:
* thread owns an rlock.
*/
void
-_rw_assert(struct rwlock *rw, int what, const char *file, int line)
+_rw_assert(const struct rwlock *rw, int what, const char *file, int line)
{
if (panicstr != NULL)
@@ -1084,12 +1084,12 @@ _rw_assert(struct rwlock *rw, int what, const char *file, int line)
#ifdef DDB
void
-db_show_rwlock(struct lock_object *lock)
+db_show_rwlock(const struct lock_object *lock)
{
- struct rwlock *rw;
+ const struct rwlock *rw;
struct thread *td;
- rw = (struct rwlock *)lock;
+ rw = (const struct rwlock *)lock;
db_printf(" state: ");
if (rw->rw_lock == RW_UNLOCKED)
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 1e4430a..9230beb 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -105,13 +105,13 @@ CTASSERT((SX_NOADAPTIVE & LO_CLASSFLAGS) == SX_NOADAPTIVE);
#define sx_recurse lock_object.lo_data
#define sx_recursed(sx) ((sx)->sx_recurse != 0)
-static void assert_sx(struct lock_object *lock, int what);
+static void assert_sx(const struct lock_object *lock, int what);
#ifdef DDB
-static void db_show_sx(struct lock_object *lock);
+static void db_show_sx(const struct lock_object *lock);
#endif
static void lock_sx(struct lock_object *lock, int how);
#ifdef KDTRACE_HOOKS
-static int owner_sx(struct lock_object *lock, struct thread **owner);
+static int owner_sx(const struct lock_object *lock, struct thread **owner);
#endif
static int unlock_sx(struct lock_object *lock);
@@ -142,10 +142,10 @@ SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, "");
#endif
void
-assert_sx(struct lock_object *lock, int what)
+assert_sx(const struct lock_object *lock, int what)
{
- sx_assert((struct sx *)lock, what);
+ sx_assert((const struct sx *)lock, what);
}
void
@@ -178,9 +178,9 @@ unlock_sx(struct lock_object *lock)
#ifdef KDTRACE_HOOKS
int
-owner_sx(struct lock_object *lock, struct thread **owner)
+owner_sx(const struct lock_object *lock, struct thread **owner)
{
- struct sx *sx = (struct sx *)lock;
+ const struct sx *sx = (const struct sx *)lock;
uintptr_t x = sx->sx_lock;
*owner = (struct thread *)SX_OWNER(x);
@@ -1005,7 +1005,7 @@ _sx_sunlock_hard(struct sx *sx, const char *file, int line)
* thread owns an slock.
*/
void
-_sx_assert(struct sx *sx, int what, const char *file, int line)
+_sx_assert(const struct sx *sx, int what, const char *file, int line)
{
#ifndef WITNESS
int slocked = 0;
@@ -1088,12 +1088,12 @@ _sx_assert(struct sx *sx, int what, const char *file, int line)
#ifdef DDB
static void
-db_show_sx(struct lock_object *lock)
+db_show_sx(const struct lock_object *lock)
{
struct thread *td;
- struct sx *sx;
+ const struct sx *sx;
- sx = (struct sx *)lock;
+ sx = (const struct sx *)lock;
db_printf(" state: ");
if (sx->sx_lock == SX_LOCK_UNLOCKED)
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index 130c7b3..bbf9a97 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -332,7 +332,7 @@ static void depart(struct witness *w);
static struct witness *enroll(const char *description,
struct lock_class *lock_class);
static struct lock_instance *find_instance(struct lock_list_entry *list,
- struct lock_object *lock);
+ const struct lock_object *lock);
static int isitmychild(struct witness *parent, struct witness *child);
static int isitmydescendant(struct witness *parent, struct witness *child);
static void itismychild(struct witness *parent, struct witness *child);
@@ -2063,7 +2063,7 @@ witness_lock_list_free(struct lock_list_entry *lle)
}
static struct lock_instance *
-find_instance(struct lock_list_entry *list, struct lock_object *lock)
+find_instance(struct lock_list_entry *list, const struct lock_object *lock)
{
struct lock_list_entry *lle;
struct lock_instance *instance;
@@ -2210,7 +2210,8 @@ witness_restore(struct lock_object *lock, const char *file, int line)
}
void
-witness_assert(struct lock_object *lock, int flags, const char *file, int line)
+witness_assert(const struct lock_object *lock, int flags, const char *file,
+ int line)
{
#ifdef INVARIANT_SUPPORT
struct lock_instance *instance;
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 7ad9c58..303717f 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -58,10 +58,10 @@ struct thread;
struct lock_class {
const char *lc_name;
u_int lc_flags;
- void (*lc_assert)(struct lock_object *lock, int what);
- void (*lc_ddb_show)(struct lock_object *lock);
+ void (*lc_assert)(const struct lock_object *lock, int what);
+ void (*lc_ddb_show)(const struct lock_object *lock);
void (*lc_lock)(struct lock_object *lock, int how);
- int (*lc_owner)(struct lock_object *lock, struct thread **owner);
+ int (*lc_owner)(const struct lock_object *lock, struct thread **owner);
int (*lc_unlock)(struct lock_object *lock);
};
@@ -215,7 +215,7 @@ void witness_restore(struct lock_object *, const char *, int);
int witness_list_locks(struct lock_list_entry **,
int (*)(const char *, ...));
int witness_warn(int, struct lock_object *, const char *, ...);
-void witness_assert(struct lock_object *, int, const char *, int);
+void witness_assert(const struct lock_object *, int, const char *, int);
void witness_display_spinlock(struct lock_object *, struct thread *,
int (*)(const char *, ...));
int witness_line(struct lock_object *);
diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h
index 4c3a272..1a2c92c 100644
--- a/sys/sys/lockmgr.h
+++ b/sys/sys/lockmgr.h
@@ -69,7 +69,7 @@ struct thread;
int __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
const char *wmesg, int prio, int timo, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _lockmgr_assert(struct lock *lk, int what, const char *file, int line);
+void _lockmgr_assert(const struct lock *lk, int what, const char *file, int line);
#endif
void _lockmgr_disown(struct lock *lk, const char *file, int line);
@@ -82,8 +82,8 @@ void lockinit(struct lock *lk, int prio, const char *wmesg, int timo,
#ifdef DDB
int lockmgr_chain(struct thread *td, struct thread **ownerp);
#endif
-void lockmgr_printinfo(struct lock *lk);
-int lockstatus(struct lock *lk);
+void lockmgr_printinfo(const struct lock *lk);
+int lockstatus(const struct lock *lk);
/*
* As far as the ilk can be a static NULL pointer these functions need a
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index e7e0b28..7a9d5d7 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -105,7 +105,7 @@ void _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file,
void _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file,
int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _mtx_assert(struct mtx *m, int what, const char *file, int line);
+void _mtx_assert(const struct mtx *m, int what, const char *file, int line);
#endif
void _thread_lock_flags(struct thread *, int, const char *, int);
diff --git a/sys/sys/rmlock.h b/sys/sys/rmlock.h
index ef5776b..0ae2099 100644
--- a/sys/sys/rmlock.h
+++ b/sys/sys/rmlock.h
@@ -49,7 +49,7 @@
void rm_init(struct rmlock *rm, const char *name);
void rm_init_flags(struct rmlock *rm, const char *name, int opts);
void rm_destroy(struct rmlock *rm);
-int rm_wowned(struct rmlock *rm);
+int rm_wowned(const struct rmlock *rm);
void rm_sysinit(void *arg);
void rm_sysinit_flags(void *arg);
diff --git a/sys/sys/rwlock.h b/sys/sys/rwlock.h
index ad17826..83bf57d 100644
--- a/sys/sys/rwlock.h
+++ b/sys/sys/rwlock.h
@@ -127,7 +127,7 @@ void rw_init_flags(struct rwlock *rw, const char *name, int opts);
void rw_destroy(struct rwlock *rw);
void rw_sysinit(void *arg);
void rw_sysinit_flags(void *arg);
-int rw_wowned(struct rwlock *rw);
+int rw_wowned(const struct rwlock *rw);
void _rw_wlock(struct rwlock *rw, const char *file, int line);
int _rw_try_wlock(struct rwlock *rw, const char *file, int line);
void _rw_wunlock(struct rwlock *rw, const char *file, int line);
@@ -141,7 +141,7 @@ void _rw_wunlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,
int _rw_try_upgrade(struct rwlock *rw, const char *file, int line);
void _rw_downgrade(struct rwlock *rw, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _rw_assert(struct rwlock *rw, int what, const char *file, int line);
+void _rw_assert(const struct rwlock *rw, int what, const char *file, int line);
#endif
/*
diff --git a/sys/sys/sx.h b/sys/sys/sx.h
index da16b60..3bef1c5 100644
--- a/sys/sys/sx.h
+++ b/sys/sys/sx.h
@@ -109,7 +109,7 @@ void _sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int
line);
void _sx_sunlock_hard(struct sx *sx, const char *file, int line);
#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-void _sx_assert(struct sx *sx, int what, const char *file, int line);
+void _sx_assert(const struct sx *sx, int what, const char *file, int line);
#endif
#ifdef DDB
int sx_chain(struct thread *td, struct thread **ownerp);
OpenPOWER on IntegriCloud