Deleted Added
full compact
kern_proc.c (132855) kern_proc.c (132987)
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 132855 2004-07-29 20:27:59Z pjd $
30 * $FreeBSD: head/sys/kern/kern_proc.c 132987 2004-08-02 00:18:36Z green $
31 */
32
33#include <sys/cdefs.h>
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 132855 2004-07-29 20:27:59Z pjd $");
34__FBSDID("$FreeBSD: head/sys/kern/kern_proc.c 132987 2004-08-02 00:18:36Z green $");
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>

--- 26 unchanged lines hidden (view full) ---

69MALLOC_DEFINE(M_SESSION, "session", "session header");
70static MALLOC_DEFINE(M_PROC, "proc", "Proc structures");
71MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures");
72
73static void doenterpgrp(struct proc *, struct pgrp *);
74static void orphanpg(struct pgrp *pg);
75static void pgadjustjobc(struct pgrp *pgrp, int entering);
76static void pgdelete(struct pgrp *);
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>

--- 26 unchanged lines hidden (view full) ---

69MALLOC_DEFINE(M_SESSION, "session", "session header");
70static MALLOC_DEFINE(M_PROC, "proc", "Proc structures");
71MALLOC_DEFINE(M_SUBPROC, "subproc", "Proc sub-structures");
72
73static void doenterpgrp(struct proc *, struct pgrp *);
74static void orphanpg(struct pgrp *pg);
75static void pgadjustjobc(struct pgrp *pgrp, int entering);
76static void pgdelete(struct pgrp *);
77static void proc_ctor(void *mem, int size, void *arg);
77static int proc_ctor(void *mem, int size, void *arg, int flags);
78static void proc_dtor(void *mem, int size, void *arg);
78static void proc_dtor(void *mem, int size, void *arg);
79static void proc_init(void *mem, int size);
79static int proc_init(void *mem, int size, int flags);
80static void proc_fini(void *mem, int size);
81
82/*
83 * Other process lists
84 */
85struct pidhashhead *pidhashtbl;
86u_long pidhash;
87struct pgrphashhead *pgrphashtbl;

--- 35 unchanged lines hidden (view full) ---

123 proc_ctor, proc_dtor, proc_init, proc_fini,
124 UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
125 uihashinit();
126}
127
128/*
129 * Prepare a proc for use.
130 */
80static void proc_fini(void *mem, int size);
81
82/*
83 * Other process lists
84 */
85struct pidhashhead *pidhashtbl;
86u_long pidhash;
87struct pgrphashhead *pgrphashtbl;

--- 35 unchanged lines hidden (view full) ---

123 proc_ctor, proc_dtor, proc_init, proc_fini,
124 UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
125 uihashinit();
126}
127
128/*
129 * Prepare a proc for use.
130 */
131static void
132proc_ctor(void *mem, int size, void *arg)
131static int
132proc_ctor(void *mem, int size, void *arg, int flags)
133{
134 struct proc *p;
135
136 p = (struct proc *)mem;
133{
134 struct proc *p;
135
136 p = (struct proc *)mem;
137 return (0);
137}
138
139/*
140 * Reclaim a proc after use.
141 */
142static void
143proc_dtor(void *mem, int size, void *arg)
144{

--- 28 unchanged lines hidden (view full) ---

173 * on the state coming in here from wait4().
174 */
175 proc_linkup(p, kg, ke, td);
176}
177
178/*
179 * Initialize type-stable parts of a proc (when newly created).
180 */
138}
139
140/*
141 * Reclaim a proc after use.
142 */
143static void
144proc_dtor(void *mem, int size, void *arg)
145{

--- 28 unchanged lines hidden (view full) ---

174 * on the state coming in here from wait4().
175 */
176 proc_linkup(p, kg, ke, td);
177}
178
179/*
180 * Initialize type-stable parts of a proc (when newly created).
181 */
181static void
182proc_init(void *mem, int size)
182static int
183proc_init(void *mem, int size, int flags)
183{
184 struct proc *p;
185 struct thread *td;
186 struct ksegrp *kg;
187 struct kse *ke;
188
189 p = (struct proc *)mem;
190 p->p_sched = (struct p_sched *)&p[1];
191 vm_proc_new(p);
192 td = thread_alloc();
193 ke = kse_alloc();
194 kg = ksegrp_alloc();
195 proc_linkup(p, kg, ke, td);
196 bzero(&p->p_mtx, sizeof(struct mtx));
197 mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
184{
185 struct proc *p;
186 struct thread *td;
187 struct ksegrp *kg;
188 struct kse *ke;
189
190 p = (struct proc *)mem;
191 p->p_sched = (struct p_sched *)&p[1];
192 vm_proc_new(p);
193 td = thread_alloc();
194 ke = kse_alloc();
195 kg = ksegrp_alloc();
196 proc_linkup(p, kg, ke, td);
197 bzero(&p->p_mtx, sizeof(struct mtx));
198 mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
199 return (0);
198}
199
200/*
201 * Tear down type-stable parts of a proc (just before being discarded)
202 */
203static void
204proc_fini(void *mem, int size)
205{

--- 1058 unchanged lines hidden ---
200}
201
202/*
203 * Tear down type-stable parts of a proc (just before being discarded)
204 */
205static void
206proc_fini(void *mem, int size)
207{

--- 1058 unchanged lines hidden ---