Print correct file name and line number in mtx_assert().

Noticed by:	jake
This commit is contained in:
Jason Evans 2001-01-22 05:56:55 +00:00
parent 0c645db4c0
commit 56771ca74b
4 changed files with 20 additions and 21 deletions

View File

@ -794,7 +794,7 @@ mtx_exit_hard(struct mtx *m, int type)
#ifdef INVARIANTS
void
mtx_assert(struct mtx *m, int what)
_mtx_assert(struct mtx *m, int what, const char *file, int line)
{
switch ((what)) {
case MA_OWNED:
@ -802,23 +802,23 @@ mtx_assert(struct mtx *m, int what)
case MA_OWNED | MA_NOTRECURSED:
if (!mtx_owned((m)))
panic("mutex %s not owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
if (mtx_recursed((m))) {
if (((what) & MA_NOTRECURSED) != 0)
panic("mutex %s recursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
} else if (((what) & MA_RECURSED) != 0) {
panic("mutex %s unrecursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
}
break;
case MA_NOTOWNED:
if (mtx_owned((m)))
panic("mutex %s owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
break;
default:
panic("unknown mtx_assert at %s:%d", __FILE__, __LINE__);
panic("unknown mtx_assert at %s:%d", file, line);
}
}
#endif

View File

@ -794,7 +794,7 @@ mtx_exit_hard(struct mtx *m, int type)
#ifdef INVARIANTS
void
mtx_assert(struct mtx *m, int what)
_mtx_assert(struct mtx *m, int what, const char *file, int line)
{
switch ((what)) {
case MA_OWNED:
@ -802,23 +802,23 @@ mtx_assert(struct mtx *m, int what)
case MA_OWNED | MA_NOTRECURSED:
if (!mtx_owned((m)))
panic("mutex %s not owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
if (mtx_recursed((m))) {
if (((what) & MA_NOTRECURSED) != 0)
panic("mutex %s recursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
} else if (((what) & MA_RECURSED) != 0) {
panic("mutex %s unrecursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
}
break;
case MA_NOTOWNED:
if (mtx_owned((m)))
panic("mutex %s owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
break;
default:
panic("unknown mtx_assert at %s:%d", __FILE__, __LINE__);
panic("unknown mtx_assert at %s:%d", file, line);
}
}
#endif

View File

@ -794,7 +794,7 @@ mtx_exit_hard(struct mtx *m, int type)
#ifdef INVARIANTS
void
mtx_assert(struct mtx *m, int what)
_mtx_assert(struct mtx *m, int what, const char *file, int line)
{
switch ((what)) {
case MA_OWNED:
@ -802,23 +802,23 @@ mtx_assert(struct mtx *m, int what)
case MA_OWNED | MA_NOTRECURSED:
if (!mtx_owned((m)))
panic("mutex %s not owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
if (mtx_recursed((m))) {
if (((what) & MA_NOTRECURSED) != 0)
panic("mutex %s recursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
} else if (((what) & MA_RECURSED) != 0) {
panic("mutex %s unrecursed at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
}
break;
case MA_NOTOWNED:
if (mtx_owned((m)))
panic("mutex %s owned at %s:%d",
(m)->mtx_description, __FILE__, __LINE__);
(m)->mtx_description, file, line);
break;
default:
panic("unknown mtx_assert at %s:%d", __FILE__, __LINE__);
panic("unknown mtx_assert at %s:%d", file, line);
}
}
#endif

View File

@ -185,7 +185,8 @@ do { \
#define MA_NOTOWNED 2
#define MA_RECURSED 4
#define MA_NOTRECURSED 8
void mtx_assert(struct mtx *m, int what);
void _mtx_assert(struct mtx *m, int what, const char *file, int line);
#define mtx_assert(m, what) _mtx_assert((m), (what), __FILE__, __LINE__)
#else /* INVARIANTS */
#define mtx_assert(m, what)
#endif /* INVARIANTS */
@ -276,8 +277,6 @@ int witness_sleep(int, struct mtx *, const char *, int);
#define WITNESS_RESTORE(m, n)
#endif /* WITNESS */
/* XXX jasone Move. */
#endif /* _KERNEL */
#endif /* !LOCORE */
#endif /* _SYS_MUTEX_H_ */