mariadb/storage/bdb/lock/lock_stat.c

559 lines
14 KiB
C
Raw Normal View History

2001-03-05 01:42:05 +01:00
/*-
* See the file LICENSE for redistribution information.
*
2005-12-05 19:27:46 +01:00
* Copyright (c) 1996-2005
2001-03-05 01:42:05 +01:00
* Sleepycat Software. All rights reserved.
2005-07-21 00:48:22 +02:00
*
2005-12-05 19:27:46 +01:00
* $Id: lock_stat.c,v 12.11 2005/10/07 20:21:31 ubell Exp $
2001-03-05 01:42:05 +01:00
*/
#include "db_config.h"
#ifndef NO_SYSTEM_INCLUDES
#include <sys/types.h>
2002-10-30 12:57:05 +01:00
#include <string.h>
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
2001-03-05 01:42:05 +01:00
#endif
2002-10-30 12:57:05 +01:00
#include <ctype.h>
2001-03-05 01:42:05 +01:00
#endif
#include "db_int.h"
2002-10-30 12:57:05 +01:00
#include "dbinc/db_shash.h"
#include "dbinc/db_page.h"
#include "dbinc/lock.h"
#include "dbinc/log.h"
#include "dbinc/db_am.h"
2001-03-05 01:42:05 +01:00
2005-07-21 00:48:22 +02:00
#ifdef HAVE_STATISTICS
static void __lock_dump_locker
__P((DB_ENV *, DB_MSGBUF *, DB_LOCKTAB *, DB_LOCKER *));
static void __lock_dump_object __P((DB_LOCKTAB *, DB_MSGBUF *, DB_LOCKOBJ *));
static int __lock_print_all __P((DB_ENV *, u_int32_t));
static int __lock_print_stats __P((DB_ENV *, u_int32_t));
static void __lock_print_header __P((DB_ENV *));
static int __lock_stat __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t));
2001-03-05 01:42:05 +01:00
/*
2005-07-21 00:48:22 +02:00
* __lock_stat_pp --
* DB_ENV->lock_stat pre/post processing.
2002-10-30 12:57:05 +01:00
*
2005-07-21 00:48:22 +02:00
* PUBLIC: int __lock_stat_pp __P((DB_ENV *, DB_LOCK_STAT **, u_int32_t));
2001-03-05 01:42:05 +01:00
*/
int
2005-07-21 00:48:22 +02:00
__lock_stat_pp(dbenv, statp, flags)
2001-03-05 01:42:05 +01:00
DB_ENV *dbenv;
DB_LOCK_STAT **statp;
2002-10-30 12:57:05 +01:00
u_int32_t flags;
2001-03-05 01:42:05 +01:00
{
2005-12-05 19:27:46 +01:00
DB_THREAD_INFO *ip;
int ret;
2001-03-05 01:42:05 +01:00
PANIC_CHECK(dbenv);
2002-10-30 12:57:05 +01:00
ENV_REQUIRES_CONFIG(dbenv,
dbenv->lk_handle, "DB_ENV->lock_stat", DB_INIT_LOCK);
2001-03-05 01:42:05 +01:00
2002-10-30 12:57:05 +01:00
if ((ret = __db_fchk(dbenv,
"DB_ENV->lock_stat", flags, DB_STAT_CLEAR)) != 0)
return (ret);
2001-03-05 01:42:05 +01:00
2005-12-05 19:27:46 +01:00
ENV_ENTER(dbenv, ip);
REPLICATION_WRAP(dbenv, (__lock_stat(dbenv, statp, flags)), ret);
ENV_LEAVE(dbenv, ip);
2005-07-21 00:48:22 +02:00
return (ret);
}
/*
* __lock_stat --
* DB_ENV->lock_stat.
*/
static int
__lock_stat(dbenv, statp, flags)
DB_ENV *dbenv;
DB_LOCK_STAT **statp;
u_int32_t flags;
{
DB_LOCKREGION *region;
DB_LOCKTAB *lt;
DB_LOCK_STAT *stats, tmp;
int ret;
*statp = NULL;
2001-03-05 01:42:05 +01:00
lt = dbenv->lk_handle;
2002-10-30 12:57:05 +01:00
if ((ret = __os_umalloc(dbenv, sizeof(*stats), &stats)) != 0)
2001-03-05 01:42:05 +01:00
return (ret);
/* Copy out the global statistics. */
2005-12-05 19:27:46 +01:00
LOCK_SYSTEM_LOCK(dbenv);
2001-03-05 01:42:05 +01:00
region = lt->reginfo.primary;
2002-10-30 12:57:05 +01:00
memcpy(stats, &region->stat, sizeof(*stats));
stats->st_locktimeout = region->lk_timeout;
stats->st_txntimeout = region->tx_timeout;
2001-03-05 01:42:05 +01:00
2005-12-05 19:27:46 +01:00
__mutex_set_wait_info(dbenv, region->mtx_region,
&stats->st_region_wait, &stats->st_region_nowait);
2001-03-05 01:42:05 +01:00
stats->st_regsize = lt->reginfo.rp->size;
2002-10-30 12:57:05 +01:00
if (LF_ISSET(DB_STAT_CLEAR)) {
tmp = region->stat;
memset(&region->stat, 0, sizeof(region->stat));
2005-12-05 19:27:46 +01:00
__mutex_clear(dbenv, region->mtx_region);
2002-10-30 12:57:05 +01:00
region->stat.st_id = tmp.st_id;
region->stat.st_cur_maxid = tmp.st_cur_maxid;
region->stat.st_maxlocks = tmp.st_maxlocks;
region->stat.st_maxlockers = tmp.st_maxlockers;
region->stat.st_maxobjects = tmp.st_maxobjects;
region->stat.st_nlocks =
region->stat.st_maxnlocks = tmp.st_nlocks;
region->stat.st_nlockers =
region->stat.st_maxnlockers = tmp.st_nlockers;
region->stat.st_nobjects =
region->stat.st_maxnobjects = tmp.st_nobjects;
region->stat.st_nmodes = tmp.st_nmodes;
}
2001-03-05 01:42:05 +01:00
2005-12-05 19:27:46 +01:00
LOCK_SYSTEM_UNLOCK(dbenv);
2001-03-05 01:42:05 +01:00
*statp = stats;
return (0);
}
2005-07-21 00:48:22 +02:00
/*
* __lock_stat_print_pp --
* DB_ENV->lock_stat_print pre/post processing.
*
* PUBLIC: int __lock_stat_print_pp __P((DB_ENV *, u_int32_t));
*/
int
__lock_stat_print_pp(dbenv, flags)
DB_ENV *dbenv;
u_int32_t flags;
{
2005-12-05 19:27:46 +01:00
DB_THREAD_INFO *ip;
int ret;
2005-07-21 00:48:22 +02:00
PANIC_CHECK(dbenv);
ENV_REQUIRES_CONFIG(dbenv,
dbenv->lk_handle, "DB_ENV->lock_stat_print", DB_INIT_LOCK);
#define DB_STAT_LOCK_FLAGS \
(DB_STAT_ALL | DB_STAT_CLEAR | DB_STAT_LOCK_CONF | \
DB_STAT_LOCK_LOCKERS | DB_STAT_LOCK_OBJECTS | DB_STAT_LOCK_PARAMS)
if ((ret = __db_fchk(dbenv, "DB_ENV->lock_stat_print",
flags, DB_STAT_CLEAR | DB_STAT_LOCK_FLAGS)) != 0)
return (ret);
2005-12-05 19:27:46 +01:00
ENV_ENTER(dbenv, ip);
REPLICATION_WRAP(dbenv, (__lock_stat_print(dbenv, flags)), ret);
ENV_LEAVE(dbenv, ip);
2005-07-21 00:48:22 +02:00
return (ret);
}
2001-03-05 01:42:05 +01:00
/*
2005-07-21 00:48:22 +02:00
* __lock_stat_print --
* DB_ENV->lock_stat_print method.
2001-03-05 01:42:05 +01:00
*
2005-07-21 00:48:22 +02:00
* PUBLIC: int __lock_stat_print __P((DB_ENV *, u_int32_t));
2001-03-05 01:42:05 +01:00
*/
2002-10-30 12:57:05 +01:00
int
2005-07-21 00:48:22 +02:00
__lock_stat_print(dbenv, flags)
DB_ENV *dbenv;
u_int32_t flags;
{
u_int32_t orig_flags;
int ret;
orig_flags = flags;
LF_CLR(DB_STAT_CLEAR);
if (flags == 0 || LF_ISSET(DB_STAT_ALL)) {
ret = __lock_print_stats(dbenv, orig_flags);
if (flags == 0 || ret != 0)
return (ret);
}
if (LF_ISSET(DB_STAT_ALL | DB_STAT_LOCK_CONF | DB_STAT_LOCK_LOCKERS |
DB_STAT_LOCK_OBJECTS | DB_STAT_LOCK_PARAMS) &&
(ret = __lock_print_all(dbenv, orig_flags)) != 0)
return (ret);
return (0);
}
/*
* __lock_print_stats --
* Display default lock region statistics.
*/
static int
__lock_print_stats(dbenv, flags)
DB_ENV *dbenv;
u_int32_t flags;
{
DB_LOCK_STAT *sp;
int ret;
if ((ret = __lock_stat(dbenv, &sp, flags)) != 0)
return (ret);
if (LF_ISSET(DB_STAT_ALL))
__db_msg(dbenv, "Default locking region information:");
__db_dl(dbenv, "Last allocated locker ID", (u_long)sp->st_id);
__db_msg(dbenv, "%#lx\tCurrent maximum unused locker ID",
(u_long)sp->st_cur_maxid);
__db_dl(dbenv, "Number of lock modes", (u_long)sp->st_nmodes);
__db_dl(dbenv,
"Maximum number of locks possible", (u_long)sp->st_maxlocks);
__db_dl(dbenv,
"Maximum number of lockers possible", (u_long)sp->st_maxlockers);
__db_dl(dbenv, "Maximum number of lock objects possible",
(u_long)sp->st_maxobjects);
__db_dl(dbenv, "Number of current locks", (u_long)sp->st_nlocks);
__db_dl(dbenv, "Maximum number of locks at any one time",
(u_long)sp->st_maxnlocks);
__db_dl(dbenv, "Number of current lockers", (u_long)sp->st_nlockers);
__db_dl(dbenv, "Maximum number of lockers at any one time",
(u_long)sp->st_maxnlockers);
__db_dl(dbenv,
"Number of current lock objects", (u_long)sp->st_nobjects);
__db_dl(dbenv, "Maximum number of lock objects at any one time",
(u_long)sp->st_maxnobjects);
__db_dl(dbenv,
"Total number of locks requested", (u_long)sp->st_nrequests);
__db_dl(dbenv,
"Total number of locks released", (u_long)sp->st_nreleases);
__db_dl(dbenv,
2005-12-05 19:27:46 +01:00
"Total number of locks upgraded", (u_long)sp->st_nupgrade);
__db_dl(dbenv,
"Total number of locks downgraded", (u_long)sp->st_ndowngrade);
__db_dl(dbenv,
"Lock requests not available due to conflicts, for which we waited",
(u_long)sp->st_lock_wait);
2005-07-21 00:48:22 +02:00
__db_dl(dbenv,
2005-12-05 19:27:46 +01:00
"Lock requests not available due to conflicts, for which we did not wait",
(u_long)sp->st_lock_nowait);
2005-07-21 00:48:22 +02:00
__db_dl(dbenv, "Number of deadlocks", (u_long)sp->st_ndeadlocks);
__db_dl(dbenv, "Lock timeout value", (u_long)sp->st_locktimeout);
__db_dl(dbenv, "Number of locks that have timed out",
(u_long)sp->st_nlocktimeouts);
__db_dl(dbenv,
"Transaction timeout value", (u_long)sp->st_txntimeout);
__db_dl(dbenv, "Number of transactions that have timed out",
(u_long)sp->st_ntxntimeouts);
__db_dlbytes(dbenv, "The size of the lock region",
(u_long)0, (u_long)0, (u_long)sp->st_regsize);
__db_dl_pct(dbenv,
"The number of region locks that required waiting",
(u_long)sp->st_region_wait, DB_PCT(sp->st_region_wait,
sp->st_region_wait + sp->st_region_nowait), NULL);
__os_ufree(dbenv, sp);
return (0);
}
/*
* __lock_print_all --
* Display debugging lock region statistics.
*/
static int
__lock_print_all(dbenv, flags)
2001-03-05 01:42:05 +01:00
DB_ENV *dbenv;
2005-07-21 00:48:22 +02:00
u_int32_t flags;
2001-03-05 01:42:05 +01:00
{
DB_LOCKER *lip;
DB_LOCKOBJ *op;
DB_LOCKREGION *lrp;
DB_LOCKTAB *lt;
2005-07-21 00:48:22 +02:00
DB_MSGBUF mb;
int i, j;
u_int32_t k;
char buf[64];
2001-03-05 01:42:05 +01:00
lt = dbenv->lk_handle;
lrp = lt->reginfo.primary;
2005-07-21 00:48:22 +02:00
DB_MSGBUF_INIT(&mb);
2005-12-05 19:27:46 +01:00
LOCK_SYSTEM_LOCK(dbenv);
2001-03-05 01:42:05 +01:00
2005-07-21 00:48:22 +02:00
__db_print_reginfo(dbenv, &lt->reginfo, "Lock");
if (LF_ISSET(DB_STAT_ALL | DB_STAT_LOCK_PARAMS)) {
__db_msg(dbenv, "%s", DB_GLOBAL(db_line));
__db_msg(dbenv, "Lock region parameters:");
2005-12-05 19:27:46 +01:00
__mutex_print_debug_single(dbenv,
"Lock region region mutex", lrp->mtx_region, flags);
2005-07-21 00:48:22 +02:00
STAT_ULONG("locker table size", lrp->locker_t_size);
STAT_ULONG("object table size", lrp->object_t_size);
STAT_ULONG("obj_off", lrp->obj_off);
STAT_ULONG("locker_off", lrp->locker_off);
STAT_ULONG("need_dd", lrp->need_dd);
if (LOCK_TIME_ISVALID(&lrp->next_timeout) &&
strftime(buf, sizeof(buf), "%m-%d-%H:%M:%S",
localtime((time_t*)&lrp->next_timeout.tv_sec)) != 0)
__db_msg(dbenv, "next_timeout: %s.%lu",
buf, (u_long)lrp->next_timeout.tv_usec);
2002-10-30 12:57:05 +01:00
}
2001-03-05 01:42:05 +01:00
2005-07-21 00:48:22 +02:00
if (LF_ISSET(DB_STAT_ALL | DB_STAT_LOCK_CONF)) {
__db_msg(dbenv, "%s", DB_GLOBAL(db_line));
__db_msg(dbenv, "Lock conflict matrix:");
2002-10-30 12:57:05 +01:00
for (i = 0; i < lrp->stat.st_nmodes; i++) {
for (j = 0; j < lrp->stat.st_nmodes; j++)
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, &mb, "%lu\t", (u_long)
2002-10-30 12:57:05 +01:00
lt->conflicts[i * lrp->stat.st_nmodes + j]);
2005-07-21 00:48:22 +02:00
DB_MSGBUF_FLUSH(dbenv, &mb);
2001-03-05 01:42:05 +01:00
}
}
2005-07-21 00:48:22 +02:00
if (LF_ISSET(DB_STAT_ALL | DB_STAT_LOCK_LOCKERS)) {
__db_msg(dbenv, "%s", DB_GLOBAL(db_line));
__db_msg(dbenv, "Locks grouped by lockers:");
__lock_print_header(dbenv);
for (k = 0; k < lrp->locker_t_size; k++)
2001-03-05 01:42:05 +01:00
for (lip =
2005-07-21 00:48:22 +02:00
SH_TAILQ_FIRST(&lt->locker_tab[k], __db_locker);
2001-03-05 01:42:05 +01:00
lip != NULL;
lip = SH_TAILQ_NEXT(lip, links, __db_locker)) {
2005-07-21 00:48:22 +02:00
__lock_dump_locker(dbenv, &mb, lt, lip);
2001-03-05 01:42:05 +01:00
}
}
2005-07-21 00:48:22 +02:00
if (LF_ISSET(DB_STAT_ALL | DB_STAT_LOCK_OBJECTS)) {
__db_msg(dbenv, "%s", DB_GLOBAL(db_line));
__db_msg(dbenv, "Locks grouped by object:");
__lock_print_header(dbenv);
for (k = 0; k < lrp->object_t_size; k++) {
for (op = SH_TAILQ_FIRST(&lt->obj_tab[k], __db_lockobj);
2001-03-05 01:42:05 +01:00
op != NULL;
2005-07-21 00:48:22 +02:00
op = SH_TAILQ_NEXT(op, links, __db_lockobj)) {
__lock_dump_object(lt, &mb, op);
__db_msg(dbenv, "%s", "");
}
2001-03-05 01:42:05 +01:00
}
}
2005-12-05 19:27:46 +01:00
LOCK_SYSTEM_UNLOCK(dbenv);
2002-10-30 12:57:05 +01:00
return (0);
2001-03-05 01:42:05 +01:00
}
static void
2005-07-21 00:48:22 +02:00
__lock_dump_locker(dbenv, mbp, lt, lip)
DB_ENV *dbenv;
DB_MSGBUF *mbp;
2001-03-05 01:42:05 +01:00
DB_LOCKTAB *lt;
DB_LOCKER *lip;
{
struct __db_lock *lp;
2002-10-30 12:57:05 +01:00
time_t s;
2005-12-05 19:27:46 +01:00
char buf[DB_THREADID_STRLEN];
2001-03-05 01:42:05 +01:00
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv,
2005-12-05 19:27:46 +01:00
mbp, "%8lx dd=%2ld locks held %-4d write locks %-4d pid/thread %s",
(u_long)lip->id, (long)lip->dd_id, lip->nlocks, lip->nwrites,
dbenv->thread_id_string(dbenv, lip->pid, lip->tid, buf));
2005-07-21 00:48:22 +02:00
__db_msgadd(
dbenv, mbp, "%s", F_ISSET(lip, DB_LOCKER_DELETED) ? "(D)" : " ");
2002-10-30 12:57:05 +01:00
if (LOCK_TIME_ISVALID(&lip->tx_expire)) {
2005-07-21 00:48:22 +02:00
s = (time_t)lip->tx_expire.tv_sec;
if (strftime(buf,
sizeof(buf), "%m-%d-%H:%M:%S", localtime(&s)) != 0)
__db_msgadd(dbenv, mbp, "expires %s.%lu",
buf, (u_long)lip->tx_expire.tv_usec);
2002-10-30 12:57:05 +01:00
}
if (F_ISSET(lip, DB_LOCKER_TIMEOUT))
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, mbp, " lk timeout %u", lip->lk_timeout);
2002-10-30 12:57:05 +01:00
if (LOCK_TIME_ISVALID(&lip->lk_expire)) {
2005-07-21 00:48:22 +02:00
s = (time_t)lip->lk_expire.tv_sec;
if (strftime(buf,
sizeof(buf), "%m-%d-%H:%M:%S", localtime(&s)) != 0)
__db_msgadd(dbenv, mbp, " lk expires %s.%lu",
buf, (u_long)lip->lk_expire.tv_usec);
2002-10-30 12:57:05 +01:00
}
2005-07-21 00:48:22 +02:00
DB_MSGBUF_FLUSH(dbenv, mbp);
for (lp = SH_LIST_FIRST(&lip->heldby, __db_lock);
lp != NULL; lp = SH_LIST_NEXT(lp, locker_links, __db_lock))
__lock_printlock(lt, mbp, lp, 1);
2001-03-05 01:42:05 +01:00
}
static void
2005-07-21 00:48:22 +02:00
__lock_dump_object(lt, mbp, op)
2001-03-05 01:42:05 +01:00
DB_LOCKTAB *lt;
2005-07-21 00:48:22 +02:00
DB_MSGBUF *mbp;
2001-03-05 01:42:05 +01:00
DB_LOCKOBJ *op;
{
struct __db_lock *lp;
for (lp =
SH_TAILQ_FIRST(&op->holders, __db_lock);
lp != NULL;
lp = SH_TAILQ_NEXT(lp, links, __db_lock))
2005-07-21 00:48:22 +02:00
__lock_printlock(lt, mbp, lp, 1);
2002-10-30 12:57:05 +01:00
for (lp =
SH_TAILQ_FIRST(&op->waiters, __db_lock);
lp != NULL;
lp = SH_TAILQ_NEXT(lp, links, __db_lock))
2005-07-21 00:48:22 +02:00
__lock_printlock(lt, mbp, lp, 1);
2001-03-05 01:42:05 +01:00
}
2002-10-30 12:57:05 +01:00
/*
2005-07-21 00:48:22 +02:00
* __lock_print_header --
2002-10-30 12:57:05 +01:00
*/
static void
2005-07-21 00:48:22 +02:00
__lock_print_header(dbenv)
DB_ENV *dbenv;
2001-03-05 01:42:05 +01:00
{
2005-07-21 00:48:22 +02:00
__db_msg(dbenv, "%-8s %-10s%-4s %-7s %s",
2002-10-30 12:57:05 +01:00
"Locker", "Mode",
2005-07-21 00:48:22 +02:00
"Count", "Status", "----------------- Object ---------------");
2002-10-30 12:57:05 +01:00
}
/*
* __lock_printlock --
*
2005-07-21 00:48:22 +02:00
* PUBLIC: void __lock_printlock
* PUBLIC: __P((DB_LOCKTAB *, DB_MSGBUF *mbp, struct __db_lock *, int));
2002-10-30 12:57:05 +01:00
*/
void
2005-07-21 00:48:22 +02:00
__lock_printlock(lt, mbp, lp, ispgno)
2002-10-30 12:57:05 +01:00
DB_LOCKTAB *lt;
2005-07-21 00:48:22 +02:00
DB_MSGBUF *mbp;
2002-10-30 12:57:05 +01:00
struct __db_lock *lp;
int ispgno;
{
2005-07-21 00:48:22 +02:00
DB_ENV *dbenv;
2002-10-30 12:57:05 +01:00
DB_LOCKOBJ *lockobj;
2005-07-21 00:48:22 +02:00
DB_MSGBUF mb;
2002-10-30 12:57:05 +01:00
db_pgno_t pgno;
u_int32_t *fidp, type;
u_int8_t *ptr;
char *namep;
const char *mode, *status;
2005-07-21 00:48:22 +02:00
dbenv = lt->dbenv;
if (mbp == NULL) {
DB_MSGBUF_INIT(&mb);
mbp = &mb;
}
2002-10-30 12:57:05 +01:00
switch (lp->mode) {
case DB_LOCK_IREAD:
mode = "IREAD";
break;
case DB_LOCK_IWR:
mode = "IWR";
break;
case DB_LOCK_IWRITE:
mode = "IWRITE";
break;
case DB_LOCK_NG:
mode = "NG";
break;
case DB_LOCK_READ:
mode = "READ";
break;
2005-12-05 19:27:46 +01:00
case DB_LOCK_READ_UNCOMMITTED:
mode = "READ_UNCOMMITTED";
break;
2002-10-30 12:57:05 +01:00
case DB_LOCK_WRITE:
mode = "WRITE";
break;
case DB_LOCK_WWRITE:
mode = "WAS_WRITE";
break;
case DB_LOCK_WAIT:
mode = "WAIT";
break;
default:
mode = "UNKNOWN";
break;
}
switch (lp->status) {
2001-03-05 01:42:05 +01:00
case DB_LSTAT_ABORTED:
2002-10-30 12:57:05 +01:00
status = "ABORT";
break;
2005-07-21 00:48:22 +02:00
case DB_LSTAT_EXPIRED:
status = "EXPIRED";
2002-10-30 12:57:05 +01:00
break;
2001-03-05 01:42:05 +01:00
case DB_LSTAT_FREE:
2002-10-30 12:57:05 +01:00
status = "FREE";
break;
2001-03-05 01:42:05 +01:00
case DB_LSTAT_HELD:
2002-10-30 12:57:05 +01:00
status = "HELD";
break;
case DB_LSTAT_PENDING:
status = "PENDING";
break;
2005-07-21 00:48:22 +02:00
case DB_LSTAT_WAITING:
status = "WAIT";
2002-10-30 12:57:05 +01:00
break;
default:
status = "UNKNOWN";
break;
}
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, mbp, "%8lx %-10s %4lu %-7s ",
2002-10-30 12:57:05 +01:00
(u_long)lp->holder, mode, (u_long)lp->refcount, status);
lockobj = (DB_LOCKOBJ *)((u_int8_t *)lp + lp->obj);
ptr = SH_DBT_PTR(&lockobj->lockobj);
if (ispgno && lockobj->lockobj.size == sizeof(struct __db_ilock)) {
/* Assume this is a DBT lock. */
memcpy(&pgno, ptr, sizeof(db_pgno_t));
fidp = (u_int32_t *)(ptr + sizeof(db_pgno_t));
type = *(u_int32_t *)(ptr + sizeof(db_pgno_t) + DB_FILE_ID_LEN);
if (__dbreg_get_name(lt->dbenv, (u_int8_t *)fidp, &namep) != 0)
namep = NULL;
if (namep == NULL)
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, mbp, "(%lx %lx %lx %lx %lx) ",
(u_long)fidp[0], (u_long)fidp[1], (u_long)fidp[2],
(u_long)fidp[3], (u_long)fidp[4]);
2002-10-30 12:57:05 +01:00
else
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, mbp, "%-25s ", namep);
__db_msgadd(dbenv, mbp, "%-7s %7lu",
2002-10-30 12:57:05 +01:00
type == DB_PAGE_LOCK ? "page" :
type == DB_RECORD_LOCK ? "record" : "handle",
(u_long)pgno);
} else {
2005-07-21 00:48:22 +02:00
__db_msgadd(dbenv, mbp, "0x%lx ",
(u_long)R_OFFSET(&lt->reginfo, lockobj));
__db_pr(dbenv, mbp, ptr, lockobj->lockobj.size);
2001-03-05 01:42:05 +01:00
}
2005-07-21 00:48:22 +02:00
DB_MSGBUF_FLUSH(dbenv, mbp);
2001-03-05 01:42:05 +01:00
}
2005-07-21 00:48:22 +02:00
#else /* !HAVE_STATISTICS */
int
__lock_stat_pp(dbenv, statp, flags)
DB_ENV *dbenv;
DB_LOCK_STAT **statp;
u_int32_t flags;
{
COMPQUIET(statp, NULL);
COMPQUIET(flags, 0);
return (__db_stat_not_built(dbenv));
}
int
__lock_stat_print_pp(dbenv, flags)
DB_ENV *dbenv;
u_int32_t flags;
{
COMPQUIET(flags, 0);
return (__db_stat_not_built(dbenv));
}
#endif