| diff -Naur a/top.c b/top.c |
| --- a/top.c 2007-05-28 09:04:00.000000000 -0700 |
| +++ b/top.c 2014-09-04 13:24:59.862877761 -0700 |
| @@ -184,19 +184,19 @@ |
| * 2 columns each. |
| */ |
| |
| -SCB_NUMx(P_PID, XXXID) |
| -SCB_NUMx(P_PPD, ppid) |
| -SCB_STRx(P_URR, ruser) |
| -SCB_NUMx(P_UID, euid) |
| -SCB_STRx(P_URE, euser) |
| -SCB_STRx(P_GRP, egroup) |
| -SCB_NUMx(P_TTY, tty) |
| -SCB_NUMx(P_PRI, priority) |
| -SCB_NUMx(P_NCE, nice) |
| -SCB_NUMx(P_CPN, processor) |
| -SCB_NUM1(P_CPU, pcpu) |
| - // also serves P_TM2 ! |
| -static int sort_P_TME (const proc_t **P, const proc_t **Q) |
| +SCB_NUMx(EU_PID, XXXID) |
| +SCB_NUMx(EU_PPD, ppid) |
| +SCB_STRx(EU_URR, ruser) |
| +SCB_NUMx(EU_UID, euid) |
| +SCB_STRx(EU_URE, euser) |
| +SCB_STRx(EU_GRP, egroup) |
| +SCB_NUMx(EU_TTY, tty) |
| +SCB_NUMx(EU_PRI, priority) |
| +SCB_NUMx(EU_NCE, nice) |
| +SCB_NUMx(EU_CPN, processor) |
| +SCB_NUM1(EU_CPU, pcpu) |
| + // also serves EU_TM2 ! |
| +static int sort_EU_TME (const proc_t **P, const proc_t **Q) |
| { |
| if (Frame_ctimes) { |
| if ( ((*P)->cutime + (*P)->cstime + (*P)->utime + (*P)->stime) |
| @@ -214,17 +214,17 @@ |
| return SORT_eq; |
| } |
| |
| -SCB_NUM1(P_VRT, size) |
| -SCB_NUM2(P_SWP, size, resident) |
| -SCB_NUM1(P_RES, resident) // also serves P_MEM ! |
| -SCB_NUM1(P_COD, trs) |
| -SCB_NUM1(P_DAT, drs) |
| -SCB_NUM1(P_SHR, share) |
| -SCB_NUM1(P_FLT, maj_flt) |
| -SCB_NUM1(P_DRT, dt) |
| -SCB_NUMx(P_STA, state) |
| +SCB_NUM1(EU_VRT, size) |
| +SCB_NUM2(EU_SWP, size, resident) |
| +SCB_NUM1(EU_RES, resident) // also serves EU_MEM ! |
| +SCB_NUM1(EU_COD, trs) |
| +SCB_NUM1(EU_DAT, drs) |
| +SCB_NUM1(EU_SHR, share) |
| +SCB_NUM1(EU_FLT, maj_flt) |
| +SCB_NUM1(EU_DRT, dt) |
| +SCB_NUMx(EU_STA, state) |
| |
| -static int sort_P_CMD (const proc_t **P, const proc_t **Q) |
| +static int sort_EU_CMD (const proc_t **P, const proc_t **Q) |
| { |
| /* if a process doesn't have a cmdline, we'll consider it a kernel thread |
| -- since displayed tasks are given special treatment, we must too */ |
| @@ -238,8 +238,8 @@ |
| return Frame_srtflg * strcmp((*Q)->cmd, (*P)->cmd); |
| } |
| |
| -SCB_NUM1(P_WCH, wchan) |
| -SCB_NUM1(P_FLG, flags) |
| +SCB_NUM1(EU_WCH, wchan) |
| +SCB_NUM1(EU_FLG, flags) |
| |
| /* ///////////////////////////////// special sort for prochlp() ! */ |
| static int sort_HST_t (const HST_t *P, const HST_t *Q) |
| @@ -562,7 +562,7 @@ |
| |
| // Show an error, but not right now. |
| // Due to the postponed opening of ksym, using open_psdb_message, |
| -// if P_WCH had been selected and the program is restarted, the |
| +// if EU_WCH had been selected and the program is restarted, the |
| // message would otherwise be displayed prematurely. |
| static void msg_save (const char *fmts, ...) __attribute__((format(printf,1,2))); |
| static void msg_save (const char *fmts, ...) |
| @@ -1213,7 +1213,7 @@ |
| #define L_DEFAULT PROC_FILLSTAT |
| |
| // a temporary macro, soon to be undef'd... |
| -#define SF(f) (QFP_t)sort_P_ ## f |
| +#define SF(f) (QFP_t)sort_EU_ ## f |
| |
| /* These are our gosh darn 'Fields' ! |
| They MUST be kept in sync with pflags !! |
| @@ -1222,9 +1222,9 @@ |
| a cast when/if displayed provides minimal width protection. */ |
| static FLD_t Fieldstab[] = { |
| /* .lflg anomolies: |
| - P_UID, L_NONE - natural outgrowth of 'stat()' in readproc (euid) |
| - P_CPU, L_stat - never filled by libproc, but requires times (pcpu) |
| - P_CMD, L_stat - may yet require L_CMDLINE in reframewins (cmd/cmdline) |
| + EU_UID, L_NONE - natural outgrowth of 'stat()' in readproc (euid) |
| + EU_CPU, L_stat - never filled by libproc, but requires times (pcpu) |
| + EU_CMD, L_stat - may yet require L_CMDLINE in reframewins (cmd/cmdline) |
| L_EITHER - must L_status, else 64-bit math, __udivdi3 on 32-bit ! |
| keys head fmts width scale sort desc lflg |
| ------ ----------- ------- ------ ----- ----- ---------------------- -------- */ |
| @@ -1514,23 +1514,23 @@ |
| |
| case 'M': |
| c = 0; // for scoreboard |
| - rc->win[0].sortindx = P_MEM; |
| + rc->win[0].sortindx = EU_MEM; |
| break; |
| case 'P': |
| c = 0; // for scoreboard |
| - rc->win[0].sortindx = P_CPU; |
| + rc->win[0].sortindx = EU_CPU; |
| break; |
| case 'A': // supposed to be start_time |
| c = 0; // for scoreboard |
| - rc->win[0].sortindx = P_PID; |
| + rc->win[0].sortindx = EU_PID; |
| break; |
| case 'T': |
| c = 0; // for scoreboard |
| - rc->win[0].sortindx = P_TM2; |
| + rc->win[0].sortindx = EU_TM2; |
| break; |
| case 'N': |
| c = 0; // for scoreboard |
| - rc->win[0].sortindx = P_PID; |
| + rc->win[0].sortindx = EU_PID; |
| break; |
| |
| default: |
| @@ -1626,19 +1626,19 @@ |
| |
| pcpu_max_value = 99.9; |
| |
| - Fieldstab[P_CPN].head = " P"; |
| - Fieldstab[P_CPN].fmts = " %1u"; |
| + Fieldstab[EU_CPN].head = " P"; |
| + Fieldstab[EU_CPN].fmts = " %1u"; |
| if(smp_num_cpus>9){ |
| - Fieldstab[P_CPN].head = " P"; |
| - Fieldstab[P_CPN].fmts = " %2u"; |
| + Fieldstab[EU_CPN].head = " P"; |
| + Fieldstab[EU_CPN].fmts = " %2u"; |
| } |
| if(smp_num_cpus>99){ |
| - Fieldstab[P_CPN].head = " P"; |
| - Fieldstab[P_CPN].fmts = " %3u"; |
| + Fieldstab[EU_CPN].head = " P"; |
| + Fieldstab[EU_CPN].fmts = " %3u"; |
| } |
| if(smp_num_cpus>999){ |
| - Fieldstab[P_CPN].head = " P"; |
| - Fieldstab[P_CPN].fmts = " %4u"; |
| + Fieldstab[EU_CPN].head = " P"; |
| + Fieldstab[EU_CPN].fmts = " %4u"; |
| } |
| |
| { |
| @@ -1646,10 +1646,10 @@ |
| unsigned pid_digits = get_pid_digits(); |
| if(pid_digits<4) pid_digits=4; |
| snprintf(pid_fmt, sizeof pid_fmt, " %%%uu", pid_digits); |
| - Fieldstab[P_PID].fmts = pid_fmt; |
| - Fieldstab[P_PID].head = " PID" + 10 - pid_digits; |
| - Fieldstab[P_PPD].fmts = pid_fmt; |
| - Fieldstab[P_PPD].head = " PPID" + 10 - pid_digits; |
| + Fieldstab[EU_PID].fmts = pid_fmt; |
| + Fieldstab[EU_PID].head = " PID" + 10 - pid_digits; |
| + Fieldstab[EU_PPD].fmts = pid_fmt; |
| + Fieldstab[EU_PPD].head = " PPID" + 10 - pid_digits; |
| } |
| } |
| |
| @@ -1786,7 +1786,7 @@ |
| if(Rc.mode_irixps && smp_num_cpus>1){ |
| // good for 100 CPUs per process |
| pcpu_max_value = 9999.0; |
| - Fieldstab[P_CPU].fmts = " %4.0f"; |
| + Fieldstab[EU_CPU].fmts = " %4.0f"; |
| } |
| |
| // lastly, establish the true runtime secure mode and delay time |
| @@ -2135,13 +2135,13 @@ |
| } |
| |
| // establish the final maxpflgs and prepare to grow the command column |
| - // heading via maxcmdln - it may be a fib if P_CMD wasn't encountered, |
| + // heading via maxcmdln - it may be a fib if EU_CMD wasn't encountered, |
| // but that's ok because it won't be displayed anyway |
| w->maxpflgs = i; |
| - w->maxcmdln = Screen_cols - (strlen(w->columnhdr) - strlen(Fieldstab[P_CMD].head)); |
| + w->maxcmdln = Screen_cols - (strlen(w->columnhdr) - strlen(Fieldstab[EU_CMD].head)); |
| |
| // finally, we can build the true run-time columns header, format the |
| - // command column heading, if P_CMD is really being displayed, and |
| + // command column heading, if EU_CMD is really being displayed, and |
| // rebuild the all-important PROC_FILLxxx flags that will be used |
| // until/if we're we're called again |
| *(s = w->columnhdr) = '\0'; |
| @@ -2149,9 +2149,9 @@ |
| for (i = 0; i < w->maxpflgs; i++) { |
| int advance = (i==0) && !Rc.mode_altscr; |
| h = Fieldstab[w->procflags[i]].head; |
| - if (P_WCH == w->procflags[i]) needpsdb = 1; |
| - if (P_CMD == w->procflags[i]) { |
| - s = scat(s, fmtmk(Fieldstab[P_CMD].fmts+advance, w->maxcmdln, w->maxcmdln, "COMMAND"/*h*/ )); |
| + if (EU_WCH == w->procflags[i]) needpsdb = 1; |
| + if (EU_CMD == w->procflags[i]) { |
| + s = scat(s, fmtmk(Fieldstab[EU_CMD].fmts+advance, w->maxcmdln, w->maxcmdln, "COMMAND"/*h*/ )); |
| if (CHKw(w, Show_CMDLIN)) { |
| Frames_libflags |= L_CMDLINE; |
| // if (w->maxcmdln > Frames_maxcmdln) Frames_maxcmdln = w->maxcmdln; |
| @@ -2629,10 +2629,10 @@ |
| if(Rc.mode_irixps && smp_num_cpus>1){ |
| // good for 100 CPUs per process |
| pcpu_max_value = 9999.0; |
| - Fieldstab[P_CPU].fmts = " %4.0f"; |
| + Fieldstab[EU_CPU].fmts = " %4.0f"; |
| } else { |
| pcpu_max_value = 99.9; |
| - Fieldstab[P_CPU].fmts = " %#4.1f"; |
| + Fieldstab[EU_CPU].fmts = " %#4.1f"; |
| } |
| break; |
| |
| @@ -2836,8 +2836,8 @@ |
| const unsigned xkey; |
| const FLG_t sort; |
| } xtab[] = { |
| - { "Memory", 'M', P_MEM, }, { "Numerical", 'N', P_PID, }, |
| - { "CPU", 'P', P_CPU, }, { "Time", 'T', P_TM2 }, }; |
| + { "Memory", 'M', EU_MEM, }, { "Numerical", 'N', EU_PID, }, |
| + { "CPU", 'P', EU_CPU, }, { "Time", 'T', EU_TM2 }, }; |
| int i; |
| for (i = 0; i < MAXTBL(xtab); ++i) |
| if (c == xtab[i].xkey) { |
| @@ -3063,7 +3063,7 @@ |
| int advance = (x==0) && !Rc.mode_altscr; |
| |
| switch (i) { |
| - case P_CMD: |
| + case EU_CMD: |
| { char tmp[ROWBUFSIZ]; |
| unsigned flags; |
| int maxcmd = q->maxcmdln; |
| @@ -3073,25 +3073,25 @@ |
| MKCOL(q->maxcmdln, q->maxcmdln, tmp); |
| } |
| break; |
| - case P_COD: |
| + case EU_COD: |
| MKCOL(scale_num(PAGES_TO_KB(p->trs), w, s)); |
| break; |
| - case P_CPN: |
| + case EU_CPN: |
| MKCOL((unsigned)p->processor); |
| break; |
| - case P_CPU: |
| + case EU_CPU: |
| { float u = (float)p->pcpu * Frame_tscale; |
| if (u > pcpu_max_value) u = pcpu_max_value; |
| MKCOL(u); |
| } |
| break; |
| - case P_DAT: |
| + case EU_DAT: |
| MKCOL(scale_num(PAGES_TO_KB(p->drs), w, s)); |
| break; |
| - case P_DRT: |
| + case EU_DRT: |
| MKCOL(scale_num((unsigned)p->dt, w, s)); |
| break; |
| - case P_FLG: |
| + case EU_FLG: |
| { char tmp[TNYBUFSIZ]; |
| snprintf(tmp, sizeof(tmp), f, (long)p->flags); |
| for (j = 0; tmp[j]; j++) if ('0' == tmp[j]) tmp[j] = '.'; |
| @@ -3099,70 +3099,70 @@ |
| MKCOL(""); |
| } |
| break; |
| - case P_FLT: |
| + case EU_FLT: |
| MKCOL(scale_num(p->maj_flt, w, s)); |
| break; |
| - case P_GRP: |
| + case EU_GRP: |
| MKCOL(p->egroup); |
| break; |
| - case P_MEM: |
| + case EU_MEM: |
| MKCOL((float)PAGES_TO_KB(p->resident) * 100 / kb_main_total); |
| break; |
| - case P_NCE: |
| + case EU_NCE: |
| MKCOL((int)p->nice); |
| break; |
| - case P_PID: |
| + case EU_PID: |
| MKCOL((unsigned)p->XXXID); |
| break; |
| - case P_PPD: |
| + case EU_PPD: |
| MKCOL((unsigned)p->ppid); |
| break; |
| - case P_PRI: |
| + case EU_PRI: |
| if (unlikely(-99 > p->priority) || unlikely(999 < p->priority)) { |
| f = " RT"; |
| MKCOL(""); |
| } else |
| MKCOL((int)p->priority); |
| break; |
| - case P_RES: |
| + case EU_RES: |
| MKCOL(scale_num(PAGES_TO_KB(p->resident), w, s)); |
| break; |
| - case P_SHR: |
| + case EU_SHR: |
| MKCOL(scale_num(PAGES_TO_KB(p->share), w, s)); |
| break; |
| - case P_STA: |
| + case EU_STA: |
| MKCOL(p->state); |
| break; |
| - case P_SWP: |
| + case EU_SWP: |
| MKCOL(scale_num(PAGES_TO_KB(p->size - p->resident), w, s)); |
| break; |
| - case P_TME: |
| - case P_TM2: |
| + case EU_TME: |
| + case EU_TM2: |
| { TIC_t t = p->utime + p->stime; |
| if (CHKw(q, Show_CTIMES)) |
| t += (p->cutime + p->cstime); |
| MKCOL(scale_tics(t, w)); |
| } |
| break; |
| - case P_TTY: |
| + case EU_TTY: |
| { char tmp[TNYBUFSIZ]; |
| dev_to_tty(tmp, (int)w, p->tty, p->XXXID, ABBREV_DEV); |
| MKCOL(tmp); |
| } |
| break; |
| - case P_UID: |
| + case EU_UID: |
| MKCOL((unsigned)p->euid); |
| break; |
| - case P_URE: |
| + case EU_URE: |
| MKCOL(p->euser); |
| break; |
| - case P_URR: |
| + case EU_URR: |
| MKCOL(p->ruser); |
| break; |
| - case P_VRT: |
| + case EU_VRT: |
| MKCOL(scale_num(PAGES_TO_KB(p->size), w, s)); |
| break; |
| - case P_WCH: |
| + case EU_WCH: |
| if (No_ksyms) { |
| f = " %08lx "; |
| MKCOL((long)p->wchan); |
| diff -Naur a/top.h b/top.h |
| --- a/top.h 2006-06-24 23:41:48.000000000 -0700 |
| +++ b/top.h 2014-09-04 13:14:40.124239420 -0700 |
| @@ -245,12 +245,12 @@ |
| |
| // Flags for each possible field |
| enum pflag { |
| - P_PID, P_PPD, P_URR, P_UID, P_URE, P_GRP, P_TTY, |
| - P_PRI, P_NCE, |
| - P_CPN, P_CPU, P_TME, P_TM2, |
| - P_MEM, P_VRT, P_SWP, P_RES, P_COD, P_DAT, P_SHR, |
| - P_FLT, P_DRT, |
| - P_STA, P_CMD, P_WCH, P_FLG |
| + EU_PID, EU_PPD, EU_URR, EU_UID, EU_URE, EU_GRP, EU_TTY, |
| + EU_PRI, EU_NCE, |
| + EU_CPN, EU_CPU, EU_TME, EU_TM2, |
| + EU_MEM, EU_VRT, EU_SWP, EU_RES, EU_COD, EU_DAT, EU_SHR, |
| + EU_FLT, EU_DRT, |
| + EU_STA, EU_CMD, EU_WCH, EU_FLG |
| }; |
| |
| |
| @@ -362,16 +362,16 @@ |
| // The default values for the local config file |
| #define DEF_RCFILE { \ |
| 0, 1, DEF_DELAY, 0, { \ |
| - { P_CPU, DEF_WINFLGS, 0, \ |
| + { EU_CPU, DEF_WINFLGS, 0, \ |
| COLOR_RED, COLOR_RED, COLOR_YELLOW, COLOR_RED, \ |
| "Def", DEF_FIELDS }, \ |
| - { P_PID, DEF_WINFLGS, 0, \ |
| + { EU_PID, DEF_WINFLGS, 0, \ |
| COLOR_CYAN, COLOR_CYAN, COLOR_WHITE, COLOR_CYAN, \ |
| "Job", JOB_FIELDS }, \ |
| - { P_MEM, DEF_WINFLGS, 0, \ |
| + { EU_MEM, DEF_WINFLGS, 0, \ |
| COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLUE, COLOR_MAGENTA, \ |
| "Mem", MEM_FIELDS }, \ |
| - { P_URE, DEF_WINFLGS, 0, \ |
| + { EU_URE, DEF_WINFLGS, 0, \ |
| COLOR_YELLOW, COLOR_YELLOW, COLOR_GREEN, COLOR_YELLOW, \ |
| "Usr", USR_FIELDS } \ |
| } } |