summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_proc.c
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2004-08-02 00:18:36 +0000
committergreen <green@FreeBSD.org>2004-08-02 00:18:36 +0000
commit9532ab7116a36e60ae15ec463c757a7d2e7f9b39 (patch)
treeff53102435294d83e0ddcbd011824aa65f84e3c8 /sys/kern/kern_proc.c
parent14a50c4ac0247a8950847156b4fc16cf935c14ca (diff)
downloadFreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.zip
FreeBSD-src-9532ab7116a36e60ae15ec463c757a7d2e7f9b39.tar.gz
* Add a "how" argument to uma_zone constructors and initialization functions
so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work.
Diffstat (limited to 'sys/kern/kern_proc.c')
-rw-r--r--sys/kern/kern_proc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index a83b9e1..a104ae4 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -74,9 +74,9 @@ static void doenterpgrp(struct proc *, struct pgrp *);
static void orphanpg(struct pgrp *pg);
static void pgadjustjobc(struct pgrp *pgrp, int entering);
static void pgdelete(struct pgrp *);
-static void proc_ctor(void *mem, int size, void *arg);
+static int proc_ctor(void *mem, int size, void *arg, int flags);
static void proc_dtor(void *mem, int size, void *arg);
-static void proc_init(void *mem, int size);
+static int proc_init(void *mem, int size, int flags);
static void proc_fini(void *mem, int size);
/*
@@ -128,12 +128,13 @@ procinit()
/*
* Prepare a proc for use.
*/
-static void
-proc_ctor(void *mem, int size, void *arg)
+static int
+proc_ctor(void *mem, int size, void *arg, int flags)
{
struct proc *p;
p = (struct proc *)mem;
+ return (0);
}
/*
@@ -178,8 +179,8 @@ proc_dtor(void *mem, int size, void *arg)
/*
* Initialize type-stable parts of a proc (when newly created).
*/
-static void
-proc_init(void *mem, int size)
+static int
+proc_init(void *mem, int size, int flags)
{
struct proc *p;
struct thread *td;
@@ -195,6 +196,7 @@ proc_init(void *mem, int size)
proc_linkup(p, kg, ke, td);
bzero(&p->p_mtx, sizeof(struct mtx));
mtx_init(&p->p_mtx, "process lock", NULL, MTX_DEF | MTX_DUPOK);
+ return (0);
}
/*
OpenPOWER on IntegriCloud