Re: Dumping Large Binary Buffer Through Sysctl

From: Dan Nelson <dnelson_at_allantgroup.com>
Date: Sat, 8 Nov 2008 17:11:44 -0600
In the last episode (Nov 08), David Christensen said:
> I'm looking for a way to dump a large binary debug buffer 
> in a driver to a file.  I've currently implemented this
> with SYSCTL_ADD_OPAQUE() and it works fine but running the
> "sysctl -a" command causes this buffer to be dumped which
> is something of a pain.  Is there a better way to do this?

Opaque values aren't really automatically skipped by /sbin/sysctl; the
format string is checked, and if the format isn't handled by
show_var(), it's not printed.  Formats don't seem to be documented
anywhere, though.  Try a blank format string.  This will print all
"opaque" (not necessarily CTLTYPE_OPAQUE) variables, and their reported
format strings:

sysctl -ao | sed -ne 's/Length.*//p'

Here are some weird ones that are probably typos:

vfs.nfs.diskless_rootaddr: Format:%Ssockaddr_in
kern.malloc_stats: Format:s,malloc_type_ustats
vm.zone_stats: Format:s,struct uma_type_header

-- 
	Dan Nelson
	dnelson_at_allantgroup.com
Received on Sat Nov 08 2008 - 22:11:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:37 UTC