svn commit: r324427 - head/bin/ps

Bruce Evans brde at optusnet.com.au
Mon Oct 9 12:54:36 UTC 2017


{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 at 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


More information about the svn-src-all mailing list