aboutsummaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 1ce6b76..c4c759d 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -105,13 +105,19 @@ static const char* alignedProcessFieldTitle(const ProcessList* this, ProcessFiel
if (!title)
return "- ";
- if (!Process_fields[field].pidColumn)
- return title;
+ if (Process_fields[field].pidColumn) {
+ static char titleBuffer[PROCESS_MAX_PID_DIGITS + sizeof(" ")];
+ xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_pidDigits, title);
+ return titleBuffer;
+ }
- static char titleBuffer[PROCESS_MAX_PID_DIGITS + /* space */ 1 + /* null-terminator */ + 1];
- xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_pidDigits, title);
+ if (field == ST_UID) {
+ static char titleBuffer[PROCESS_MAX_UID_DIGITS + sizeof(" ")];
+ xSnprintf(titleBuffer, sizeof(titleBuffer), "%*s ", Process_uidDigits, title);
+ return titleBuffer;
+ }
- return titleBuffer;
+ return title;
}
void ProcessList_printHeader(const ProcessList* this, RichString* header) {
@@ -626,10 +632,15 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
ProcessList_goThroughEntries(this, false);
+ uid_t maxUid = 0;
for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
Process* p = (Process*) Vector_get(this->processes, i);
Process_makeCommandStr(p);
+ // keep track of the highest UID for column scaling
+ if (p->st_uid > maxUid)
+ maxUid = p->st_uid;
+
if (p->tombStampMs > 0) {
// remove tombed process
if (this->monotonicMs >= p->tombStampMs) {
@@ -647,6 +658,9 @@ void ProcessList_scan(ProcessList* this, bool pauseProcessUpdate) {
}
}
+ // Set UID column width based on max UID.
+ Process_setUidColumnWidth(maxUid);
+
if (this->settings->treeView) {
// Clear out the hashtable to avoid any left-over processes from previous build
//

© 2014-2024 Faster IT GmbH | imprint | privacy policy