Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Apr 2005 01:16:51 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_mutex.c
Message-ID:  <20050409002141.V48108@delplex.bde.org>
In-Reply-To: <200504081414.j38EE9OC051194@repoman.freebsd.org>
References:  <200504081414.j38EE9OC051194@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 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 (*).
Use "sysctl -n debug.mutex.prof.stats" 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 vm.zone.  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 vm.zone,
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 vm.zone 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 vm.zone was originally a good example
of how to avoid the bug of printing an extra newline at the end, but
vm.zone 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
bug.

Bruce



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