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
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_proc.c 8.4 (Berkeley) 1/4/94
34 * $Id: kern_proc.c,v 1.13 1995/12/07 12:46:47 davidg Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/sysctl.h>
41#include <sys/proc.h>
42#include <sys/buf.h>
--- 17 unchanged lines hidden (view full) ---
60
61struct prochd qs[NQS]; /* as good a place as any... */
62struct prochd rtqs[NQS]; /* Space for REALTIME queues too */
63struct prochd idqs[NQS]; /* Space for IDLE queues too */
64
65volatile struct proc *allproc; /* all processes */
66struct proc *zombproc; /* just zombies */
67
68static void pgdelete __P((struct pgrp *));
69
70/*
71 * Structure associated with user cacheing.
72 */
73static struct uidinfo {
74 struct uidinfo *ui_next;
75 struct uidinfo **ui_prev;
76 uid_t ui_uid;
77 long ui_proccnt;
78} **uihashtbl;
79static u_long uihash; /* size of hash table - 1 */
80#define UIHASH(uid) ((uid) & uihash)
81
82static void orphanpg __P((struct pgrp *pg));
83
84/*
85 * Allocate a hash table.
86 */
87void
--- 214 unchanged lines hidden (view full) ---
302 pgdelete(p->p_pgrp);
303 p->p_pgrp = 0;
304 return (0);
305}
306
307/*
308 * delete a process group
309 */
310static void
311pgdelete(pgrp)
312 register struct pgrp *pgrp;
313{
314 register struct pgrp **pgp = &pgrphash[PIDHASH(pgrp->pg_id)];
315
316 if (pgrp->pg_session->s_ttyp != NULL &&
317 pgrp->pg_session->s_ttyp->t_pgrp == pgrp)
318 pgrp->pg_session->s_ttyp->t_pgrp = NULL;
--- 250 unchanged lines hidden ---
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
--- 17 unchanged lines hidden (view full) ---
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)kern_proc.c 8.4 (Berkeley) 1/4/94
34 * $Id: kern_proc.c,v 1.13 1995/12/07 12:46:47 davidg Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/kernel.h>
40#include <sys/sysctl.h>
41#include <sys/proc.h>
42#include <sys/buf.h>
--- 17 unchanged lines hidden (view full) ---
60
61struct prochd qs[NQS]; /* as good a place as any... */
62struct prochd rtqs[NQS]; /* Space for REALTIME queues too */
63struct prochd idqs[NQS]; /* Space for IDLE queues too */
64
65volatile struct proc *allproc; /* all processes */
66struct proc *zombproc; /* just zombies */
67
68static void pgdelete __P((struct pgrp *));
69
70/*
71 * Structure associated with user cacheing.
72 */
73static struct uidinfo {
74 struct uidinfo *ui_next;
75 struct uidinfo **ui_prev;
76 uid_t ui_uid;
77 long ui_proccnt;
78} **uihashtbl;
79static u_long uihash; /* size of hash table - 1 */
80#define UIHASH(uid) ((uid) & uihash)
81
82static void orphanpg __P((struct pgrp *pg));
83
84/*
85 * Allocate a hash table.
86 */
87void
--- 214 unchanged lines hidden (view full) ---
302 pgdelete(p->p_pgrp);
303 p->p_pgrp = 0;
304 return (0);
305}
306
307/*
308 * delete a process group
309 */
310static void
311pgdelete(pgrp)
312 register struct pgrp *pgrp;
313{
314 register struct pgrp **pgp = &pgrphash[PIDHASH(pgrp->pg_id)];
315
316 if (pgrp->pg_session->s_ttyp != NULL &&
317 pgrp->pg_session->s_ttyp->t_pgrp == pgrp)
318 pgrp->pg_session->s_ttyp->t_pgrp = NULL;
--- 250 unchanged lines hidden ---