From bad7f2a2634d197a76d87ca8168d117965c81c10 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Sun, 1 May 2022 00:00:00 -0500 Subject: [PATCH] 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 --- top/top.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/top/top.c b/top/top.c index b8833f16..1f7bedad 100644 --- a/top/top.c +++ b/top/top.c @@ -4640,7 +4640,8 @@ static void wins_tag_cmdline (void) { break; } 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 p = PID_VAL(eu_CMDLINE, str, Curwin->ppt[i]); if (!p || !*p) p = "n/a"; @@ -4671,7 +4672,8 @@ static void wins_tag_generic (void) { break; } 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]); if (!p || !*p || !strcmp(p, "-")) p = "n/a"; Tagged_rsvd = 1 + TAGGED_RSVD + (strlen(p) / Screen_cols);