1 /* $OpenBSD: kern_proc.c,v 1.96 2024/01/15 15:47:37 mvs Exp $ */ 2 /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ 3 4 /* 5 * Copyright (c) 1982, 1986, 1989, 1991, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the University nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)kern_proc.c 8.4 (Berkeley) 1/4/94 33 */ 34 35 #include <sys/param.h> 36 #include <sys/systm.h> 37 #include <sys/proc.h> 38 #include <sys/wait.h> 39 #include <sys/rwlock.h> 40 #include <sys/malloc.h> 41 #include <sys/tty.h> 42 #include <sys/signalvar.h> 43 #include <sys/pool.h> 44 #include <sys/vnode.h> 45 46 /* 47 * Locks used to protect struct members in this file: 48 * I immutable after creation 49 * U uidinfolk 50 */ 51 52 struct rwlock uidinfolk; 53 #define UIHASH(uid) (&uihashtbl[(uid) & uihash]) 54 LIST_HEAD(uihashhead, uidinfo) *uihashtbl; /* [U] */ 55 u_long uihash; /* [I] size of hash table - 1 */ 56 57 /* 58 * Other process lists 59 */ 60 struct tidhashhead *tidhashtbl; 61 u_long tidhash; 62 struct pidhashhead *pidhashtbl; 63 u_long pidhash; 64 struct pgrphashhead *pgrphashtbl; 65 u_long pgrphash; 66 struct processlist allprocess; 67 struct processlist zombprocess; 68 struct proclist allproc; 69 70 struct pool proc_pool; 71 struct pool process_pool; 72 struct pool rusage_pool; 73 struct pool ucred_pool; 74 struct pool pgrp_pool; 75 struct pool session_pool; 76 77 void pgdelete(struct pgrp *); 78 void fixjobc(struct process *, struct pgrp *, int); 79 80 static void orphanpg(struct pgrp *); 81 #ifdef DEBUG 82 void pgrpdump(void); 83 #endif 84 85 /* 86 * Initialize global process hashing structures. 87 */ 88 void 89 procinit(void) 90 { 91 LIST_INIT(&allprocess); 92 LIST_INIT(&zombprocess); 93 LIST_INIT(&allproc); 94 95 rw_init(&uidinfolk, "uidinfo"); 96 97 tidhashtbl = hashinit(maxthread / 4, M_PROC, M_NOWAIT, &tidhash); 98 pidhashtbl = hashinit(maxprocess / 4, M_PROC, M_NOWAIT, &pidhash); 99 pgrphashtbl = hashinit(maxprocess / 4, M_PROC, M_NOWAIT, &pgrphash); 100 uihashtbl = hashinit(maxprocess / 16, M_PROC, M_NOWAIT, &uihash); 101 if (!tidhashtbl || !pidhashtbl || !pgrphashtbl || !uihashtbl) 102 panic("procinit: malloc"); 103 104 pool_init(&proc_pool, sizeof(struct proc), 0, IPL_NONE, 105 PR_WAITOK, "procpl", NULL); 106 pool_init(&process_pool, sizeof(struct process), 0, IPL_NONE, 107 PR_WAITOK, "processpl", NULL); 108 pool_init(&rusage_pool, sizeof(struct rusage), 0, IPL_NONE, 109 PR_WAITOK, "zombiepl", NULL); 110 pool_init(&ucred_pool, sizeof(struct ucred), 0, IPL_MPFLOOR, 111 0, "ucredpl", NULL); 112 pool_init(&pgrp_pool, sizeof(struct pgrp), 0, IPL_NONE, 113 PR_WAITOK, "pgrppl", NULL); 114 pool_init(&session_pool, sizeof(struct session), 0, IPL_NONE, 115 PR_WAITOK, "sessionpl", NULL); 116 } 117 118 /* 119 * This returns with `uidinfolk' held: caller must call uid_release() 120 * after making whatever change they needed. 121 */ 122 struct uidinfo * 123 uid_find(uid_t uid) 124 { 125 struct uidinfo *uip, *nuip; 126 struct uihashhead *uipp; 127 128 uipp = UIHASH(uid); 129 rw_enter_write(&uidinfolk); 130 LIST_FOREACH(uip, uipp, ui_hash) 131 if (uip->ui_uid == uid) 132 break; 133 if (uip) 134 return (uip); 135 rw_exit_write(&uidinfolk); 136 nuip = malloc(sizeof(*nuip), M_PROC, M_WAITOK|M_ZERO); 137 rw_enter_write(&uidinfolk); 138 LIST_FOREACH(uip, uipp, ui_hash) 139 if (uip->ui_uid == uid) 140 break; 141 if (uip) { 142 free(nuip, M_PROC, sizeof(*nuip)); 143 return (uip); 144 } 145 nuip->ui_uid = uid; 146 LIST_INSERT_HEAD(uipp, nuip, ui_hash); 147 148 return (nuip); 149 } 150 151 void 152 uid_release(struct uidinfo *uip) 153 { 154 rw_exit_write(&uidinfolk); 155 } 156 157 /* 158 * Change the count associated with number of threads 159 * a given user is using. 160 */ 161 int 162 chgproccnt(uid_t uid, int diff) 163 { 164 struct uidinfo *uip; 165 long count; 166 167 uip = uid_find(uid); 168 count = (uip->ui_proccnt += diff); 169 uid_release(uip); 170 if (count < 0) 171 panic("chgproccnt: procs < 0"); 172 return count; 173 } 174 175 /* 176 * Is pr an inferior of parent? 177 */ 178 int 179 inferior(struct process *pr, struct process *parent) 180 { 181 182 for (; pr != parent; pr = pr->ps_pptr) 183 if (pr->ps_pid == 0 || pr->ps_pid == 1) 184 return (0); 185 return (1); 186 } 187 188 /* 189 * Locate a proc (thread) by number 190 */ 191 struct proc * 192 tfind(pid_t tid) 193 { 194 struct proc *p; 195 196 LIST_FOREACH(p, TIDHASH(tid), p_hash) 197 if (p->p_tid == tid) 198 return (p); 199 return (NULL); 200 } 201 202 /* 203 * Locate a thread by userspace id, from a given process. 204 */ 205 struct proc * 206 tfind_user(pid_t tid, struct process *pr) 207 { 208 struct proc *p; 209 210 if (tid < THREAD_PID_OFFSET) 211 return NULL; 212 p = tfind(tid - THREAD_PID_OFFSET); 213 214 /* verify we found a thread in the correct process */ 215 if (p != NULL && p->p_p != pr) 216 p = NULL; 217 return p; 218 } 219 220 /* 221 * Locate a process by number 222 */ 223 struct process * 224 prfind(pid_t pid) 225 { 226 struct process *pr; 227 228 LIST_FOREACH(pr, PIDHASH(pid), ps_hash) 229 if (pr->ps_pid == pid) 230 return (pr); 231 return (NULL); 232 } 233 234 struct process * 235 priterator(struct process *ps) 236 { 237 struct process *nps; 238 239 KERNEL_ASSERT_LOCKED(); 240 241 if (ps == NULL) 242 nps = LIST_FIRST(&allprocess); 243 else 244 nps = LIST_NEXT(ps, ps_list); 245 246 if (nps) 247 refcnt_take(&nps->ps_refcnt); 248 if (ps) 249 refcnt_rele_wake(&ps->ps_refcnt); 250 251 return nps; 252 } 253 254 /* 255 * Locate a process group by number 256 */ 257 struct pgrp * 258 pgfind(pid_t pgid) 259 { 260 struct pgrp *pgrp; 261 262 LIST_FOREACH(pgrp, PGRPHASH(pgid), pg_hash) 263 if (pgrp->pg_id == pgid) 264 return (pgrp); 265 return (NULL); 266 } 267 268 /* 269 * Locate a zombie process 270 */ 271 struct process * 272 zombiefind(pid_t pid) 273 { 274 struct process *pr; 275 276 LIST_FOREACH(pr, &zombprocess, ps_list) 277 if (pr->ps_pid == pid) 278 return (pr); 279 return (NULL); 280 } 281 282 /* 283 * Move process to a new process group. If a session is provided 284 * then it's a new session to contain this process group; otherwise 285 * the process is staying within its existing session. 286 */ 287 void 288 enternewpgrp(struct process *pr, struct pgrp *pgrp, struct session *newsess) 289 { 290 #ifdef DIAGNOSTIC 291 if (SESS_LEADER(pr)) 292 panic("%s: session leader attempted setpgrp", __func__); 293 #endif 294 295 if (newsess != NULL) { 296 /* 297 * New session. Initialize it completely 298 */ 299 timeout_set(&newsess->s_verauthto, zapverauth, newsess); 300 newsess->s_leader = pr; 301 newsess->s_count = 1; 302 newsess->s_ttyvp = NULL; 303 newsess->s_ttyp = NULL; 304 memcpy(newsess->s_login, pr->ps_session->s_login, 305 sizeof(newsess->s_login)); 306 atomic_clearbits_int(&pr->ps_flags, PS_CONTROLT); 307 pgrp->pg_session = newsess; 308 #ifdef DIAGNOSTIC 309 if (pr != curproc->p_p) 310 panic("%s: mksession but not curproc", __func__); 311 #endif 312 } else { 313 pgrp->pg_session = pr->ps_session; 314 pgrp->pg_session->s_count++; 315 } 316 pgrp->pg_id = pr->ps_pid; 317 LIST_INIT(&pgrp->pg_members); 318 LIST_INIT(&pgrp->pg_sigiolst); 319 LIST_INSERT_HEAD(PGRPHASH(pr->ps_pid), pgrp, pg_hash); 320 pgrp->pg_jobc = 0; 321 322 enterthispgrp(pr, pgrp); 323 } 324 325 /* 326 * move process to an existing process group 327 */ 328 void 329 enterthispgrp(struct process *pr, struct pgrp *pgrp) 330 { 331 struct pgrp *savepgrp = pr->ps_pgrp; 332 333 /* 334 * Adjust eligibility of affected pgrps to participate in job control. 335 * Increment eligibility counts before decrementing, otherwise we 336 * could reach 0 spuriously during the first call. 337 */ 338 fixjobc(pr, pgrp, 1); 339 fixjobc(pr, savepgrp, 0); 340 341 LIST_REMOVE(pr, ps_pglist); 342 pr->ps_pgrp = pgrp; 343 LIST_INSERT_HEAD(&pgrp->pg_members, pr, ps_pglist); 344 if (LIST_EMPTY(&savepgrp->pg_members)) 345 pgdelete(savepgrp); 346 } 347 348 /* 349 * remove process from process group 350 */ 351 void 352 leavepgrp(struct process *pr) 353 { 354 355 if (pr->ps_session->s_verauthppid == pr->ps_pid) 356 zapverauth(pr->ps_session); 357 LIST_REMOVE(pr, ps_pglist); 358 if (LIST_EMPTY(&pr->ps_pgrp->pg_members)) 359 pgdelete(pr->ps_pgrp); 360 pr->ps_pgrp = NULL; 361 } 362 363 /* 364 * delete a process group 365 */ 366 void 367 pgdelete(struct pgrp *pgrp) 368 { 369 sigio_freelist(&pgrp->pg_sigiolst); 370 371 if (pgrp->pg_session->s_ttyp != NULL && 372 pgrp->pg_session->s_ttyp->t_pgrp == pgrp) 373 pgrp->pg_session->s_ttyp->t_pgrp = NULL; 374 LIST_REMOVE(pgrp, pg_hash); 375 SESSRELE(pgrp->pg_session); 376 pool_put(&pgrp_pool, pgrp); 377 } 378 379 void 380 zapverauth(void *v) 381 { 382 struct session *sess = v; 383 sess->s_verauthuid = 0; 384 sess->s_verauthppid = 0; 385 } 386 387 /* 388 * Adjust pgrp jobc counters when specified process changes process group. 389 * We count the number of processes in each process group that "qualify" 390 * the group for terminal job control (those with a parent in a different 391 * process group of the same session). If that count reaches zero, the 392 * process group becomes orphaned. Check both the specified process' 393 * process group and that of its children. 394 * entering == 0 => pr is leaving specified group. 395 * entering == 1 => pr is entering specified group. 396 * XXX need proctree lock 397 */ 398 void 399 fixjobc(struct process *pr, struct pgrp *pgrp, int entering) 400 { 401 struct pgrp *hispgrp; 402 struct session *mysession = pgrp->pg_session; 403 404 /* 405 * Check pr's parent to see whether pr qualifies its own process 406 * group; if so, adjust count for pr's process group. 407 */ 408 if ((hispgrp = pr->ps_pptr->ps_pgrp) != pgrp && 409 hispgrp->pg_session == mysession) { 410 if (entering) 411 pgrp->pg_jobc++; 412 else if (--pgrp->pg_jobc == 0) 413 orphanpg(pgrp); 414 } 415 416 /* 417 * Check this process' children to see whether they qualify 418 * their process groups; if so, adjust counts for children's 419 * process groups. 420 */ 421 LIST_FOREACH(pr, &pr->ps_children, ps_sibling) 422 if ((hispgrp = pr->ps_pgrp) != pgrp && 423 hispgrp->pg_session == mysession && 424 (pr->ps_flags & PS_ZOMBIE) == 0) { 425 if (entering) 426 hispgrp->pg_jobc++; 427 else if (--hispgrp->pg_jobc == 0) 428 orphanpg(hispgrp); 429 } 430 } 431 432 void 433 killjobc(struct process *pr) 434 { 435 if (SESS_LEADER(pr)) { 436 struct session *sp = pr->ps_session; 437 438 if (sp->s_ttyvp) { 439 struct vnode *ovp; 440 441 /* 442 * Controlling process. 443 * Signal foreground pgrp, 444 * drain controlling terminal 445 * and revoke access to controlling terminal. 446 */ 447 if (sp->s_ttyp->t_session == sp) { 448 if (sp->s_ttyp->t_pgrp) 449 pgsignal(sp->s_ttyp->t_pgrp, SIGHUP, 1); 450 ttywait(sp->s_ttyp); 451 /* 452 * The tty could have been revoked 453 * if we blocked. 454 */ 455 if (sp->s_ttyvp) 456 VOP_REVOKE(sp->s_ttyvp, REVOKEALL); 457 } 458 ovp = sp->s_ttyvp; 459 sp->s_ttyvp = NULL; 460 if (ovp) 461 vrele(ovp); 462 /* 463 * s_ttyp is not zero'd; we use this to 464 * indicate that the session once had a 465 * controlling terminal. (for logging and 466 * informational purposes) 467 */ 468 } 469 sp->s_leader = NULL; 470 } 471 fixjobc(pr, pr->ps_pgrp, 0); 472 } 473 474 /* 475 * A process group has become orphaned; 476 * if there are any stopped processes in the group, 477 * hang-up all process in that group. 478 */ 479 static void 480 orphanpg(struct pgrp *pg) 481 { 482 struct process *pr; 483 484 LIST_FOREACH(pr, &pg->pg_members, ps_pglist) { 485 if (pr->ps_mainproc->p_stat == SSTOP) { 486 LIST_FOREACH(pr, &pg->pg_members, ps_pglist) { 487 prsignal(pr, SIGHUP); 488 prsignal(pr, SIGCONT); 489 } 490 return; 491 } 492 } 493 } 494 495 #ifdef DDB 496 void 497 proc_printit(struct proc *p, const char *modif, 498 int (*pr)(const char *, ...) __attribute__((__format__(__kprintf__,1,2)))) 499 { 500 static const char *const pstat[] = { 501 "idle", "run", "sleep", "stop", "zombie", "dead", "onproc" 502 }; 503 char pstbuf[5]; 504 const char *pst = pstbuf; 505 506 507 if (p->p_stat < 1 || p->p_stat > sizeof(pstat) / sizeof(pstat[0])) 508 snprintf(pstbuf, sizeof(pstbuf), "%d", p->p_stat); 509 else 510 pst = pstat[(int)p->p_stat - 1]; 511 512 (*pr)("PROC (%s) tid=%d pid=%d tcnt=%d stat=%s\n", p->p_p->ps_comm, 513 p->p_tid, p->p_p->ps_pid, p->p_p->ps_threadcnt, pst); 514 (*pr)(" flags process=%b proc=%b\n", 515 p->p_p->ps_flags, PS_BITS, p->p_flag, P_BITS); 516 (*pr)(" runpri=%u, usrpri=%u, slppri=%u, nice=%d\n", 517 p->p_runpri, p->p_usrpri, p->p_slppri, p->p_p->ps_nice); 518 (*pr)(" wchan=%p, wmesg=%s, ps_single=%p\n", 519 p->p_wchan, (p->p_wchan && p->p_wmesg) ? p->p_wmesg : "", 520 p->p_p->ps_single); 521 (*pr)(" forw=%p, list=%p,%p\n", 522 TAILQ_NEXT(p, p_runq), p->p_list.le_next, p->p_list.le_prev); 523 (*pr)(" process=%p user=%p, vmspace=%p\n", 524 p->p_p, p->p_addr, p->p_vmspace); 525 (*pr)(" estcpu=%u, cpticks=%d, pctcpu=%u.%u, " 526 "user=%u, sys=%u, intr=%u\n", 527 p->p_estcpu, p->p_cpticks, p->p_pctcpu / 100, p->p_pctcpu % 100, 528 p->p_uticks, p->p_sticks, p->p_iticks); 529 } 530 #include <machine/db_machdep.h> 531 532 #include <ddb/db_output.h> 533 534 void 535 db_kill_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) 536 { 537 struct process *pr; 538 struct proc *p; 539 540 pr = prfind(addr); 541 if (pr == NULL) { 542 db_printf("%ld: No such process", addr); 543 return; 544 } 545 546 p = TAILQ_FIRST(&pr->ps_threads); 547 548 /* Send uncatchable SIGABRT for coredump */ 549 sigabort(p); 550 } 551 552 void 553 db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif) 554 { 555 char *mode; 556 int skipzomb = 0; 557 int has_kernel_lock = 0; 558 struct proc *p; 559 struct process *pr, *ppr; 560 561 if (modif[0] == 0) 562 modif[0] = 'n'; /* default == normal mode */ 563 564 mode = "mawno"; 565 while (*mode && *mode != modif[0]) 566 mode++; 567 if (*mode == 0 || *mode == 'm') { 568 db_printf("usage: show all procs [/a] [/n] [/w]\n"); 569 db_printf("\t/a == show process address info\n"); 570 db_printf("\t/n == show normal process info [default]\n"); 571 db_printf("\t/w == show process pgrp/wait info\n"); 572 db_printf("\t/o == show normal info for non-idle SONPROC\n"); 573 return; 574 } 575 576 pr = LIST_FIRST(&allprocess); 577 578 switch (*mode) { 579 580 case 'a': 581 db_printf(" TID %-9s %18s %18s %18s\n", 582 "COMMAND", "STRUCT PROC *", "UAREA *", "VMSPACE/VM_MAP"); 583 break; 584 case 'n': 585 db_printf(" PID %6s %5s %5s S %10s %-12s %-15s\n", 586 "TID", "PPID", "UID", "FLAGS", "WAIT", "COMMAND"); 587 break; 588 case 'w': 589 db_printf(" TID %-15s %-5s %18s %s\n", 590 "COMMAND", "PGRP", "WAIT-CHANNEL", "WAIT-MSG"); 591 break; 592 case 'o': 593 skipzomb = 1; 594 db_printf(" TID %5s %5s %10s %10s %3s %-30s\n", 595 "PID", "UID", "PRFLAGS", "PFLAGS", "CPU", "COMMAND"); 596 break; 597 } 598 599 while (pr != NULL) { 600 ppr = pr->ps_pptr; 601 602 TAILQ_FOREACH(p, &pr->ps_threads, p_thr_link) { 603 #ifdef MULTIPROCESSOR 604 if (__mp_lock_held(&kernel_lock, p->p_cpu)) 605 has_kernel_lock = 1; 606 else 607 has_kernel_lock = 0; 608 #endif 609 if (p->p_stat) { 610 if (*mode == 'o') { 611 if (p->p_stat != SONPROC) 612 continue; 613 if (p->p_cpu != NULL && p->p_cpu-> 614 ci_schedstate.spc_idleproc == p) 615 continue; 616 } 617 618 if (*mode == 'n') { 619 db_printf("%c%5d ", (p == curproc ? 620 '*' : ' '), pr->ps_pid); 621 } else { 622 db_printf("%c%6d ", (p == curproc ? 623 '*' : ' '), p->p_tid); 624 } 625 626 switch (*mode) { 627 628 case 'a': 629 db_printf("%-9.9s %18p %18p %18p\n", 630 pr->ps_comm, p, p->p_addr, p->p_vmspace); 631 break; 632 633 case 'n': 634 db_printf("%6d %5d %5d %d %#10x " 635 "%-12.12s %-15s\n", 636 p->p_tid, ppr ? ppr->ps_pid : -1, 637 pr->ps_ucred->cr_ruid, p->p_stat, 638 p->p_flag | pr->ps_flags, 639 (p->p_wchan && p->p_wmesg) ? 640 p->p_wmesg : "", pr->ps_comm); 641 break; 642 643 case 'w': 644 db_printf("%-15s %-5d %18p %s\n", 645 pr->ps_comm, (pr->ps_pgrp ? 646 pr->ps_pgrp->pg_id : -1), 647 p->p_wchan, 648 (p->p_wchan && p->p_wmesg) ? 649 p->p_wmesg : ""); 650 break; 651 652 case 'o': 653 db_printf("%5d %5d %#10x %#10x %3d" 654 "%c %-31s\n", 655 pr->ps_pid, pr->ps_ucred->cr_ruid, 656 pr->ps_flags, p->p_flag, 657 CPU_INFO_UNIT(p->p_cpu), 658 has_kernel_lock ? 'K' : ' ', 659 pr->ps_comm); 660 break; 661 662 } 663 } 664 } 665 pr = LIST_NEXT(pr, ps_list); 666 if (pr == NULL && skipzomb == 0) { 667 skipzomb = 1; 668 pr = LIST_FIRST(&zombprocess); 669 } 670 } 671 } 672 #endif 673 674 #ifdef DEBUG 675 void 676 pgrpdump(void) 677 { 678 struct pgrp *pgrp; 679 struct process *pr; 680 int i; 681 682 for (i = 0; i <= pgrphash; i++) { 683 if (!LIST_EMPTY(&pgrphashtbl[i])) { 684 printf("\tindx %d\n", i); 685 LIST_FOREACH(pgrp, &pgrphashtbl[i], pg_hash) { 686 printf("\tpgrp %p, pgid %d, sess %p, sesscnt %d, mem %p\n", 687 pgrp, pgrp->pg_id, pgrp->pg_session, 688 pgrp->pg_session->s_count, 689 LIST_FIRST(&pgrp->pg_members)); 690 LIST_FOREACH(pr, &pgrp->pg_members, ps_pglist) { 691 printf("\t\tpid %d addr %p pgrp %p\n", 692 pr->ps_pid, pr, pr->ps_pgrp); 693 } 694 } 695 } 696 } 697 } 698 #endif /* DEBUG */ 699