From 9f68c8d34142746a16ea3883d736a0955977e625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 15 Dec 2020 19:44:52 +0100 Subject: Merge Process_pidColumns into Process_fields and rework auto-fit for PID-like columns --- unsupported/Platform.c | 4 ---- unsupported/Platform.h | 4 ---- unsupported/UnsupportedProcess.c | 14 +++++++------- unsupported/UnsupportedProcess.h | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) (limited to 'unsupported') diff --git a/unsupported/Platform.c b/unsupported/Platform.c index 75b00502..b435e186 100644 --- a/unsupported/Platform.c +++ b/unsupported/Platform.c @@ -59,10 +59,6 @@ const MeterClass* const Platform_meterTypes[] = { NULL }; -ProcessPidColumn Process_pidColumns[] = { - { .id = 0, .label = NULL }, -}; - void Platform_init(void) { /* no platform-specific setup needed */ } diff --git a/unsupported/Platform.h b/unsupported/Platform.h index 7ba5f063..5f777381 100644 --- a/unsupported/Platform.h +++ b/unsupported/Platform.h @@ -23,10 +23,6 @@ extern ProcessField Platform_defaultFields[]; extern const MeterClass* const Platform_meterTypes[]; -extern char Process_pidFormat[20]; - -extern ProcessPidColumn Process_pidColumns[]; - void Platform_init(void); void Platform_done(void); diff --git a/unsupported/UnsupportedProcess.c b/unsupported/UnsupportedProcess.c index 153f86f6..eb52910b 100644 --- a/unsupported/UnsupportedProcess.c +++ b/unsupported/UnsupportedProcess.c @@ -9,16 +9,16 @@ in the source distribution for its full text. #include "UnsupportedProcess.h" #include -ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { +const ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, }, - [PID] = { .name = "PID", .title = " PID ", .description = "Process/thread ID", .flags = 0, }, + [PID] = { .name = "PID", .title = "PID", .description = "Process/thread ID", .flags = 0, .pidColumn = true, }, [COMM] = { .name = "Command", .title = "Command ", .description = "Command line", .flags = 0, }, [STATE] = { .name = "STATE", .title = "S ", .description = "Process state (S sleeping, R running, D disk, Z zombie, T traced, W paging)", .flags = 0, }, - [PPID] = { .name = "PPID", .title = " PPID ", .description = "Parent process ID", .flags = 0, }, - [PGRP] = { .name = "PGRP", .title = " PGRP ", .description = "Process group ID", .flags = 0, }, - [SESSION] = { .name = "SESSION", .title = " SID ", .description = "Process's session ID", .flags = 0, }, + [PPID] = { .name = "PPID", .title = "PPID", .description = "Parent process ID", .flags = 0, .pidColumn = true, }, + [PGRP] = { .name = "PGRP", .title = "PGRP", .description = "Process group ID", .flags = 0, .pidColumn = true, }, + [SESSION] = { .name = "SESSION", .title = "SID", .description = "Process's session ID", .flags = 0, .pidColumn = true, }, [TTY_NR] = { .name = "TTY_NR", .title = " TTY ", .description = "Controlling terminal", .flags = 0, }, - [TPGID] = { .name = "TPGID", .title = " TPGID ", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, }, + [TPGID] = { .name = "TPGID", .title = "TPGID", .description = "Process ID of the fg process group of the controlling terminal", .flags = 0, .pidColumn = true, }, [MINFLT] = { .name = "MINFLT", .title = " MINFLT ", .description = "Number of minor faults which have not required loading a memory page from disk", .flags = 0, }, [MAJFLT] = { .name = "MAJFLT", .title = " MAJFLT ", .description = "Number of major faults which have required loading a memory page from disk", .flags = 0, }, [PRIORITY] = { .name = "PRIORITY", .title = "PRI ", .description = "Kernel's internal priority for the process", .flags = 0, }, @@ -34,7 +34,7 @@ ProcessFieldData Process_fields[LAST_PROCESSFIELD] = { [USER] = { .name = "USER", .title = "USER ", .description = "Username of the process owner (or user ID if name cannot be determined)", .flags = 0, }, [TIME] = { .name = "TIME", .title = " TIME+ ", .description = "Total time the process has spent in user and system time", .flags = 0, }, [NLWP] = { .name = "NLWP", .title = "NLWP ", .description = "Number of threads in the process", .flags = 0, }, - [TGID] = { .name = "TGID", .title = " TGID ", .description = "Thread group ID (i.e. process ID)", .flags = 0, }, + [TGID] = { .name = "TGID", .title = "TGID", .description = "Thread group ID (i.e. process ID)", .flags = 0, .pidColumn = true, }, }; Process* UnsupportedProcess_new(Settings* settings) { diff --git a/unsupported/UnsupportedProcess.h b/unsupported/UnsupportedProcess.h index a9be326e..e1812f16 100644 --- a/unsupported/UnsupportedProcess.h +++ b/unsupported/UnsupportedProcess.h @@ -11,7 +11,7 @@ in the source distribution for its full text. #define Process_delete UnsupportedProcess_delete -extern ProcessFieldData Process_fields[LAST_PROCESSFIELD]; +extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD]; Process* UnsupportedProcess_new(Settings* settings); -- cgit v1.2.3