diff options
author | mdf <mdf@FreeBSD.org> | 2011-01-27 00:34:12 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2011-01-27 00:34:12 +0000 |
commit | 7fc649fc41274dcd3ffbed0d354a418b71e65786 (patch) | |
tree | e4eadeb1ff33d6db2e7b3001b1b8a9e9c21e2a2f /sys/vm | |
parent | 886222db75f8a2f0e19f97934a5375f602e0987a (diff) | |
download | FreeBSD-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/vm')
-rw-r--r-- | sys/vm/uma_core.c | 3 | ||||
-rw-r--r-- | sys/vm/vm_phys.c | 11 | ||||
-rw-r--r-- | sys/vm/vm_reserv.c | 3 |
3 files changed, 16 insertions, 1 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 1c0ef0f..c4fa715 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3224,6 +3224,9 @@ sysctl_vm_zone_stats(SYSCTL_HANDLER_ARGS) uma_keg_t k; int count, error, i; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); count = 0; diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c index 0143b5b..93fee70 100644 --- a/sys/vm/vm_phys.c +++ b/sys/vm/vm_phys.c @@ -125,6 +125,9 @@ sysctl_vm_phys_free(SYSCTL_HANDLER_ARGS) struct vm_freelist *fl; int error, flind, oind, pind; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (flind = 0; flind < vm_nfreelists; flind++) { sbuf_printf(&sbuf, "\nFREE LIST %d:\n" @@ -161,6 +164,9 @@ sysctl_vm_phys_segs(SYSCTL_HANDLER_ARGS) struct vm_phys_seg *seg; int error, segind; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); for (segind = 0; segind < vm_phys_nsegs; segind++) { sbuf_printf(&sbuf, "\nSEGMENT %d:\n\n", segind); @@ -187,8 +193,11 @@ sysctl_vm_phys_lookup_lists(SYSCTL_HANDLER_ARGS) struct sbuf sbuf; int domain, error, flind, ndomains; - ndomains = vm_nfreelists - VM_NFREELIST + 1; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); + ndomains = vm_nfreelists - VM_NFREELIST + 1; for (domain = 0; domain < ndomains; domain++) { sbuf_printf(&sbuf, "\nDOMAIN %d:\n\n", domain); for (flind = 0; flind < vm_nfreelists; flind++) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index d6cbc83..fec0539 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -182,6 +182,9 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) vm_reserv_t rv; int counter, error, level, unused_pages; + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_printf(&sbuf, "\nLEVEL SIZE NUMBER\n\n"); for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { |