From 85c3c3a88a000481254e01740ad396143ac2bca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 9 Jan 2024 23:10:03 +0100 Subject: Linux: add process column whether it is marked a container process Might be useful for some users and for debugging the hideRunningInContainer detection. --- linux/LinuxProcess.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'linux/LinuxProcess.c') diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index b97a9ad7..61fb10e9 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -106,6 +106,7 @@ const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [CWD] = { .name = "CWD", .title = "CWD ", .description = "The current working directory of the process", .flags = PROCESS_FLAG_CWD, }, [AUTOGROUP_ID] = { .name = "AUTOGROUP_ID", .title = "AGRP", .description = "The autogroup identifier of the process", .flags = PROCESS_FLAG_LINUX_AUTOGROUP, }, [AUTOGROUP_NICE] = { .name = "AUTOGROUP_NICE", .title = " ANI", .description = "Nice value (the higher the value, the more other processes take priority) associated with the process autogroup", .flags = PROCESS_FLAG_LINUX_AUTOGROUP, }, + [ISCONTAINER] = { .name = "ISCONTAINER", .title = "CONT ", .description = "Whether the process is running inside a child container", .flags = PROCESS_FLAG_LINUX_CONTAINER, }, #ifdef SCHEDULER_SUPPORT [SCHEDULERPOLICY] = { .name = "SCHEDULERPOLICY", .title = "SCHED ", .description = "Current scheduling policy of the process", .flags = PROCESS_FLAG_SCHEDPOL, }, #endif @@ -336,6 +337,19 @@ static void LinuxProcess_rowWriteField(const Row* super, RichString* str, Proces xSnprintf(buffer, n, "N/A "); } break; + case ISCONTAINER: + switch (this->isRunningInContainer) { + case TRI_ON: + xSnprintf(buffer, n, "YES "); + break; + case TRI_OFF: + xSnprintf(buffer, n, "NO "); + break; + default: + attr = CRT_colors[PROCESS_SHADOW]; + xSnprintf(buffer, n, "N/A "); + } + break; default: Process_writeField(this, str, field); return; @@ -438,6 +452,8 @@ static int LinuxProcess_compareByKey(const Process* v1, const Process* v2, Proce } case GPU_TIME: return SPACESHIP_NUMBER(p1->gpu_time, p2->gpu_time); + case ISCONTAINER: + return SPACESHIP_NUMBER(v1->isRunningInContainer, v2->isRunningInContainer); default: return Process_compareByKey_Base(v1, v2, key); } -- cgit v1.2.3