From owner-freebsd-current@FreeBSD.ORG Sat Nov 8 23:11:47 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFBD81065670 for ; Sat, 8 Nov 2008 23:11:47 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id 907CF8FC08 for ; Sat, 8 Nov 2008 23:11:47 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id mA8NBkdR045457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 8 Nov 2008 17:11:46 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id mA8NBjDl045452; Sat, 8 Nov 2008 17:11:45 -0600 (CST) (envelope-from dan) Date: Sat, 8 Nov 2008 17:11:44 -0600 From: Dan Nelson To: David Christensen Message-ID: <20081108231144.GG85407@dan.emsphone.com> References: <5D267A3F22FD854F8F48B3D2B523819339364836FC@IRVEXCHCCR01.corp.ad.broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5D267A3F22FD854F8F48B3D2B523819339364836FC@IRVEXCHCCR01.corp.ad.broadcom.com> X-OS: FreeBSD 7.1-PRERELEASE User-Agent: Mutt/1.5.18 (2008-05-17) Cc: "freebsd-current@freebsd.org" Subject: Re: Dumping Large Binary Buffer Through Sysctl X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Nov 2008 23:11:47 -0000 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