top: add a program name to 'Ctrl' bottom window header

This minor addition to that new 'Ctrl' feature is more
important than it seems. It's responsible for alerting
yours truly to the 'LIBPROC_HIDE_KERNEL' bug addressed
in the very next commit. All this while, program names
for some tasks would be mysteriously replaced with the
kernel 'kworker' names. However, customary clutter for
the top process display tended to obscure such a fact.

[ and, of course, to notice the problem in the first ]
[ place required one to have the command line toggle ]
[ 'off' or perhaps to toggle its state 'on' & 'off'. ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2022-05-01 00:00:00 -05:00 committed by Craig Small
parent 6b24d11b07
commit bad7f2a263

View File

@ -4640,7 +4640,8 @@ static void wins_tag_cmdline (void) {
break; break;
} }
if (i < PIDSmaxt) { if (i < PIDSmaxt) {
snprintf(buf, sizeof(buf), "command line for pid %d:", Tagged_task); snprintf(buf, sizeof(buf), " command line for pid %d, %s"
, Tagged_task, PID_VAL(EU_CMD, str, Curwin->ppt[i]));
#ifndef TAG_CMD_MUST #ifndef TAG_CMD_MUST
p = PID_VAL(eu_CMDLINE, str, Curwin->ppt[i]); p = PID_VAL(eu_CMDLINE, str, Curwin->ppt[i]);
if (!p || !*p) p = "n/a"; if (!p || !*p) p = "n/a";
@ -4671,7 +4672,8 @@ static void wins_tag_generic (void) {
break; break;
} }
if (i < PIDSmaxt) { if (i < PIDSmaxt) {
snprintf(buf, sizeof(buf), "%s for pid %d:", Tagged_name, Tagged_task); snprintf(buf, sizeof(buf), " %s for pid %d, %s"
, Tagged_name, Tagged_task, PID_VAL(EU_CMD, str, Curwin->ppt[i]));
p = PID_VAL(eu_GENERIC, str, Curwin->ppt[i]); p = PID_VAL(eu_GENERIC, str, Curwin->ppt[i]);
if (!p || !*p || !strcmp(p, "-")) p = "n/a"; if (!p || !*p || !strcmp(p, "-")) p = "n/a";
Tagged_rsvd = 1 + TAGGED_RSVD + (strlen(p) / Screen_cols); Tagged_rsvd = 1 + TAGGED_RSVD + (strlen(p) / Screen_cols);