cvs commit: src/sys/kern kern_mutex.c
Robert Watson
rwatson at FreeBSD.org
Sun Apr 10 08:05:00 PDT 2005
On Fri, 8 Apr 2005, John Baldwin wrote:
>>>> Log:
>>>> Add additional newline to debug.mutex.prof.stats header, so that
>>>> column names are printed exactly above the columns.
>>>
>>> This is bogus, as is the existence of sysctls that format data (*).
>>>
>>> (*) Formatted output is not too bad for sysctls in the debug tree, but
>>> for general-purpose sysctls it is just a bug.
>>
>> I disagree.
>
> It's a lot easier to parse a structured binary blob than to parse
> formatted text so that you can display it differently. Note that I
> would consider XML ala GEOM to be more of the blob style since the
> whitespace isn't significant. It should be up to userland to do whatever
> formatting of data is required. For small things like 'current
> timecounter' or 'list of valid CPU frequencies' simple strings with
> space delimiting is probably fine though. Trying to format complex data
> into multiple lines with columns and headers doesn't belong in the
> kernel outside of ddb IMO.
FWIW, I ran precisely into the "formatted text sysctl" problem recently
when looking at adapting netstat -mb to use UMA's statistics output rather
than mbuf-specific sysctls. In order to extract the mbuf entries from the
current sysctl, you have to do some text parsing and munging. However,
finding a useful middle ground is non-trivial. XML is one possibility,
but we can probably get away with something simpler. I was chatting with
Poul-Henning about this on Friday, and he wondered about exporting the
column list as one sysctl, and then all of the raws separated by \t's and
\n's in another sysctl. It still requires a bit of text frobbing, but
doesn't require the kernel to do the formatting, etc.
Robert N M Watson
More information about the cvs-src
mailing list