Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Nov 2008 17:11:44 -0600
From:      Dan Nelson <dnelson@allantgroup.com>
To:        David Christensen <davidch@broadcom.com>
Cc:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: Dumping Large Binary Buffer Through Sysctl
Message-ID:  <20081108231144.GG85407@dan.emsphone.com>
In-Reply-To: <5D267A3F22FD854F8F48B3D2B523819339364836FC@IRVEXCHCCR01.corp.ad.broadcom.com>
References:  <5D267A3F22FD854F8F48B3D2B523819339364836FC@IRVEXCHCCR01.corp.ad.broadcom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081108231144.GG85407>