diff options
author | mdf <mdf@FreeBSD.org> | 2010-09-16 16:13:12 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2010-09-16 16:13:12 +0000 |
commit | 5695ef46983ceb88b1862571c052f8da0fac0275 (patch) | |
tree | afd1abc4a36abd5ca015ead87a457fe7f1968ed9 /sys/vm/vm_reserv.c | |
parent | 39642e55302d3d222f5a118fb3a4c6eb91d7e5a0 (diff) | |
download | FreeBSD-src-5695ef46983ceb88b1862571c052f8da0fac0275.zip FreeBSD-src-5695ef46983ceb88b1862571c052f8da0fac0275.tar.gz |
Re-add r212370 now that the LOR in powerpc64 has been resolved:
Add a drain function for struct sysctl_req, and use it for a variety
of handlers, some of which had to do awkward things to get a large
enough SBUF_FIXEDLEN buffer.
Note that some sysctl handlers were explicitly outputting a trailing
NUL byte. This behaviour was preserved, though it should not be
necessary.
Reviewed by: phk (original patch)
Diffstat (limited to 'sys/vm/vm_reserv.c')
-rw-r--r-- | sys/vm/vm_reserv.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index d9e908f..aa8e80f 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -180,12 +180,9 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) { struct sbuf sbuf; vm_reserv_t rv; - char *cbuf; - const int cbufsize = (VM_NRESERVLEVEL + 1) * 81; int counter, error, level, unused_pages; - cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO); - sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN); + sbuf_new_for_sysctl(&sbuf, NULL, 128, req); sbuf_printf(&sbuf, "\nLEVEL SIZE NUMBER\n\n"); for (level = -1; level <= VM_NRESERVLEVEL - 2; level++) { counter = 0; @@ -199,10 +196,8 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", level, unused_pages * (PAGE_SIZE / 1024), counter); } - sbuf_finish(&sbuf); - error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf)); + error = sbuf_finish(&sbuf); sbuf_delete(&sbuf); - free(cbuf, M_TEMP); return (error); } |