miscellaneous top and library cleanup
top changes . refined column header width calculations . added error messages for: invalid signal ('k') invalad max tasks ('n') . corrected narrative for summary_show library changes . corrected some comments (only)
This commit is contained in:
parent
e4c45d6984
commit
f7fb8bddf4
@ -105,7 +105,7 @@ typedef struct status_table_struct {
|
|||||||
// "Threads:\n", etc. would be lines, but no quote, no escape, etc.
|
// "Threads:\n", etc. would be lines, but no quote, no escape, etc.
|
||||||
//
|
//
|
||||||
// After a pipe through gperf, insert the resulting 'asso_values'
|
// After a pipe through gperf, insert the resulting 'asso_values'
|
||||||
// into our 'assoc' array. Then convert the gperf 'wordlist' array
|
// into our 'asso' array. Then convert the gperf 'wordlist' array
|
||||||
// into our 'table' array by wrapping the string literals within
|
// into our 'table' array by wrapping the string literals within
|
||||||
// the F macro and replacing empty strings with the NUL define.
|
// the F macro and replacing empty strings with the NUL define.
|
||||||
//
|
//
|
||||||
|
@ -255,8 +255,8 @@ extern proc_t * get_proc_stats(pid_t pid, proc_t *p);
|
|||||||
#define PROC_FILLENV 0x0004 // alloc and fill in `environ'
|
#define PROC_FILLENV 0x0004 // alloc and fill in `environ'
|
||||||
#define PROC_FILLUSR 0x0008 // resolve user id number -> user name
|
#define PROC_FILLUSR 0x0008 // resolve user id number -> user name
|
||||||
#define PROC_FILLGRP 0x0010 // resolve group id number -> group name
|
#define PROC_FILLGRP 0x0010 // resolve group id number -> group name
|
||||||
#define PROC_FILLSTATUS 0x0020 // read status -- currently unconditional
|
#define PROC_FILLSTATUS 0x0020 // read status
|
||||||
#define PROC_FILLSTAT 0x0040 // read stat -- currently unconditional
|
#define PROC_FILLSTAT 0x0040 // read stat
|
||||||
#define PROC_FILLWCHAN 0x0080 // look up WCHAN name
|
#define PROC_FILLWCHAN 0x0080 // look up WCHAN name
|
||||||
#define PROC_FILLARG 0x0100 // alloc and fill in `cmdline'
|
#define PROC_FILLARG 0x0100 // alloc and fill in `cmdline'
|
||||||
#define PROC_FILLCGROUP 0x0200 // alloc and fill in `cgroup`
|
#define PROC_FILLCGROUP 0x0200 // alloc and fill in `cgroup`
|
||||||
|
20
top.c
20
top.c
@ -1416,7 +1416,7 @@ static void calibrate_fields (void) {
|
|||||||
#endif
|
#endif
|
||||||
h = Fieldstab[f].head;
|
h = Fieldstab[f].head;
|
||||||
// oops, won't fit -- we're outta here...
|
// oops, won't fit -- we're outta here...
|
||||||
if (Screen_cols <= ((int)(s - w->columnhdr) + (int)strlen(h))) break;
|
if (Screen_cols < ((int)(s - w->columnhdr) + (int)strlen(h))) break;
|
||||||
if (!Fieldstab[f].fmts) { ++varcolcnt; w->varcolsz += strlen(h) - 1; }
|
if (!Fieldstab[f].fmts) { ++varcolcnt; w->varcolsz += strlen(h) - 1; }
|
||||||
s = scat(s, h);
|
s = scat(s, h);
|
||||||
}
|
}
|
||||||
@ -1441,7 +1441,7 @@ static void calibrate_fields (void) {
|
|||||||
if (P_MAXPFLGS < f) { w->endpflg = i; continue; }
|
if (P_MAXPFLGS < f) { w->endpflg = i; continue; }
|
||||||
#endif
|
#endif
|
||||||
h = Fieldstab[f].head;
|
h = Fieldstab[f].head;
|
||||||
if (Screen_cols <= ((int)(s - w->columnhdr) + (int)strlen(h))) break;
|
if (Screen_cols < ((int)(s - w->columnhdr) + (int)strlen(h))) break;
|
||||||
s = scat(s, h);
|
s = scat(s, h);
|
||||||
w->endpflg = i;
|
w->endpflg = i;
|
||||||
}
|
}
|
||||||
@ -2777,6 +2777,7 @@ static void keys_global (int ch) {
|
|||||||
if (0 < sig && kill(pid, sig))
|
if (0 < sig && kill(pid, sig))
|
||||||
show_msg(fmtmk("\aFailed signal pid '%d' with '%d': %s"
|
show_msg(fmtmk("\aFailed signal pid '%d' with '%d': %s"
|
||||||
, pid, sig, strerror(errno)));
|
, pid, sig, strerror(errno)));
|
||||||
|
else if (0 > sig) show_msg("Invalid signal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2834,7 +2835,10 @@ static void keys_task (int ch) {
|
|||||||
case 'n':
|
case 'n':
|
||||||
if (VIZCHKw(w)) {
|
if (VIZCHKw(w)) {
|
||||||
int num = get_int(fmtmk("Maximum tasks = %d, change to (0 is unlimited)", w->rc.maxtasks));
|
int num = get_int(fmtmk("Maximum tasks = %d, change to (0 is unlimited)", w->rc.maxtasks));
|
||||||
if (INT_MIN < num) w->rc.maxtasks = num;
|
if (INT_MIN < num) {
|
||||||
|
if (-1 < num ) w->rc.maxtasks = num;
|
||||||
|
else show_msg("Invalid maximum");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
@ -3275,12 +3279,10 @@ static void summaryhlp (CPU_t *cpu, const char *pfx) {
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Begin a new frame by:
|
* In support of a new frame:
|
||||||
* 1) Refreshing the all important proc table
|
* 1) Display uptime and load average (maybe)
|
||||||
* 2) Displaying uptime and load average (maybe)
|
* 2) Display task/cpu states (maybe)
|
||||||
* 3) Displaying task/cpu states (maybe)
|
* 3) Display memory & swap usage (maybe) */
|
||||||
* 4) Displaying memory & swap usage (maybe)
|
|
||||||
* and then, returning a pointer to the pointers to the proc_t's! */
|
|
||||||
static void summary_show (void) {
|
static void summary_show (void) {
|
||||||
#define isROOM(f,n) (CHKw(w, f) && Msg_row + (n) < Screen_rows - 1)
|
#define isROOM(f,n) (CHKw(w, f) && Msg_row + (n) < Screen_rows - 1)
|
||||||
#define anyFLG 0xffffff
|
#define anyFLG 0xffffff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user