summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_ps.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-07-12 21:22:44 +0000
committerjhb <jhb@FreeBSD.org>2006-07-12 21:22:44 +0000
commita72b0bcd7fd4baed9952beefc6398b3d79c789d9 (patch)
treef2aff187736391b024e6cf6f28e95e5708a2d927 /sys/ddb/db_ps.c
parent883bd6a55eef6005b2e79ccc0c939a365bebb656 (diff)
downloadFreeBSD-src-a72b0bcd7fd4baed9952beefc6398b3d79c789d9.zip
FreeBSD-src-a72b0bcd7fd4baed9952beefc6398b3d79c789d9.tar.gz
Simplify the pager support in DDB. Allowing different db commands to
install custom pager functions didn't actually happen in practice (they all just used the simple pager and passed in a local quit pointer). So, just hardcode the simple pager as the only pager and make it set a global db_pager_quit flag that db commands can check when the user hits 'q' (or a suitable variant) at the pager prompt. Also, now that it's easy to do so, enable paging by default for all ddb commands. Any command that wishes to honor the quit flag can do so by checking db_pager_quit. Note that the pager can also be effectively disabled by setting $lines to 0. Other fixes: - 'show idt' on i386 and pc98 now actually checks the quit flag and terminates early. - 'show intr' now actually checks the quit flag and terminates early.
Diffstat (limited to 'sys/ddb/db_ps.c')
-rw-r--r--sys/ddb/db_ps.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 39dff4c..f220de0 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -73,23 +73,21 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t count, char *modif)
struct ucred *cred;
struct pgrp *pgrp;
char state[9];
- int np, quit, rflag, sflag, dflag, lflag, wflag;
+ int np, rflag, sflag, dflag, lflag, wflag;
np = nprocs;
- quit = 0;
if (!LIST_EMPTY(&allproc))
p = LIST_FIRST(&allproc);
else
p = &proc0;
- db_setup_paging(db_simple_pager, &quit, db_lines_per_page);
#ifdef __LP64__
db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n");
#else
db_printf(" pid uid ppid pgrp state wmesg wchan cmd\n");
#endif
- while (--np >= 0 && !quit) {
+ while (--np >= 0 && !db_pager_quit) {
if (p == NULL) {
db_printf("oops, ran out of processes early!\n");
break;
@@ -191,7 +189,7 @@ db_ps(db_expr_t addr, boolean_t hasaddr, db_expr_t count, char *modif)
#endif
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, p->p_flag & P_HADTHREADS);
- if (quit)
+ if (db_pager_quit)
break;
}
@@ -363,7 +361,7 @@ DB_SHOW_COMMAND(proc, db_show_proc)
{
struct thread *td;
struct proc *p;
- int i, quit;
+ int i;
/* Determine which process to examine. */
if (have_addr)
@@ -371,8 +369,6 @@ DB_SHOW_COMMAND(proc, db_show_proc)
else
p = kdb_thread->td_proc;
- quit = 0;
- db_setup_paging(db_simple_pager, &quit, db_lines_per_page);
db_printf("Process %d (%s) at %p:\n", p->p_pid, p->p_comm, p);
db_printf(" state: ");
switch (p->p_state) {
@@ -411,7 +407,7 @@ DB_SHOW_COMMAND(proc, db_show_proc)
db_printf(" threads: %d\n", p->p_numthreads);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td, 1);
- if (quit)
+ if (db_pager_quit)
break;
}
}
OpenPOWER on IntegriCloud