diff --git a/NEWS b/NEWS index bd10a778..625e339a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ Linux 2.2.xx ELF note warning removed only show IO-wait on recent kernels fix top's SMP stats fix top for "dumb" and "vt510" terminals +in top, limit the priority values to -99 ... 99 procps-3.0.2 --> procps-3.0.3 diff --git a/top.c b/top.c index 2d386c8b..a3ae459a 100644 --- a/top.c +++ b/top.c @@ -871,6 +871,9 @@ static proc_t **refreshprocs (proc_t **table, int flags) { #define PTRsz sizeof(proc_t *) /* eyeball candy */ #define ENTsz sizeof(proc_t) + /* quick & dirty response to 2.5.xx RT */ +#define RTx(p) { if (-99 > p->priority) p->priority = -99; \ + if (+99 < p->priority) p->priority = +99; } static unsigned savmax = 0; /* first time, Bypass: (i) */ proc_t *ptsk = (proc_t *)-1; /* first time, Force: (ii) */ unsigned curmax = 0; /* every time (jeeze) */ @@ -890,6 +893,7 @@ static proc_t **refreshprocs (proc_t **table, int flags) table[curmax]->cmdline = NULL; } if (!(ptsk = readproc(PT, table[curmax]))) break; + RTx(ptsk) ++curmax; } @@ -898,8 +902,10 @@ static proc_t **refreshprocs (proc_t **table, int flags) /* realloc as we go, keeping 'table' ahead of 'currmax++' */ table = alloc_r(table, (curmax + 1) * PTRsz); /* here, readproc will allocate the underlying proc_t stg */ - if ((ptsk = readproc(PT, NULL))) + if ((ptsk = readproc(PT, NULL))) { + RTx(ptsk) table[curmax++] = ptsk; + } } closeproc(PT); @@ -916,6 +922,7 @@ static proc_t **refreshprocs (proc_t **table, int flags) #undef PTRsz #undef ENTsz +#undef RTx } @@ -1931,10 +1938,11 @@ static void show_a_task (WIN_t *q, proc_t *task) { /* the following macro is our means to 'inline' emitting a column -- that's far and away the most frequent and costly part of top's entire job! */ -#define MKCOL(q,idx,sta,pad,buf,arg...) \ +#define MKCOL(q,idx,sta,pad,buf,arg...) do{ \ if (!b) \ snprintf(buf, sizeof(buf), f, ## arg); \ - else mkcol(q, idx, sta, pad, buf, ## arg); + else mkcol(q, idx, sta, pad, buf, ## arg); }while(0) + char rbuf[ROWBUFSIZ]; int j, x, pad;