procps-3.2.7 --> procps-3.2.8
+ps: allow "+" in sort specifications, as in man page rh208217
ps: document SCHED_BATCH and add "see also" for stime
ps: man page less ambiguous
-top: normal exit code should be 0 #341272 #354255
+top: normal exit code should be 0 #341272 #354255 rh199174
pgrep: usage error should exit with 2 #413383
vmstat: use EXIT_FAILURE -- thanks Yoshio Nakamura #425492
sysctl: fix crash -- thanks Steinar Gunderson #423704
#define VMINFO_FILE "/proc/vmstat"
static int vminfo_fd = -1;
-static char buf[1024];
+// As of 2.6.24 /proc/meminfo seems to need 888 on 64-bit,
+// and would need 1258 if the obsolete fields were there.
+static char buf[2048];
/* This macro opens filename only if necessary and seeks to 0 so
* that successive calls to the functions are more efficient.
static unsigned long kb_vmalloc_chunk;
static unsigned long kb_vmalloc_total;
static unsigned long kb_vmalloc_used;
+// seen on 2.6.24-rc6-git12
+static unsigned long kb_anon_pages;
+static unsigned long kb_bounce;
+static unsigned long kb_commit_limit;
+static unsigned long kb_nfs_unstable;
+static unsigned long kb_swap_reclaimable;
+static unsigned long kb_swap_unreclaimable;
void meminfo(void){
char namebuf[16]; /* big enough to hold any row name */
char *tail;
static const mem_table_struct mem_table[] = {
{"Active", &kb_active}, // important
+ {"AnonPages", &kb_anon_pages},
+ {"Bounce", &kb_bounce},
{"Buffers", &kb_main_buffers}, // important
{"Cached", &kb_main_cached}, // important
+ {"CommitLimit", &kb_commit_limit},
{"Committed_AS", &kb_committed_as},
{"Dirty", &kb_dirty}, // kB version of vmstat nr_dirty
{"HighFree", &kb_high_free},
{"MemFree", &kb_main_free}, // important
{"MemShared", &kb_main_shared}, // important, but now gone!
{"MemTotal", &kb_main_total}, // important
+ {"NFS_Unstable", &kb_nfs_unstable},
{"PageTables", &kb_pagetables}, // kB version of vmstat nr_page_table_pages
{"ReverseMaps", &nr_reversemaps}, // same as vmstat nr_page_table_pages
+ {"SReclaimable", &kb_swap_reclaimable}, // "swap reclaimable" (dentry and inode structures)
+ {"SUnreclaim", &kb_swap_unreclaimable},
{"Slab", &kb_slab}, // kB version of vmstat nr_slab
{"SwapCached", &kb_swap_cached},
{"SwapFree", &kb_swap_free}, // important
case 3: return snprintf(outbuf, COLWID, "B"); // SCHED_BATCH
case 4: return snprintf(outbuf, COLWID, "#4"); // SCHED_ISO? (Con Kolivas)
case 5: return snprintf(outbuf, COLWID, "#5"); // SCHED_IDLEPRIO? (Con Kolivas)
- case 8: return snprintf(outbuf, COLWID, "#6"); //
- case 8: return snprintf(outbuf, COLWID, "#7"); //
+ case 6: return snprintf(outbuf, COLWID, "#6"); //
+ case 7: return snprintf(outbuf, COLWID, "#7"); //
case 8: return snprintf(outbuf, COLWID, "#8"); //
- case 8: return snprintf(outbuf, COLWID, "#9"); //
+ case 9: return snprintf(outbuf, COLWID, "#9"); //
default: return snprintf(outbuf, COLWID, "?"); // unknown value
}
}
}
#endif
+// This one is always thread-specific pending. (from Dragonfly BSD)
+static int pr_tsig(char *restrict const outbuf, const proc_t *restrict const pp){
+ return help_pr_sig(outbuf, pp->_sigpnd);
+}
+// This one is (wrongly?) thread-specific when printing thread lines,
+// but process-pending otherwise.
static int pr_sig(char *restrict const outbuf, const proc_t *restrict const pp){
return help_pr_sig(outbuf, pp->signal);
}
{"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER},
{"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, ET|RIGHT},
{"group", "GROUP", pr_egroup, sr_egroup, 8, GRP, U98, ET|USER},
-{"iac", "IAC", pr_nop, sr_nop, 4, 0, BSD, AN|RIGHT}, // DragonFly
{"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigignore*/
{"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*inblock*/
{"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*inblk*/
{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT},
{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PO|PIDMAX|RIGHT},
{"tsid", "TSID", pr_nop, sr_nop, 5, 0, BSD, PO|PIDMAX|RIGHT},
+{"tsig", "PENDING", pr_tsig, sr_nop, 9, 0, BSD, ET|SIGNAL},
{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, PO|RIGHT},
{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, PO|LEFT},
{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
trace("x Select processes without controlling ttys\n");
simple_select |= SS_B_x;
break;
-#if 0
- case 'y':
- // DragonFlyBSD iac (interactivity measure) format
- // uid,pid,ppid,cpu,pri,iac,nice,wchan,state,tt,time,command
- // (they use 'Y' to sort by this "iac" thing; 'y' implies 'Y')
- // Range is -127 .. 127, with lower numbers being more
- // interactive and higher numbers more batch-like.
- trace("y Display interactivity measure\n");
- format_flags |= FF_Bv;
- break;
-#endif
case '-':
return "Embedded '-' among BSD options makes no sense.";
break;
if(*spec == '-'){
reverse = 1;
spec++;
+ } else if(*spec == '+'){
+ spec++;
}
fs = search_format_array(spec);
if(fs){
* Normal end of execution.
* catches:
* SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */
+// FIXME: can't do this shit in a signal handler
static void end_pgm (int sig) NORETURN;
static void end_pgm (int sig)
{
* Suspend ourself.
* catches:
* SIGTSTP, SIGTTIN and SIGTTOU */
+// FIXME: can't do this shit in a signal handler!
static void suspend (int dont_care_sig)
{
(void)dont_care_sig;
putp(Cap_rmam);
}
-\f
+
/*###### Misc Color/Display support ####################################*/
/* macro to test if a basic (non-color) capability is valid
*sub_end = '\0';
snprintf(tmp, sizeof(tmp), "%s%.*s%s", cap, room, sub_beg, Caps_off);
amt = strlen(tmp);
- if(rp - tmp + amt + 1 > sizeof tmp)
+ if(rp - row + amt + 1 > sizeof row)
goto overflow; // shit happens
rp = scat(rp, tmp);
room -= (sub_end - sub_beg);