summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2011-01-27 00:34:12 +0000
committermdf <mdf@FreeBSD.org>2011-01-27 00:34:12 +0000
commit7fc649fc41274dcd3ffbed0d354a418b71e65786 (patch)
treee4eadeb1ff33d6db2e7b3001b1b8a9e9c21e2a2f /sys/kern/kern_malloc.c
parent886222db75f8a2f0e19f97934a5375f602e0987a (diff)
downloadFreeBSD-src-7fc649fc41274dcd3ffbed0d354a418b71e65786.zip
FreeBSD-src-7fc649fc41274dcd3ffbed0d354a418b71e65786.tar.gz
Explicitly wire the user buffer rather than doing it implicitly in
sbuf_new_for_sysctl(9). This allows using an sbuf with a SYSCTL_OUT drain for extremely large amounts of data where the caller knows that appropriate references are held, and sleeping is not an issue. Inspired by: rwatson
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 9c7ff40..a3a9795 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -862,6 +862,9 @@ sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS)
int error, i;
struct sbuf sbuf;
+ error = sysctl_wire_old_buffer(req, 0);
+ if (error != 0)
+ return (error);
sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
mtx_lock(&malloc_mtx);
@@ -1019,6 +1022,9 @@ sysctl_kern_mprof(SYSCTL_HANDLER_ARGS)
waste = 0;
mem = 0;
+ error = sysctl_wire_old_buffer(req, 0);
+ if (error != 0)
+ return (error);
sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
sbuf_printf(&sbuf,
"\n Size Requests Real Size\n");
OpenPOWER on IntegriCloud