kern_proc.c (143467) | kern_proc.c (143740) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)kern_proc.c 8.7 (Berkeley) 2/14/95 |
30 * $FreeBSD: head/sys/kern/kern_proc.c 143467 2005-03-12 14:31:04Z pjd $ | 30 * $FreeBSD: head/sys/kern/kern_proc.c 143740 2005-03-17 08:44:41Z phk $ |
31 */ 32 33#include <sys/cdefs.h> | 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 143467 2005-03-12 14:31:04Z pjd $"); | 34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 143740 2005-03-17 08:44:41Z phk $"); |
35 36#include "opt_ktrace.h" 37#include "opt_kstack_pages.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 381 unchanged lines hidden (view full) --- 424/* 425 * delete a process group 426 */ 427static void 428pgdelete(pgrp) 429 register struct pgrp *pgrp; 430{ 431 struct session *savesess; | 35 36#include "opt_ktrace.h" 37#include "opt_kstack_pages.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#include <sys/lock.h> --- 381 unchanged lines hidden (view full) --- 424/* 425 * delete a process group 426 */ 427static void 428pgdelete(pgrp) 429 register struct pgrp *pgrp; 430{ 431 struct session *savesess; |
432 int i; | |
433 434 sx_assert(&proctree_lock, SX_XLOCKED); 435 PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); 436 SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); 437 438 /* 439 * Reset any sigio structures pointing to us as a result of 440 * F_SETOWN with our pgid. 441 */ 442 funsetownlst(&pgrp->pg_sigiolst); 443 444 PGRP_LOCK(pgrp); 445 if (pgrp->pg_session->s_ttyp != NULL && 446 pgrp->pg_session->s_ttyp->t_pgrp == pgrp) 447 pgrp->pg_session->s_ttyp->t_pgrp = NULL; 448 LIST_REMOVE(pgrp, pg_hash); 449 savesess = pgrp->pg_session; | 432 433 sx_assert(&proctree_lock, SX_XLOCKED); 434 PGRP_LOCK_ASSERT(pgrp, MA_NOTOWNED); 435 SESS_LOCK_ASSERT(pgrp->pg_session, MA_NOTOWNED); 436 437 /* 438 * Reset any sigio structures pointing to us as a result of 439 * F_SETOWN with our pgid. 440 */ 441 funsetownlst(&pgrp->pg_sigiolst); 442 443 PGRP_LOCK(pgrp); 444 if (pgrp->pg_session->s_ttyp != NULL && 445 pgrp->pg_session->s_ttyp->t_pgrp == pgrp) 446 pgrp->pg_session->s_ttyp->t_pgrp = NULL; 447 LIST_REMOVE(pgrp, pg_hash); 448 savesess = pgrp->pg_session; |
450 SESS_LOCK(savesess); 451 i = --savesess->s_count; 452 SESS_UNLOCK(savesess); | 449 SESSRELE(savesess); |
453 PGRP_UNLOCK(pgrp); | 450 PGRP_UNLOCK(pgrp); |
454 if (i == 0) { 455 if (savesess->s_ttyp != NULL) 456 ttyrel(savesess->s_ttyp); 457 mtx_destroy(&savesess->s_mtx); 458 FREE(savesess, M_SESSION); 459 } | |
460 mtx_destroy(&pgrp->pg_mtx); 461 FREE(pgrp, M_PGRP); 462} 463 464static void 465pgadjustjobc(pgrp, entering) 466 struct pgrp *pgrp; 467 int entering; --- 87 unchanged lines hidden (view full) --- 555 PROC_UNLOCK(p); 556 } 557 return; 558 } 559 PROC_UNLOCK(p); 560 } 561} 562 | 451 mtx_destroy(&pgrp->pg_mtx); 452 FREE(pgrp, M_PGRP); 453} 454 455static void 456pgadjustjobc(pgrp, entering) 457 struct pgrp *pgrp; 458 int entering; --- 87 unchanged lines hidden (view full) --- 546 PROC_UNLOCK(p); 547 } 548 return; 549 } 550 PROC_UNLOCK(p); 551 } 552} 553 |
554void 555sessrele(struct session *s) 556{ 557 int i; 558 559 SESS_LOCK(s); 560 i = --s->s_count; 561 SESS_UNLOCK(s); 562 if (i == 0) { 563 if (s->s_ttyp != NULL) 564 ttyrel(s->s_ttyp); 565 mtx_destroy(&s->s_mtx); 566 FREE(s, M_SESSION); 567 } 568} 569 |
|
563#include "opt_ddb.h" 564#ifdef DDB 565#include <ddb/ddb.h> 566 567DB_SHOW_COMMAND(pgrpdump, pgrpdump) 568{ 569 register struct pgrp *pgrp; 570 register struct proc *p; --- 696 unchanged lines hidden --- | 570#include "opt_ddb.h" 571#ifdef DDB 572#include <ddb/ddb.h> 573 574DB_SHOW_COMMAND(pgrpdump, pgrpdump) 575{ 576 register struct pgrp *pgrp; 577 register struct proc *p; --- 696 unchanged lines hidden --- |