Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jul 2014 18:03:11 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Dmitry Morozovsky <marck@rinet.ru>
Cc:        Baptiste Daroussin <bapt@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, Adrian Chadd <adrian@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Pedro Giffuni <pfg@freebsd.org>, Bruce Evans <brde@optusnet.com.au>, Konstantin Belousov <kostikbel@gmail.com>
Subject:   Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/gd...
Message-ID:  <20140710172328.L1433@besplex.bde.org>
In-Reply-To: <alpine.BSF.2.00.1407101113490.40344@woozle.rinet.ru>
References:  <201407091552.s69FqUon070685@svn.freebsd.org> <53BD68E4.1070706@freebsd.org> <CAJ-VmonsZzATyWC9g-pxaQ_qDSvOh-jbiWhY=92vgmovqvn-BQ@mail.gmail.com> <20140709172305.GD56040@ivaldir.etoilebsd.net> <CAJ-Vmo=kLQ27km1hRcwFsinmBMA=UVWcZyw5gBLJ-V1UvQPuOw@mail.gmail.com> <20140709182745.GD93733@kib.kiev.ua> <20140710153824.S985@besplex.bde.org> <alpine.BSF.2.00.1407101113490.40344@woozle.rinet.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Jul 2014, Dmitry Morozovsky wrote:

> On Thu, 10 Jul 2014, Bruce Evans wrote:
>
> [snip]
>
>> FreeBSD-~5.2 i386, statically linked:
>>   PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
>>   681 root        1  76    0  1676K  1132K select   0:00  0.00% sshd
>>   659 root        1  44   r0   848K   536K select   0:00  0.00% ntpd
>>   688 root        1  76    0  2084K  1796K select   0:00  0.00% sendmail
>>
>> FreeBSD-11 i386, dynamically linked:
>>   PID USERNAME       THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU
>> COMMAN
>> 25072 bde              1  20    0 17836K  6556K select  1   0:00   0.00% sshd
>>   693 root             1  20    0 12356K  4168K select  4   0:02   0.00% ntpd
>>   744 root             1  20    0 12868K  4752K select  0   0:01   0.00%
>> sendma
>>
>> The output also shows misformatting of the USERNAME column in newer versions
>> of FreeBSD (lots of unused whitespace to kill the command name
>> non-whitespace).
>
> IIUC, this is historical tolp behaviour: username field width depends on the
> longest username on the system

Perhaps, but that is typical low-quality formatting.  The longest name in
the actual output was "unbound" (length 7), and that is also the longest
name when the output is not truncated to the top few user processes
(according to top -SHa 1000 output).

top actually has mounds of code and options (that don't work) to control
the USERNAME length:
- option TOP_USERNAME_LEN.  This just gives the default minimum name length
   and is not configured in FreeBSD
- variable namelength with an initial default of 8 if TOP_USERNAME_LEN is
   not configured.  8 is only the minumum
- namelength is replaced by the length of the longest name in the system
   found by getpwent() if than is longer.
- then namelength is clamped to limit the damage from the previous step:
   In the SMP case, namelength is limited to SMPNAMELEN = 13, and in the
   UP case it is limited to UPNAMELEN = 15.  The extra 2 for the UP case
   is because UP doesn't have a CPU field, so 2 more columns can be wasted
   without damaging the COMMAND field any more than for the SMP case.

The above misformatting is to about the maximal length SMPNAMELEN = 13.

FreeBSD cluster machine /etc/passwd files have about 2% of names longer
than 8, mostly for special purposes.

Bruce



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