add "show all pools" command for ddb.

This commit is contained in:
yamt 2005-12-01 13:21:05 +00:00
parent 0de2ab9787
commit a004e1d63c
5 changed files with 34 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_command.c,v 1.81 2005/11/27 13:05:28 yamt Exp $ */
/* $NetBSD: db_command.c,v 1.82 2005/12/01 13:21:05 yamt Exp $ */
/*
* Mach Operating System
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.81 2005/11/27 13:05:28 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.82 2005/12/01 13:21:05 yamt Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -128,6 +128,7 @@ static void db_mount_print_cmd(db_expr_t, int, db_expr_t, const char *);
static const struct db_command db_show_all_cmds[] = {
{ "callout", db_show_callout, 0, NULL },
{ "procs", db_show_all_procs, 0, NULL },
{ "pools", db_show_all_pools, 0, NULL },
{ NULL, NULL, 0, NULL }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_interface.h,v 1.15 2005/06/01 12:25:27 drochner Exp $ */
/* $NetBSD: db_interface.h,v 1.16 2005/12/01 13:21:05 yamt Exp $ */
/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
@ -53,6 +53,7 @@ void db_kgdb_cmd(db_expr_t, int, db_expr_t, const char *);
/* kern/kern_proc.c */
void db_kill_proc(db_expr_t, int, db_expr_t, const char *);
void db_show_all_procs(db_expr_t, int, db_expr_t, const char *);
void db_show_all_pools(db_expr_t, int, db_expr_t, const char *);
void db_show_sched_qs(db_expr_t, int, db_expr_t, const char *);
/* kern/kern_clock.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_xxx.c,v 1.32 2005/10/15 17:29:11 yamt Exp $ */
/* $NetBSD: db_xxx.c,v 1.33 2005/12/01 13:21:05 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -39,7 +39,7 @@
#include "opt_kgdb.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.32 2005/10/15 17:29:11 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.33 2005/12/01 13:21:05 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -227,6 +227,13 @@ db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, const char *modif)
}
}
void
db_show_all_pools(db_expr_t addr, int haddr, db_expr_t count, const char *modif)
{
pool_printall(modif, db_printf);
}
void
db_dmesg(db_expr_t addr, int haddr, db_expr_t count, const char *modif)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: subr_pool.c,v 1.107 2005/11/02 14:32:54 yamt Exp $ */
/* $NetBSD: subr_pool.c,v 1.108 2005/12/01 13:21:05 yamt Exp $ */
/*-
* Copyright (c) 1997, 1999, 2000 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.107 2005/11/02 14:32:54 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.108 2005/12/01 13:21:05 yamt Exp $");
#include "opt_pool.h"
#include "opt_poollog.h"
@ -1580,6 +1580,22 @@ pool_print(struct pool *pp, const char *modif)
splx(s);
}
void
pool_printall(const char *modif, void (*pr)(const char *, ...))
{
struct pool *pp;
if (simple_lock_try(&pool_head_slock) == 0) {
(*pr)("WARNING: pool_head_slock is locked\n");
} else {
simple_unlock(&pool_head_slock);
}
LIST_FOREACH(pp, &pool_head, pr_poollist) {
pool_printit(pp, modif, pr);
}
}
void
pool_printit(struct pool *pp, const char *modif, void (*pr)(const char *, ...))
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: pool.h,v 1.46 2005/10/02 17:29:31 chs Exp $ */
/* $NetBSD: pool.h,v 1.47 2005/12/01 13:21:05 yamt Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -271,6 +271,7 @@ void pool_drain(void *);
void pool_print(struct pool *, const char *);
void pool_printit(struct pool *, const char *,
void (*)(const char *, ...));
void pool_printall(const char *, void (*)(const char *, ...));
int pool_chk(struct pool *, const char *);
/*