summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-10-20 01:45:41 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-10-20 01:45:41 +0000
commit259e1a29384003c0c4ac6c84a499c0e05f789a90 (patch)
tree165e981ce705c19eee00c76d19e3df2b95232693 /Process.c
parentf44a8f2009e443349655e32512ef1dc453f3fa22 (diff)
fixes PGRP and SESN columns in case of big pids. Patch #3567904.
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/Process.c b/Process.c
index 9cc5c001..99e9f13b 100644
--- a/Process.c
+++ b/Process.c
@@ -208,7 +208,7 @@ const char *Process_fieldNames[] = {
};
const char *Process_fieldTitles[] = {
- "", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
+ "", " PID ", "Command ", "S ", " PPID ", " PGRP ", " SESN ",
" TTY ", " TPGID ", "- ", "- ", "- ", "- ", "- ",
" UTIME+ ", " STIME+ ", " CUTIME+ ", " CSTIME+ ", "PRI ", " NI ", "- ",
"START ", "- ", "- ", "- ", "- ", "- ", "- ",
@@ -245,17 +245,21 @@ void Process_getMaxPid() {
fscanf(file, "%32d", &maxPid);
fclose(file);
if (maxPid > 99999) {
- Process_fieldTitles[PID] = " PID ";
- Process_fieldTitles[PPID] = " PPID ";
- Process_fieldTitles[TPGID] = " TPGID ";
- Process_fieldTitles[TGID] = " TGID ";
+ Process_fieldTitles[PID] = " PID ";
+ Process_fieldTitles[PPID] = " PPID ";
+ Process_fieldTitles[TPGID] = " TPGID ";
+ Process_fieldTitles[TGID] = " TGID ";
+ Process_fieldTitles[PGRP] = " PGRP ";
+ Process_fieldTitles[SESSION] = " SESN ";
Process_pidFormat = "%7u ";
Process_tpgidFormat = "%7d ";
} else {
- Process_fieldTitles[PID] = " PID ";
- Process_fieldTitles[PPID] = " PPID ";
- Process_fieldTitles[TPGID] = "TPGID ";
- Process_fieldTitles[TGID] = " TGID ";
+ Process_fieldTitles[PID] = " PID ";
+ Process_fieldTitles[PPID] = " PPID ";
+ Process_fieldTitles[TPGID] = "TPGID ";
+ Process_fieldTitles[TGID] = " TGID ";
+ Process_fieldTitles[PGRP] = " PGRP ";
+ Process_fieldTitles[SESSION] = " SESN ";
Process_pidFormat = "%5u ";
Process_tpgidFormat = "%5d ";
}
@@ -381,8 +385,8 @@ static void Process_writeField(Process* this, RichString* str, ProcessField fiel
switch (field) {
case PID: snprintf(buffer, n, Process_pidFormat, this->pid); break;
case PPID: snprintf(buffer, n, Process_pidFormat, this->ppid); break;
- case PGRP: snprintf(buffer, n, "%5u ", this->pgrp); break;
- case SESSION: snprintf(buffer, n, "%5u ", this->session); break;
+ case PGRP: snprintf(buffer, n, Process_pidFormat, this->pgrp); break;
+ case SESSION: snprintf(buffer, n, Process_pidFormat, this->session); break;
case TTY_NR: snprintf(buffer, n, "%5u ", this->tty_nr); break;
case TGID: snprintf(buffer, n, Process_pidFormat, this->tgid); break;
case TPGID: snprintf(buffer, n, Process_tpgidFormat, this->tpgid); break;

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