Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Oct 2017 23:53:57 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Sergey Kandaurov <pluknet@gmail.com>
Cc:        Edward Tomasz Napierala <trasz@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r324427 - head/bin/ps
Message-ID:  <20171009231134.P2645@besplex.bde.org>
In-Reply-To: <CAE-mSOJxwCr5uMj6-6s2uoKAtOv3Zi2Fznwm266xFOhxOBaXVQ@mail.gmail.com>
References:  <201710091024.v99AO6pt011672@repo.freebsd.org> <CAE-mSOJxwCr5uMj6-6s2uoKAtOv3Zi2Fznwm266xFOhxOBaXVQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
{Please ignore my previous null reply]

On Mon, 9 Oct 2017, Sergey Kandaurov wrote:

> On 9 October 2017 at 13:24, Edward Tomasz Napierala <trasz@freebsd.org>
> wrote:
>
>> Author: trasz
>> Date: Mon Oct  9 10:24:06 2017
>> New Revision: 324427
>> URL: https://svnweb.freebsd.org/changeset/base/324427
>>
>> Log:
>>   Document "tdnam" keyword to ps(1), and add "tdname" alias.
>> Modified: head/bin/ps/keyword.c
>> ============================================================
>> ==================
>> --- head/bin/ps/keyword.c       Mon Oct  9 08:50:03 2017        (r324426)
>> +++ head/bin/ps/keyword.c       Mon Oct  9 10:24:06 2017        (r324427)
>> @@ -201,6 +201,7 @@ static VAR var[] = {
>>         {"tdev", "TDEV", NULL, "terminal-device", 0, tdev, 0, CHAR, NULL,
>> 0},
>>         {"tdnam", "TDNAM", NULL, "terminal-device-name", LJUST, tdnam, 0,
>> CHAR,
>>             NULL, 0},
>
> Hello,
> could you please fix this ^^ "tdnam" description as well?
> fwiw, looks like it's only used in libxo as a field name.

Since it is badly designed and implemented, 2 names for it are worse than
for any other keyword.  Perhaps since it was undocumented in the man page
and misdocumented in the screen, nothing uses it and you can rename it
without anything noticing it.

(Design errors start with splitting thread and proc names in a way that
is difficult for applications to untangle.  Implementation errors start
with abusing the space reserved for the old command name (ki_ocomm) for
ki_tdname.  This helps break old applications that only understand
ki_ocomm.  TDNAMLEN = OCOMMLEN = 16 is also too small, and its name is
spelled without an E, unlike all other *NAMELEN names in <sys/user.h>.
This is too short.  It is only 3 shorter than COMMLEN, but should probably
be longer, depending on how thread and proc names are split.

The last bug has been partly fixed.  There is now ki_moretdname[].  This
has length just 3 (plus 1 for a NUL) to make allow expansion of thread
names to the same length as proc names (19).  ps and top actually
understand this (except the update to use it is missing in ps/ps.c; it
is only in ps/print.c).

Thread names are also printed for the comm and command keywords in ps.
They are essentially appended to ki_comm.  This is too simple of ki_comm
already contains some thread info.  A negative amount of space is
available for expansion.  if the user uses tdnam then it is even more
difficult to get a good combination of proc and thread info.

Bruce



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