diff options
author | jhb <jhb@FreeBSD.org> | 2003-07-31 17:29:42 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-07-31 17:29:42 +0000 |
commit | bc9db472d846e3b60c0fd5e39702ea355dba8046 (patch) | |
tree | 5db3617451813940f0d0b379782cdd6ffffcd685 /sys/ddb | |
parent | 7a022c490241980d564815f3a9eb35f1899334d6 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/ddb/db_ps.c | 34 |
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); */ |