ps: avoid -o stat to contain spaces. Closes 9631

function                                             old     new   delta
procps_scan                                         1227    1236      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2017-02-02 13:04:30 +01:00
parent b1d6a2c624
commit b6871c1965

View File

@ -370,6 +370,7 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
| PSSCAN_TTY | PSSCAN_NICE | PSSCAN_TTY | PSSCAN_NICE
| PSSCAN_CPU) | PSSCAN_CPU)
) { ) {
int s_idx;
char *cp, *comm1; char *cp, *comm1;
int tty; int tty;
#if !ENABLE_FEATURE_FAST_TOP #if !ENABLE_FEATURE_FAST_TOP
@ -468,17 +469,20 @@ procps_status_t* FAST_FUNC procps_scan(procps_status_t* sp, int flags)
#if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS #if ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS
sp->niceness = tasknice; sp->niceness = tasknice;
#endif #endif
sp->state[1] = ' ';
if (sp->vsz == 0 && sp->state[0] != 'Z') sp->state[2] = ' ';
s_idx = 1;
if (sp->vsz == 0 && sp->state[0] != 'Z') {
/* not sure what the purpose of this flag */
sp->state[1] = 'W'; sp->state[1] = 'W';
else s_idx = 2;
sp->state[1] = ' '; }
if (tasknice < 0) if (tasknice != 0) {
sp->state[2] = '<'; if (tasknice < 0)
else if (tasknice) /* > 0 */ sp->state[s_idx] = '<';
sp->state[2] = 'N'; else /* > 0 */
else sp->state[s_idx] = 'N';
sp->state[2] = ' '; }
} }
#if ENABLE_FEATURE_TOPMEM #if ENABLE_FEATURE_TOPMEM