svn commit: r366079 - stable/12/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Wed Sep 23 17:11:07 UTC 2020
Author: kib
Date: Wed Sep 23 17:11:06 2020
New Revision: 366079
URL: https://svnweb.freebsd.org/changeset/base/366079
Log:
MFC r365811:
Improve ddb 'show pgrpdump' command.
Modified:
stable/12/sys/kern/kern_proc.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/kern_proc.c
==============================================================================
--- stable/12/sys/kern/kern_proc.c Wed Sep 23 17:04:27 2020 (r366078)
+++ stable/12/sys/kern/kern_proc.c Wed Sep 23 17:11:06 2020 (r366079)
@@ -905,6 +905,16 @@ sess_release(struct session *s)
#ifdef DDB
+static void
+db_print_pgrp_one(struct pgrp *pgrp, struct proc *p)
+{
+ db_printf(
+ " pid %d at %p pr %d pgrp %p e %d jc %d\n",
+ p->p_pid, p, p->p_pptr == NULL ? -1 : p->p_pptr->p_pid,
+ p->p_pgrp, (p->p_treeflag & P_TREE_GRPEXITED) != 0,
+ p->p_pptr == NULL ? 0 : isjobproc(p->p_pptr, pgrp));
+}
+
DB_SHOW_COMMAND(pgrpdump, pgrpdump)
{
struct pgrp *pgrp;
@@ -913,19 +923,15 @@ DB_SHOW_COMMAND(pgrpdump, pgrpdump)
for (i = 0; i <= pgrphash; i++) {
if (!LIST_EMPTY(&pgrphashtbl[i])) {
- printf("\tindx %d\n", i);
+ db_printf("indx %d\n", i);
LIST_FOREACH(pgrp, &pgrphashtbl[i], pg_hash) {
- printf(
- "\tpgrp %p, pgid %ld, sess %p, sesscnt %d, mem %p\n",
- (void *)pgrp, (long)pgrp->pg_id,
- (void *)pgrp->pg_session,
+ db_printf(
+ " pgrp %p, pgid %d, sess %p, sesscnt %d, mem %p\n",
+ pgrp, (int)pgrp->pg_id, pgrp->pg_session,
pgrp->pg_session->s_count,
- (void *)LIST_FIRST(&pgrp->pg_members));
- LIST_FOREACH(p, &pgrp->pg_members, p_pglist) {
- printf("\t\tpid %ld addr %p pgrp %p\n",
- (long)p->p_pid, (void *)p,
- (void *)p->p_pgrp);
- }
+ LIST_FIRST(&pgrp->pg_members));
+ LIST_FOREACH(p, &pgrp->pg_members, p_pglist)
+ db_print_pgrp_one(pgrp, p);
}
}
}
More information about the svn-src-stable-12
mailing list