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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to