cvs commit: src/sys/kern kern_mutex.c

Bruce Evans bde at
Fri Apr 8 08:16:56 PDT 2005

On Fri, 8 Apr 2005, Gleb Smirnoff wrote:

> glebius     2005-04-08 14:14:09 UTC
>  FreeBSD src repository
>  Modified files:
>    sys/kern             kern_mutex.c
>  Log:
>  Add additional newline to header, so that
>  column names are printed exactly above the columns.

This is bogus, as is the existence of sysctls that format data (*).
Use "sysctl -n" if you don't want sysctl(8)'s
printing of the sysctl name to mess up the header.  The new newline
misformats output for this usage.

(*) Formatted output is not too bad for sysctls in the debug tree, but
for general-purpose sysctls it is just a bug.

The main examples of formatted syscalls that shouldn't exist are
kern.malloc and  These are used by vmstat(8) to give misformatted
output which is missing interesting details like the totals.

These sysctls also have bogus newlines (2 each).  A newline before the
header gives bogus output for sysctl -n kern.malloc, sysctl -n,
vmstat -m and vmstate -z, but vmstat(8) depends on it to separate the
tables for -m and -z.

Sloppily formatted string sysctls like kern.malloc and also
print a newline at the end.  This gives an extra newline at the end
for sysctl -n, since sysctl(8) prints one for all string sysctls in
the expectation that the strings aren't whole lines.  vmstat(8) knows
about this newline and doesn't print another one.

The original implementation of was originally a good example
of how to avoid the bug of printing an extra newline at the end, but was broken in rev.1.1 of uma_core.c.  Where rev.1.55 of vm_zone.c
does "offset--; *offset = '\0';" to kill the newline, uma_core.c does
"*offset++ = '\0';".  kern.malloc does neither of these, so it returns
a non-string.  Both sysctl(8) and vmstat(8) silently work around this


More information about the cvs-src mailing list