summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_witness.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2010-09-16 16:13:12 +0000
committermdf <mdf@FreeBSD.org>2010-09-16 16:13:12 +0000
commit5695ef46983ceb88b1862571c052f8da0fac0275 (patch)
treeafd1abc4a36abd5ca015ead87a457fe7f1968ed9 /sys/kern/subr_witness.c
parent39642e55302d3d222f5a118fb3a4c6eb91d7e5a0 (diff)
downloadFreeBSD-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/kern/subr_witness.c')
-rw-r--r--sys/kern/subr_witness.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c
index e5aa8dca..3fec4c4 100644
--- a/sys/kern/subr_witness.c
+++ b/sys/kern/subr_witness.c
@@ -154,8 +154,7 @@ __FBSDID("$FreeBSD$");
#define MAX_W_NAME 64
#define BADSTACK_SBUF_SIZE (256 * WITNESS_COUNT)
-#define CYCLEGRAPH_SBUF_SIZE 8192
-#define FULLGRAPH_SBUF_SIZE 32768
+#define FULLGRAPH_SBUF_SIZE 512
/*
* These flags go in the witness relationship matrix and describe the
@@ -2545,7 +2544,7 @@ sysctl_debug_witness_fullgraph(SYSCTL_HANDLER_ARGS)
return (error);
}
error = 0;
- sb = sbuf_new(NULL, NULL, FULLGRAPH_SBUF_SIZE, SBUF_FIXEDLEN);
+ sb = sbuf_new_for_sysctl(NULL, NULL, FULLGRAPH_SBUF_SIZE, req);
if (sb == NULL)
return (ENOMEM);
sbuf_printf(sb, "\n");
@@ -2558,19 +2557,9 @@ sysctl_debug_witness_fullgraph(SYSCTL_HANDLER_ARGS)
mtx_unlock_spin(&w_mtx);
/*
- * While using SBUF_FIXEDLEN, check if the sbuf overflowed.
- */
- if (sbuf_error(sb) != 0) {
- sbuf_delete(sb);
- panic("%s: sbuf overflowed, bump FULLGRAPH_SBUF_SIZE value\n",
- __func__);
- }
-
- /*
* Close the sbuf and return to userland.
*/
- sbuf_finish(sb);
- error = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1);
+ error = sbuf_finish(sb);
sbuf_delete(sb);
return (error);
OpenPOWER on IntegriCloud