fixes PGRP and SESN columns in case of big pids. Patch #3567904.

This commit is contained in:
Hisham Muhammad 2012-10-20 01:45:41 +00:00
parent f44a8f2009
commit 259e1a2938
1 changed files with 15 additions and 11 deletions

View File

@ -249,6 +249,8 @@ void Process_getMaxPid() {
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 {
@ -256,6 +258,8 @@ void Process_getMaxPid() {
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;