From 9532ab7116a36e60ae15ec463c757a7d2e7f9b39 Mon Sep 17 00:00:00 2001 From: green Date: Mon, 2 Aug 2004 00:18:36 +0000 Subject: * 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. --- sys/security/mac/mac_label.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/security/mac/mac_label.c') diff --git a/sys/security/mac/mac_label.c b/sys/security/mac/mac_label.c index eedc1df..19bd5b0 100644 --- a/sys/security/mac/mac_label.c +++ b/sys/security/mac/mac_label.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); uma_zone_t zone_label; -static void mac_labelzone_ctor(void *mem, int size, void *arg); +static int mac_labelzone_ctor(void *mem, int size, void *arg, int flags); static void mac_labelzone_dtor(void *mem, int size, void *arg); void @@ -57,8 +57,8 @@ mac_labelzone_init(void) UMA_ALIGN_PTR, 0); } -static void -mac_labelzone_ctor(void *mem, int size, void *arg) +static int +mac_labelzone_ctor(void *mem, int size, void *arg, int flags) { struct label *label; @@ -66,6 +66,7 @@ mac_labelzone_ctor(void *mem, int size, void *arg) label = mem; bzero(label, sizeof(*label)); label->l_flags = MAC_FLAG_INITIALIZED; + return (0); } static void -- cgit v1.1