summaryrefslogtreecommitdiffstats
path: root/sys/ddb/db_ps.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-07-31 17:29:42 +0000
committerjhb <jhb@FreeBSD.org>2003-07-31 17:29:42 +0000
commitbc9db472d846e3b60c0fd5e39702ea355dba8046 (patch)
tree5db3617451813940f0d0b379782cdd6ffffcd685 /sys/ddb/db_ps.c
parent7a022c490241980d564815f3a9eb35f1899334d6 (diff)
downloadFreeBSD-src-bc9db472d846e3b60c0fd5e39702ea355dba8046.zip
FreeBSD-src-bc9db472d846e3b60c0fd5e39702ea355dba8046.tar.gz
Update the 'ps', 'show pci', and 'show ktr' ddb commands to use the new
pager callout instead of homerolling their own paging facility.
Diffstat (limited to 'sys/ddb/db_ps.c')
-rw-r--r--sys/ddb/db_ps.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index e706cd7..55aa86b 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -55,13 +55,13 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
db_expr_t dummy3;
char * dummy4;
{
- int np;
- int nl = 0;
volatile struct proc *p, *pp;
volatile struct thread *td;
char *state;
+ int np, quit;
np = nprocs;
+ quit = 0;
/* sx_slock(&allproc_lock); */
if (!LIST_EMPTY(&allproc))
@@ -69,32 +69,9 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
else
p = &proc0;
+ db_setup_paging(db_simple_pager, &quit, DB_LINES_PER_PAGE);
db_printf(" pid proc addr uid ppid pgrp flag stat wmesg wchan cmd\n");
- while (--np >= 0) {
- /*
- * XXX just take 20 for now...
- */
- if (nl++ >= 20) {
- int c;
-
- db_printf("--More--");
- c = cngetc();
- db_printf("\r");
- /*
- * A whole screenfull or just one line?
- */
- switch (c) {
- case '\n': /* just one line */
- nl = 20;
- break;
- case ' ':
- nl = 0; /* another screenfull */
- break;
- default: /* exit */
- db_printf("\n");
- return;
- }
- }
+ while (--np >= 0 && !quit) {
if (p == NULL) {
printf("oops, ran out of processes early!\n");
break;
@@ -131,7 +108,8 @@ db_ps(dummy1, dummy2, dummy3, dummy4)
db_printf("(threaded) %s\n", p->p_comm);
FOREACH_THREAD_IN_PROC(p, td) {
dumpthread(p, td);
- nl++;
+ if (quit)
+ break;
}
/* PROC_UNLOCK(p); */
OpenPOWER on IntegriCloud