related: change for lost 'PROCPS_' enumerator prefixes

With this patch we've completed a progression toward a
standard approach to naming conventions which follows:

* Only functions will begin with that 'procps_' prefix
. ........................................... examples
. procps_vmstat_get ()
. procps_diskstats_select ()
- ----------------------------------------------------

* Exposed structures begin with the module/header name
. ........................................... examples
. struct pids_info
. struct stat_reaped
- ----------------------------------------------------

* Item enumerators begin like structs, but capitalized
. ........................................... examples
. VMSTAT_COMPACT_FAIL
. MEMINFO_DELTA_ACTIVE

[ slabinfo varies slightly due to some item variants ]
. SLABINFO_extra
. SLABS_SIZE_ACTIVE
. SLABNODE_OBJS_PER_SLAB
[ could cure with a prefix of SLABINFO, but too long ]
- ----------------------------------------------------

* Other enumerators work exactly like item enumerators
. ........................................... examples
. PIDS_SORT_ASCEND
. STAT_REAP_CPUS_AND_NODES
- ----------------------------------------------------

* Macros and constants begin just like the enumerators
. ........................................... examples
. #define SLABINFO_GET
. #define DISKSTATS_TYPE_DISK
- ----------------------------------------------------

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2016-07-21 00:00:00 -05:00 committed by Craig Small
parent c4d097c709
commit 612f36189e
15 changed files with 599 additions and 600 deletions

48
free.c
View File

@ -364,20 +364,20 @@ int main(int argc, char **argv)
}
printf("\n");
printf("%-7s", _("Mem:"));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_FREE, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_SHARED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_USED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_FREE, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_SHARED, ul_int), flags, args));
if (flags & FREE_WIDE) {
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_BUFFERS, ul_int),
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_BUFFERS, ul_int),
flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_CACHED, ul_int)
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_CACHED, ul_int)
, flags, args));
} else {
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_BUFFERS, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_CACHED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_BUFFERS, ul_int) +
MEMINFO_GET(mem_info, MEMINFO_MEM_CACHED, ul_int), flags, args));
}
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_AVAILABLE, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEM_AVAILABLE, ul_int), flags, args));
printf("\n");
/*
* Print low vs. high information, if the user requested it.
@ -387,35 +387,35 @@ int main(int argc, char **argv)
*/
if (flags & FREE_LOHI) {
printf("%-7s", _("Low:"));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMLO_FREE, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMLO_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMLO_USED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMLO_FREE, ul_int), flags, args));
printf("\n");
printf("%-7s", _("High:"));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEMHI_FREE, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMHI_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMHI_USED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_MEMHI_FREE, ul_int), flags, args));
printf("\n");
}
printf("%-7s", _("Swap:"));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_USED, ul_int), flags, args));
printf(" %11s", scale_size(PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_FREE, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_SWAP_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_SWAP_USED, ul_int), flags, args));
printf(" %11s", scale_size(MEMINFO_GET(mem_info, MEMINFO_SWAP_FREE, ul_int), flags, args));
printf("\n");
if (flags & FREE_TOTAL) {
printf("%-7s", _("Total:"));
printf(" %11s", scale_size(
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_TOTAL, ul_int), flags, args));
MEMINFO_GET(mem_info, MEMINFO_MEM_TOTAL, ul_int) +
MEMINFO_GET(mem_info, MEMINFO_SWAP_TOTAL, ul_int), flags, args));
printf(" %11s", scale_size(
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_USED, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_USED, ul_int), flags, args));
MEMINFO_GET(mem_info, MEMINFO_MEM_USED, ul_int) +
MEMINFO_GET(mem_info, MEMINFO_SWAP_USED, ul_int), flags, args));
printf(" %11s", scale_size(
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_FREE, ul_int) +
PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_SWAP_FREE, ul_int), flags, args));
MEMINFO_GET(mem_info, MEMINFO_MEM_FREE, ul_int) +
MEMINFO_GET(mem_info, MEMINFO_SWAP_FREE, ul_int), flags, args));
printf("\n");
}
fflush(stdout);

34
pgrep.c
View File

@ -52,18 +52,18 @@
#include <proc/procps.h>
enum pids_item Items[] = {
PROCPS_PIDS_ID_PID,
PROCPS_PIDS_ID_PPID,
PROCPS_PIDS_ID_PGRP,
PROCPS_PIDS_ID_EUID,
PROCPS_PIDS_ID_RUID,
PROCPS_PIDS_ID_RGID,
PROCPS_PIDS_ID_SESSION,
PROCPS_PIDS_ID_TGID,
PROCPS_PIDS_TIME_START,
PROCPS_PIDS_TTY_NAME,
PROCPS_PIDS_CMD,
PROCPS_PIDS_CMDLINE
PIDS_ID_PID,
PIDS_ID_PPID,
PIDS_ID_PGRP,
PIDS_ID_EUID,
PIDS_ID_RUID,
PIDS_ID_RGID,
PIDS_ID_SESSION,
PIDS_ID_TGID,
PIDS_TIME_START,
PIDS_TTY_NAME,
PIDS_CMD,
PIDS_CMDLINE
};
enum rel_items {
EU_PID, EU_PPID, EU_PGRP, EU_EUID, EU_RUID, EU_RGID, EU_SESSION,
@ -471,9 +471,9 @@ static regex_t * do_regcomp (void)
static struct el * select_procs (int *num)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETULL(e) PROCPS_PIDS_VAL(EU_ ## e, ull_int, stack)
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, stack)
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, stack)
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, stack)
struct pids_info *info=NULL;
struct procps_namespaces nsp;
struct pids_stack *stack;
@ -504,9 +504,9 @@ static struct el * select_procs (int *num)
if (procps_pids_new(&info, Items, 12) < 0)
xerrx(EXIT_FATAL,
_("Unable to create pid info structure"));
which = PROCPS_FETCH_TASKS_ONLY;
which = PIDS_FETCH_TASKS_ONLY;
if (opt_threads && !i_am_pkill)
which = PROCPS_FETCH_THREADS_TOO;
which = PIDS_FETCH_THREADS_TOO;
while ((stack = procps_pids_get(info, which))) {
int match = 1;

10
pidof.c
View File

@ -130,7 +130,7 @@ static char *pid_link (pid_t pid, const char *base_name)
static void select_procs (void)
{
enum pids_item items[] = { PROCPS_PIDS_ID_PID, PROCPS_PIDS_CMD, PROCPS_PIDS_CMDLINE_V };
enum pids_item items[] = { PIDS_ID_PID, PIDS_CMD, PIDS_CMDLINE_V };
enum rel_items { rel_pid, rel_cmd, rel_cmdline };
struct pids_info *info = NULL;
struct pids_stack *stack;
@ -150,10 +150,10 @@ static void select_procs (void)
procps_pids_new(&info, items, 3);
exe_link = root_link = NULL;
while ((stack = procps_pids_get(info, PROCPS_FETCH_TASKS_ONLY))) {
char *p_cmd = PROCPS_PIDS_VAL(rel_cmd, str, stack),
**p_cmdline = PROCPS_PIDS_VAL(rel_cmdline, strv, stack);
int tid = PROCPS_PIDS_VAL(rel_pid, s_int, stack);
while ((stack = procps_pids_get(info, PIDS_FETCH_TASKS_ONLY))) {
char *p_cmd = PIDS_VAL(rel_cmd, str, stack),
**p_cmdline = PIDS_VAL(rel_cmdline, strv, stack);
int tid = PIDS_VAL(rel_pid, s_int, stack);
if (opt_rootdir_check) {
/* get the /proc/<pid>/root symlink value */

16
pmap.c
View File

@ -38,8 +38,8 @@
#include <proc/procps.h>
enum pids_item Pid_items[] = {
PROCPS_PIDS_ID_PID, PROCPS_PIDS_ID_TGID,
PROCPS_PIDS_CMDLINE, PROCPS_PIDS_ADDR_START_STACK };
PIDS_ID_PID, PIDS_ID_TGID,
PIDS_CMDLINE, PIDS_ADDR_START_STACK };
enum rel_items { pid, tgid, cmdline, start_stack };
const char *nls_Address,
@ -238,8 +238,8 @@ static char *mapping_name(struct pids_stack *p, unsigned long addr,
}
cp = _(" [ anon ]");
if (PROCPS_PIDS_VAL(start_stack, ul_int, p) >= addr
&& (PROCPS_PIDS_VAL(start_stack, ul_int, p) <= addr + len))
if (PIDS_VAL(start_stack, ul_int, p) >= addr
&& (PIDS_VAL(start_stack, ul_int, p) <= addr + len))
cp = _(" [ stack ]");
return cp;
}
@ -534,14 +534,14 @@ static int one_proc (struct pids_stack *p)
unsigned long long total_shared_dirty = 0ull;
int maxw1=0, maxw2=0, maxw3=0, maxw4=0, maxw5=0;
printf("%u: %s\n", PROCPS_PIDS_VAL(tgid, s_int, p), PROCPS_PIDS_VAL(cmdline, str, p));
printf("%u: %s\n", PIDS_VAL(tgid, s_int, p), PIDS_VAL(cmdline, str, p));
if (x_option || X_option || c_option) {
sprintf(buf, "/proc/%u/smaps", PROCPS_PIDS_VAL(tgid, s_int, p));
sprintf(buf, "/proc/%u/smaps", PIDS_VAL(tgid, s_int, p));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
} else {
sprintf(buf, "/proc/%u/maps", PROCPS_PIDS_VAL(tgid, s_int, p));
sprintf(buf, "/proc/%u/maps", PIDS_VAL(tgid, s_int, p));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
}
@ -1161,7 +1161,7 @@ int main(int argc, char **argv)
discover_shm_minor();
if (!(pids_fetch = procps_pids_select(info, pidlist, user_count, PROCPS_SELECT_PID)))
if (!(pids_fetch = procps_pids_select(info, pidlist, user_count, PIDS_SELECT_PID)))
xerrx(EXIT_FAILURE, _("library failed pids statistics"));
for (reap_count = 0; reap_count < pids_fetch->counts->total; reap_count++) {

View File

@ -23,7 +23,7 @@
#include <proc/procps.h>
#include "tests.h"
enum pids_item items[] = { PROCPS_PIDS_ID_PID, PROCPS_PIDS_ID_PID };
enum pids_item items[] = { PIDS_ID_PID, PIDS_ID_PID };
int check_pids_new_nullinfo(void *data)
{

View File

@ -34,13 +34,13 @@
/* a 'results stack value' extractor macro
where: E=rel enum, T=data type, S=stack */
#define rSv(E,T,S) PROCPS_PIDS_VAL(rel_ ## E, T, S)
#define rSv(E,T,S) PIDS_VAL(rel_ ## E, T, S)
#define namREL(e) rel_ ## e
#define makEXT(e) extern int namREL(e);
#define makREL(e) int namREL(e) = -1;
#define chkREL(e) if (namREL(e) < 0) { \
Pids_items[Pids_index] = PROCPS_PIDS_ ## e; \
Pids_items[Pids_index] = PIDS_ ## e; \
namREL(e) = (Pids_index < PIDSITEMS) ? Pids_index++ : rel_noop; }
#define setREL1(e) { \

View File

@ -282,12 +282,12 @@ static void simple_spew(void){
unsigned *pidlist = xcalloc(selection_list->n, sizeof(unsigned));
for (i = 0; i < selection_list->n; i++)
pidlist[i] = selection_list->u[selection_list->n-i-1].pid;
pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PROCPS_SELECT_PID);
pidread = procps_pids_select(Pids_info, pidlist, selection_list->n, PIDS_SELECT_PID);
free(pidlist);
} else {
enum pids_fetch_type which;
which = (thread_flags & (TF_loose_tasks|TF_show_task))
? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY;
? PIDS_FETCH_THREADS_TOO : PIDS_FETCH_TASKS_ONLY;
pidread = procps_pids_reap(Pids_info, which);
}
if (!pidread) {
@ -313,9 +313,9 @@ static void simple_spew(void){
break;
case TF_show_proc|TF_show_task: // m and -m options
procps_pids_sort(Pids_info, pidread->stacks
, pidread->counts->total, PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND);
, pidread->counts->total, PIDS_TIME_START, PIDS_SORT_ASCEND);
procps_pids_sort(Pids_info, pidread->stacks
, pidread->counts->total, PROCPS_PIDS_ID_TGID, PROCPS_PIDS_ASCEND);
, pidread->counts->total, PIDS_ID_TGID, PIDS_SORT_ASCEND);
for (i = 0; i < pidread->counts->total; i++) {
buf = pidread->stacks[i];
next_proc:
@ -343,7 +343,7 @@ static void prep_forest_sort(void){
incoming = search_format_array("ppid");
if(!incoming) { fprintf(stderr, _("could not find ppid\n")); exit(1); }
tmp_list = xmalloc(sizeof(sort_node));
tmp_list->reverse = PROCPS_PIDS_ASCEND;
tmp_list->reverse = PIDS_SORT_ASCEND;
tmp_list->typecode = '?'; /* what was this for? */
tmp_list->sr = incoming->sr;
tmp_list->next = sort_list;
@ -353,7 +353,7 @@ static void prep_forest_sort(void){
incoming = search_format_array("start_time");
if(!incoming) { fprintf(stderr, _("could not find start_time\n")); exit(1); }
tmp_list = xmalloc(sizeof(sort_node));
tmp_list->reverse = PROCPS_PIDS_ASCEND;
tmp_list->reverse = PIDS_SORT_ASCEND;
tmp_list->typecode = '?'; /* what was this for? */
tmp_list->sr = incoming->sr;
tmp_list->next = sort_list;
@ -445,7 +445,7 @@ static void fancy_spew(void){
int i, n = 0;
which = (thread_flags & TF_loose_tasks)
? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY;
? PIDS_FETCH_THREADS_TOO : PIDS_FETCH_TASKS_ONLY;
pidread = procps_pids_reap(Pids_info, which);
if (!pidread || !pidread->counts->total) {

View File

@ -49,8 +49,8 @@
// --- <pids> interface begin ||||||||||||||||||||||||||||||||||||||||||||
// -----------------------------------------------------------------------
struct pids_info *Pids_info = NULL; // our required <pids> context
enum pids_item *Pids_items; // allocated as PIDSITEMS
int Pids_index; // actual number of active enums
enum pids_item *Pids_items; // allocated as PIDSITEMS
int Pids_index; // actual number of active enums
// most of these could be defined as static in the output.c module
// (but for future flexibility, the easiest route has been chosen)
@ -464,7 +464,7 @@ void reset_global(void){
Pids_items = xcalloc(PIDSITEMS, sizeof(enum pids_item));
for (i = 0; i < PIDSITEMS; i++)
Pids_items[i] = PROCPS_PIDS_noop;
Pids_items[i] = PIDS_noop;
if (!Pids_info) {
if (procps_pids_new(&Pids_info, Pids_items, i)) {
@ -473,7 +473,7 @@ void reset_global(void){
}
}
Pids_items[0] = PROCPS_PIDS_TTY;
Pids_items[0] = PIDS_TTY;
procps_pids_reset(Pids_info, Pids_items, 1);
if (!(p = fatal_proc_unmounted(Pids_info, 1))) {
fprintf(stderr, _("fatal library error, lookup self\n"));
@ -488,7 +488,7 @@ void reset_global(void){
bsd_c_option = 0;
bsd_e_option = 0;
cached_euid = geteuid();
cached_tty = PROCPS_PIDS_VAL(0, s_int, p);
cached_tty = PIDS_VAL(0, s_int, p);
/* forest_prefix must be all zero because of POSIX */
forest_type = 0;
format_flags = 0; /* -l -f l u s -j... */

View File

@ -94,7 +94,7 @@ static void get_boot_time(void)
struct stat_info *stat_info = NULL;
if (procps_stat_new(&stat_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create NEW ystem stat structure"));
boot_time = PROCPS_STAT_GET(stat_info, PROCPS_STAT_SYS_TIME_OF_BOOT, ul_int);
boot_time = STAT_GET(stat_info, STAT_SYS_TIME_OF_BOOT, ul_int);
procps_stat_unref(&stat_info);
}
@ -104,7 +104,7 @@ static void get_memory_total()
if (procps_meminfo_new(&mem_info) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create meminfo structure"));
memory_total = PROCPS_MEMINFO_GET(mem_info, PROCPS_MEMINFO_MEM_TOTAL, ul_int);
memory_total = MEMINFO_GET(mem_info, MEMINFO_MEM_TOTAL, ul_int);
procps_meminfo_unref(&mem_info);
}
@ -1375,261 +1375,261 @@ static int pr_t_left2(char *restrict const outbuf, const proc_t *restrict const
/* there are about 211 listed */
/* Many of these are placeholders for unsupported options. */
static const format_struct format_array[] = { /*
.spec .head .pr .sr .width .vendor .flags */
{"%cpu", "%CPU", pr_pcpu, PROCPS_PIDS_extra, 4, BSD, ET|RIGHT}, /*pcpu*/
{"%mem", "%MEM", pr_pmem, PROCPS_PIDS_VM_RSS, 4, BSD, PO|RIGHT}, /*pmem*/
{"_left", "LLLLLLLL", pr_t_left, PROCPS_PIDS_noop, 8, TST, ET|LEFT},
{"_left2", "L2L2L2L2", pr_t_left2, PROCPS_PIDS_noop, 8, TST, ET|LEFT},
{"_right", "RRRRRRRRRRR", pr_t_right, PROCPS_PIDS_noop, 11, TST, ET|RIGHT},
{"_right2", "R2R2R2R2R2R", pr_t_right2, PROCPS_PIDS_noop, 11, TST, ET|RIGHT},
{"_unlimited","U", pr_t_unlimited, PROCPS_PIDS_noop, 16, TST, ET|UNLIMITED},
{"_unlimited2","U2", pr_t_unlimited2, PROCPS_PIDS_noop, 16, TST, ET|UNLIMITED},
{"acflag", "ACFLG", pr_nop, PROCPS_PIDS_noop, 5, XXX, AN|RIGHT}, /*acflg*/
{"acflg", "ACFLG", pr_nop, PROCPS_PIDS_noop, 5, BSD, AN|RIGHT}, /*acflag*/
{"addr", "ADDR", pr_nop, PROCPS_PIDS_noop, 4, XXX, AN|RIGHT},
{"addr_1", "ADDR", pr_nop, PROCPS_PIDS_noop, 1, LNX, AN|LEFT},
{"alarm", "ALARM", pr_alarm, PROCPS_PIDS_ALARM, 5, LNX, AN|RIGHT},
{"argc", "ARGC", pr_nop, PROCPS_PIDS_noop, 4, LNX, PO|RIGHT},
{"args", "COMMAND", pr_args, PROCPS_PIDS_CMDLINE, 27, U98, PO|UNLIMITED}, /*command*/
{"atime", "TIME", pr_time, PROCPS_PIDS_TIME_ALL, 8, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */
{"blocked", "BLOCKED", pr_sigmask, PROCPS_PIDS_SIGBLOCKED, 9, BSD, TO|SIGNAL},/*sigmask*/
{"bnd", "BND", pr_nop, PROCPS_PIDS_noop, 1, AIX, TO|RIGHT},
{"bsdstart", "START", pr_bsdstart, PROCPS_PIDS_TIME_START, 6, LNX, ET|RIGHT},
{"bsdtime", "TIME", pr_bsdtime, PROCPS_PIDS_TICS_ALL, 6, LNX, ET|RIGHT},
{"c", "C", pr_c, PROCPS_PIDS_extra, 2, SUN, ET|RIGHT},
{"caught", "CAUGHT", pr_sigcatch, PROCPS_PIDS_SIGCATCH, 9, BSD, TO|SIGNAL}, /*sigcatch*/
{"cgname", "CGNAME", pr_cgname, PROCPS_PIDS_CGNAME, 27, LNX, PO|UNLIMITED},
{"cgroup", "CGROUP", pr_cgroup, PROCPS_PIDS_CGROUP, 27, LNX, PO|UNLIMITED},
{"class", "CLS", pr_class, PROCPS_PIDS_SCHED_CLASS, 3, XXX, TO|LEFT},
{"cls", "CLS", pr_class, PROCPS_PIDS_SCHED_CLASS, 3, HPU, TO|RIGHT}, /*says HPUX or RT*/
{"cmaj_flt", "-", pr_nop, PROCPS_PIDS_noop, 1, LNX, AN|RIGHT},
{"cmd", "CMD", pr_args, PROCPS_PIDS_CMDLINE, 27, DEC, PO|UNLIMITED}, /*ucomm*/
{"cmin_flt", "-", pr_nop, PROCPS_PIDS_noop, 1, LNX, AN|RIGHT},
{"cnswap", "-", pr_nop, PROCPS_PIDS_noop, 1, LNX, AN|RIGHT},
{"comm", "COMMAND", pr_comm, PROCPS_PIDS_CMD, 15, U98, PO|UNLIMITED}, /*ucomm*/
{"command", "COMMAND", pr_args, PROCPS_PIDS_CMDLINE, 27, XXX, PO|UNLIMITED}, /*args*/
{"context", "CONTEXT", pr_context, PROCPS_PIDS_ID_TGID, 31, LNX, ET|LEFT},
{"cp", "CP", pr_cp, PROCPS_PIDS_extra, 3, DEC, ET|RIGHT}, /*cpu*/
{"cpu", "CPU", pr_nop, PROCPS_PIDS_noop, 3, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
{"cpuid", "CPUID", pr_psr, PROCPS_PIDS_PROCESSOR, 5, BSD, TO|RIGHT}, // OpenBSD: 8 wide!
{"cputime", "TIME", pr_time, PROCPS_PIDS_TIME_ALL, 8, DEC, ET|RIGHT}, /*time*/
{"ctid", "CTID", pr_nop, PROCPS_PIDS_noop, 5, SUN, ET|RIGHT}, // resource contracts?
{"cursig", "CURSIG", pr_nop, PROCPS_PIDS_noop, 6, DEC, AN|RIGHT},
{"cutime", "-", pr_nop, PROCPS_PIDS_TICS_USER_C, 1, LNX, AN|RIGHT},
{"cwd", "CWD", pr_nop, PROCPS_PIDS_noop, 3, LNX, AN|LEFT},
{"drs", "DRS", pr_drs, PROCPS_PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT},
{"dsiz", "DSIZ", pr_dsiz, PROCPS_PIDS_VSIZE_PGS, 4, LNX, PO|RIGHT},
{"egid", "EGID", pr_egid, PROCPS_PIDS_ID_EGID, 5, LNX, ET|RIGHT},
{"egroup", "EGROUP", pr_egroup, PROCPS_PIDS_ID_EGROUP, 8, LNX, ET|USER},
{"eip", "EIP", pr_eip, PROCPS_PIDS_ADDR_KSTK_EIP, 8, LNX, TO|RIGHT},
{"emul", "EMUL", pr_nop, PROCPS_PIDS_noop, 13, BSD, PO|LEFT}, /* "FreeBSD ELF32" and such */
{"end_code", "E_CODE", pr_nop, PROCPS_PIDS_ADDR_END_CODE, 8, LNx, PO|RIGHT},
{"environ","ENVIRONMENT",pr_nop, PROCPS_PIDS_noop, 11, LNx, PO|UNLIMITED},
{"esp", "ESP", pr_esp, PROCPS_PIDS_ADDR_KSTK_ESP, 8, LNX, TO|RIGHT},
{"etime", "ELAPSED", pr_etime, PROCPS_PIDS_TIME_ELAPSED, 11, U98, ET|RIGHT}, /* was 7 wide */
{"etimes", "ELAPSED", pr_etimes, PROCPS_PIDS_TIME_ELAPSED, 7, BSD, ET|RIGHT}, /* FreeBSD */
{"euid", "EUID", pr_euid, PROCPS_PIDS_ID_EUID, 5, LNX, ET|RIGHT},
{"euser", "EUSER", pr_euser, PROCPS_PIDS_ID_EUSER, 8, LNX, ET|USER},
{"f", "F", pr_flag, PROCPS_PIDS_FLAGS, 1, XXX, ET|RIGHT}, /*flags*/
{"fgid", "FGID", pr_fgid, PROCPS_PIDS_FLAGS, 5, LNX, ET|RIGHT},
{"fgroup", "FGROUP", pr_fgroup, PROCPS_PIDS_ID_FGROUP, 8, LNX, ET|USER},
{"flag", "F", pr_flag, PROCPS_PIDS_FLAGS, 1, DEC, ET|RIGHT},
{"flags", "F", pr_flag, PROCPS_PIDS_FLAGS, 1, BSD, ET|RIGHT}, /*f*/ /* was FLAGS, 8 wide */
{"fname", "COMMAND", pr_fname, PROCPS_PIDS_CMD, 8, SUN, PO|LEFT},
{"fsgid", "FSGID", pr_fgid, PROCPS_PIDS_ID_FGID, 5, LNX, ET|RIGHT},
{"fsgroup", "FSGROUP", pr_fgroup, PROCPS_PIDS_ID_FGROUP, 8, LNX, ET|USER},
{"fsuid", "FSUID", pr_fuid, PROCPS_PIDS_ID_FUID, 5, LNX, ET|RIGHT},
{"fsuser", "FSUSER", pr_fuser, PROCPS_PIDS_ID_FUSER, 8, LNX, ET|USER},
{"fuid", "FUID", pr_fuid, PROCPS_PIDS_ID_FUID, 5, LNX, ET|RIGHT},
{"fuser", "FUSER", pr_fuser, PROCPS_PIDS_ID_FUSER, 8, LNX, ET|USER},
{"gid", "GID", pr_egid, PROCPS_PIDS_ID_EGID, 5, SUN, ET|RIGHT},
{"group", "GROUP", pr_egroup, PROCPS_PIDS_ID_EGROUP, 8, U98, ET|USER},
{"ignored", "IGNORED", pr_sigignore, PROCPS_PIDS_SIGIGNORE, 9, BSD, TO|SIGNAL},/*sigignore*/
{"inblk", "INBLK", pr_nop, PROCPS_PIDS_noop, 5, BSD, AN|RIGHT}, /*inblock*/
{"inblock", "INBLK", pr_nop, PROCPS_PIDS_noop, 5, DEC, AN|RIGHT}, /*inblk*/
{"intpri", "PRI", pr_opri, PROCPS_PIDS_PRIORITY, 3, HPU, TO|RIGHT},
{"ipcns", "IPCNS", pr_ipcns, PROCPS_PIDS_NS_IPC, 10, LNX, ET|RIGHT},
{"jid", "JID", pr_nop, PROCPS_PIDS_noop, 1, SGI, PO|RIGHT},
{"jobc", "JOBC", pr_nop, PROCPS_PIDS_noop, 4, XXX, AN|RIGHT},
{"ktrace", "KTRACE", pr_nop, PROCPS_PIDS_noop, 8, BSD, AN|RIGHT},
{"ktracep", "KTRACEP", pr_nop, PROCPS_PIDS_noop, 8, BSD, AN|RIGHT},
{"label", "LABEL", pr_context, PROCPS_PIDS_ID_TGID, 31, SGI, ET|LEFT},
{"lastcpu", "C", pr_psr, PROCPS_PIDS_PROCESSOR, 3, BSD, TO|RIGHT}, // DragonFly
{"lim", "LIM", pr_lim, PROCPS_PIDS_RSS_RLIM, 5, BSD, AN|RIGHT},
{"login", "LOGNAME", pr_nop, PROCPS_PIDS_noop, 8, BSD, AN|LEFT}, /*logname*/ /* double check */
{"logname", "LOGNAME", pr_nop, PROCPS_PIDS_noop, 8, XXX, AN|LEFT}, /*login*/
{"longtname", "TTY", pr_tty8, PROCPS_PIDS_TTY_NAME, 8, DEC, PO|LEFT},
{"lsession", "SESSION", pr_sd_session, PROCPS_PIDS_SD_SESS, 11, LNX, ET|LEFT},
{"lstart", "STARTED", pr_lstart, PROCPS_PIDS_TIME_START, 24, XXX, ET|RIGHT},
{"luid", "LUID", pr_nop, PROCPS_PIDS_noop, 5, LNX, ET|RIGHT}, /* login ID */
{"luser", "LUSER", pr_nop, PROCPS_PIDS_noop, 8, LNX, ET|USER}, /* login USER */
{"lwp", "LWP", pr_tasks, PROCPS_PIDS_ID_PID, 5, SUN, TO|PIDMAX|RIGHT},
{"lxc", "LXC", pr_lxcname, PROCPS_PIDS_LXCNAME, 8, LNX, ET|LEFT},
{"m_drs", "DRS", pr_drs, PROCPS_PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
{"m_dt", "DT", pr_nop, PROCPS_PIDS_MEM_DT, 4, LNx, PO|RIGHT},
{"m_lrs", "LRS", pr_nop, PROCPS_PIDS_MEM_LRS, 5, LNx, PO|RIGHT},
{"m_resident", "RES", pr_nop, PROCPS_PIDS_MEM_RES, 5, LNx, PO|RIGHT},
{"m_share", "SHRD", pr_nop, PROCPS_PIDS_MEM_SHR, 5, LNx, PO|RIGHT},
{"m_size", "SIZE", pr_size, PROCPS_PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT},
{"m_swap", "SWAP", pr_nop, PROCPS_PIDS_noop, 5, LNx, PO|RIGHT},
{"m_trs", "TRS", pr_trs, PROCPS_PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
{"machine", "MACHINE", pr_sd_machine, PROCPS_PIDS_SD_MACH, 31, LNX, ET|LEFT},
{"maj_flt", "MAJFL", pr_majflt, PROCPS_PIDS_FLT_MAJ, 6, LNX, AN|RIGHT},
{"majflt", "MAJFLT", pr_majflt, PROCPS_PIDS_FLT_MAJ, 6, XXX, AN|RIGHT},
{"min_flt", "MINFL", pr_minflt, PROCPS_PIDS_FLT_MIN, 6, LNX, AN|RIGHT},
{"minflt", "MINFLT", pr_minflt, PROCPS_PIDS_FLT_MIN, 6, XXX, AN|RIGHT},
{"mntns", "MNTNS", pr_mntns, PROCPS_PIDS_NS_MNT, 10, LNX, ET|RIGHT},
{"msgrcv", "MSGRCV", pr_nop, PROCPS_PIDS_noop, 6, XXX, AN|RIGHT},
{"msgsnd", "MSGSND", pr_nop, PROCPS_PIDS_noop, 6, XXX, AN|RIGHT},
{"mwchan", "MWCHAN", pr_nop, PROCPS_PIDS_noop, 6, BSD, TO|WCHAN}, /* mutex (FreeBSD) */
{"netns", "NETNS", pr_netns, PROCPS_PIDS_NS_NET, 10, LNX, ET|RIGHT},
{"ni", "NI", pr_nice, PROCPS_PIDS_NICE, 3, BSD, TO|RIGHT}, /*nice*/
{"nice", "NI", pr_nice, PROCPS_PIDS_NICE, 3, U98, TO|RIGHT}, /*ni*/
{"nivcsw", "IVCSW", pr_nop, PROCPS_PIDS_noop, 5, XXX, AN|RIGHT},
{"nlwp", "NLWP", pr_nlwp, PROCPS_PIDS_NLWP, 4, SUN, PO|RIGHT},
{"nsignals", "NSIGS", pr_nop, PROCPS_PIDS_noop, 5, DEC, AN|RIGHT}, /*nsigs*/
{"nsigs", "NSIGS", pr_nop, PROCPS_PIDS_noop, 5, BSD, AN|RIGHT}, /*nsignals*/
{"nswap", "NSWAP", pr_nop, PROCPS_PIDS_noop, 5, XXX, AN|RIGHT},
{"nvcsw", "VCSW", pr_nop, PROCPS_PIDS_noop, 5, XXX, AN|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, PROCPS_PIDS_WCHAN_NAME, 6, XXX, TO|RIGHT},
{"opri", "PRI", pr_opri, PROCPS_PIDS_PRIORITY, 3, SUN, TO|RIGHT},
{"osz", "SZ", pr_nop, PROCPS_PIDS_noop, 2, SUN, PO|RIGHT},
{"oublk", "OUBLK", pr_nop, PROCPS_PIDS_noop, 5, BSD, AN|RIGHT}, /*oublock*/
{"oublock", "OUBLK", pr_nop, PROCPS_PIDS_noop, 5, DEC, AN|RIGHT}, /*oublk*/
{"ouid", "OWNER", pr_sd_ouid, PROCPS_PIDS_SD_OUID, 5, LNX, ET|LEFT},
{"p_ru", "P_RU", pr_nop, PROCPS_PIDS_noop, 6, BSD, AN|RIGHT},
{"paddr", "PADDR", pr_nop, PROCPS_PIDS_noop, 6, BSD, AN|RIGHT},
{"pagein", "PAGEIN", pr_majflt, PROCPS_PIDS_FLT_MAJ, 6, XXX, AN|RIGHT},
{"pcpu", "%CPU", pr_pcpu, PROCPS_PIDS_extra, 4, U98, ET|RIGHT}, /*%cpu*/
{"pending", "PENDING", pr_sig, PROCPS_PIDS_SIGNALS, 9, BSD, ET|SIGNAL}, /*sig*/
{"pgid", "PGID", pr_pgid, PROCPS_PIDS_ID_PGRP, 5, U98, PO|PIDMAX|RIGHT},
{"pgrp", "PGRP", pr_pgid, PROCPS_PIDS_ID_PGRP, 5, LNX, PO|PIDMAX|RIGHT},
{"pid", "PID", pr_procs, PROCPS_PIDS_ID_TGID, 5, U98, PO|PIDMAX|RIGHT},
{"pidns", "PIDNS", pr_pidns, PROCPS_PIDS_NS_PID, 10, LNX, ET|RIGHT},
{"pmem", "%MEM", pr_pmem, PROCPS_PIDS_VM_RSS, 4, XXX, PO|RIGHT}, /* %mem */
{"poip", "-", pr_nop, PROCPS_PIDS_noop, 1, BSD, AN|RIGHT},
{"policy", "POL", pr_class, PROCPS_PIDS_SCHED_CLASS, 3, DEC, TO|LEFT},
{"ppid", "PPID", pr_ppid, PROCPS_PIDS_ID_PPID, 5, U98, PO|PIDMAX|RIGHT},
{"pri", "PRI", pr_pri, PROCPS_PIDS_PRIORITY, 3, XXX, TO|RIGHT},
{"pri_api", "API", pr_pri_api, PROCPS_PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_bar", "BAR", pr_pri_bar, PROCPS_PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_baz", "BAZ", pr_pri_baz, PROCPS_PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_foo", "FOO", pr_pri_foo, PROCPS_PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"priority", "PRI", pr_priority, PROCPS_PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"prmgrp", "PRMGRP", pr_nop, PROCPS_PIDS_noop, 12, HPU, PO|RIGHT},
{"prmid", "PRMID", pr_nop, PROCPS_PIDS_noop, 12, HPU, PO|RIGHT},
{"project", "PROJECT", pr_nop, PROCPS_PIDS_noop, 12, SUN, PO|LEFT}, // see prm* andctid
{"projid", "PROJID", pr_nop, PROCPS_PIDS_noop, 5, SUN, PO|RIGHT},
{"pset", "PSET", pr_nop, PROCPS_PIDS_noop, 4, DEC, TO|RIGHT},
{"psr", "PSR", pr_psr, PROCPS_PIDS_PROCESSOR, 3, DEC, TO|RIGHT},
{"psxpri", "PPR", pr_nop, PROCPS_PIDS_noop, 3, DEC, TO|RIGHT},
{"re", "RE", pr_nop, PROCPS_PIDS_noop, 3, BSD, AN|RIGHT},
{"resident", "RES", pr_nop, PROCPS_PIDS_MEM_RES, 5, LNX, PO|RIGHT},
{"rgid", "RGID", pr_rgid, PROCPS_PIDS_ID_RGID, 5, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, PROCPS_PIDS_ID_RGROUP, 8, U98, ET|USER}, /* was 8 wide */
{"rlink", "RLINK", pr_nop, PROCPS_PIDS_noop, 8, BSD, AN|RIGHT},
{"rss", "RSS", pr_rss, PROCPS_PIDS_VM_RSS, 5, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, PROCPS_PIDS_VM_RSS, 5, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, PROCPS_PIDS_VM_RSS, 5, BSD, PO|RIGHT}, /*rssize*/
{"rtprio", "RTPRIO", pr_rtprio, PROCPS_PIDS_RTPRIO, 6, BSD, TO|RIGHT},
{"ruid", "RUID", pr_ruid, PROCPS_PIDS_ID_RUID, 5, XXX, ET|RIGHT},
{"ruser", "RUSER", pr_ruser, PROCPS_PIDS_ID_RUSER, 8, U98, ET|USER},
{"s", "S", pr_s, PROCPS_PIDS_STATE, 1, SUN, TO|LEFT}, /*stat,state*/
{"sched", "SCH", pr_sched, PROCPS_PIDS_SCHED_CLASS, 3, AIX, TO|RIGHT},
{"scnt", "SCNT", pr_nop, PROCPS_PIDS_noop, 4, DEC, AN|RIGHT}, /* man page misspelling of scount? */
{"scount", "SC", pr_nop, PROCPS_PIDS_noop, 4, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
{"seat", "SEAT", pr_sd_seat, PROCPS_PIDS_SD_SEAT, 11, LNX, ET|LEFT},
{"sess", "SESS", pr_sess, PROCPS_PIDS_ID_SESSION, 5, XXX, PO|PIDMAX|RIGHT},
{"session", "SESS", pr_sess, PROCPS_PIDS_ID_SESSION, 5, LNX, PO|PIDMAX|RIGHT},
{"sgi_p", "P", pr_sgi_p, PROCPS_PIDS_STATE, 1, LNX, TO|RIGHT}, /* "cpu" number */
{"sgi_rss", "RSS", pr_rss, PROCPS_PIDS_VM_RSS, 4, LNX, PO|LEFT}, /* SZ:RSS */
{"sgid", "SGID", pr_sgid, PROCPS_PIDS_ID_SGID, 5, LNX, ET|RIGHT},
{"sgroup", "SGROUP", pr_sgroup, PROCPS_PIDS_ID_SGROUP, 8, LNX, ET|USER},
{"share", "-", pr_nop, PROCPS_PIDS_noop, 1, LNX, PO|RIGHT},
{"sid", "SID", pr_sess, PROCPS_PIDS_ID_SESSION, 5, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */
{"sig", "PENDING", pr_sig, PROCPS_PIDS_SIGNALS, 9, XXX, ET|SIGNAL}, /*pending -- Dragonfly uses this for whole-proc and "tsig" for thread */
{"sig_block", "BLOCKED", pr_sigmask, PROCPS_PIDS_SIGBLOCKED, 9, LNX, TO|SIGNAL},
{"sig_catch", "CATCHED", pr_sigcatch, PROCPS_PIDS_SIGCATCH, 9, LNX, TO|SIGNAL},
{"sig_ignore", "IGNORED",pr_sigignore, PROCPS_PIDS_SIGIGNORE, 9, LNX, TO|SIGNAL},
{"sig_pend", "SIGNAL", pr_sig, PROCPS_PIDS_SIGNALS, 9, LNX, ET|SIGNAL},
{"sigcatch", "CAUGHT", pr_sigcatch, PROCPS_PIDS_SIGCATCH, 9, XXX, TO|SIGNAL}, /*caught*/
{"sigignore", "IGNORED", pr_sigignore, PROCPS_PIDS_SIGIGNORE, 9, XXX, TO|SIGNAL}, /*ignored*/
{"sigmask", "BLOCKED", pr_sigmask, PROCPS_PIDS_SIGBLOCKED, 9, XXX, TO|SIGNAL}, /*blocked*/
{"size", "SIZE", pr_swapable, PROCPS_PIDS_VSIZE_PGS, 5, SCO, PO|RIGHT},
{"sl", "SL", pr_nop, PROCPS_PIDS_noop, 3, XXX, AN|RIGHT},
{"slice", "SLICE", pr_sd_slice, PROCPS_PIDS_SD_SLICE, 31, LNX, ET|LEFT},
{"spid", "SPID", pr_tasks, PROCPS_PIDS_ID_PID, 5, SGI, TO|PIDMAX|RIGHT},
{"stackp", "STACKP", pr_stackp, PROCPS_PIDS_ADDR_START_STACK, 8, LNX, PO|RIGHT}, /*start_stack*/
{"start", "STARTED", pr_start, PROCPS_PIDS_TIME_START, 8, XXX, ET|RIGHT},
{"start_code", "S_CODE", pr_nop, PROCPS_PIDS_noop, 8, LNx, PO|RIGHT},
{"start_stack", "STACKP", pr_stackp, PROCPS_PIDS_ADDR_START_STACK, 8, LNX, PO|RIGHT}, /*stackp*/
{"start_time", "START", pr_stime, PROCPS_PIDS_TIME_START, 5, LNx, ET|RIGHT},
{"stat", "STAT", pr_stat, PROCPS_PIDS_STATE, 4, BSD, TO|LEFT}, /*state,s*/
{"state", "S", pr_s, PROCPS_PIDS_STATE, 1, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */
{"status", "STATUS", pr_nop, PROCPS_PIDS_noop, 6, DEC, AN|RIGHT},
{"stime", "STIME", pr_stime, PROCPS_PIDS_TIME_START, 5, XXX, ET|RIGHT}, /* was 6 wide */
{"suid", "SUID", pr_suid, PROCPS_PIDS_ID_SUID, 5, LNx, ET|RIGHT},
{"supgid", "SUPGID", pr_supgid, PROCPS_PIDS_SUPGIDS, 20, LNX, PO|UNLIMITED},
{"supgrp", "SUPGRP", pr_supgrp, PROCPS_PIDS_SUPGROUPS, 40, LNX, PO|UNLIMITED},
{"suser", "SUSER", pr_suser, PROCPS_PIDS_ID_SUSER, 8, LNx, ET|USER},
{"svgid", "SVGID", pr_sgid, PROCPS_PIDS_ID_SGID, 5, XXX, ET|RIGHT},
{"svgroup", "SVGROUP", pr_sgroup, PROCPS_PIDS_ID_SGROUP, 8, LNX, ET|USER},
{"svuid", "SVUID", pr_suid, PROCPS_PIDS_ID_SUID, 5, XXX, ET|RIGHT},
{"svuser", "SVUSER", pr_suser, PROCPS_PIDS_ID_SUSER, 8, LNX, ET|USER},
{"systime", "SYSTEM", pr_nop, PROCPS_PIDS_noop, 6, DEC, ET|RIGHT},
{"sz", "SZ", pr_sz, PROCPS_PIDS_VM_SIZE, 5, HPU, PO|RIGHT},
{"taskid", "TASKID", pr_nop, PROCPS_PIDS_noop, 5, SUN, TO|PIDMAX|RIGHT}, // is this a thread ID?
{"tdev", "TDEV", pr_nop, PROCPS_PIDS_noop, 4, XXX, AN|RIGHT},
{"tgid", "TGID", pr_procs, PROCPS_PIDS_ID_TGID, 5, LNX, PO|PIDMAX|RIGHT},
{"thcount", "THCNT", pr_nlwp, PROCPS_PIDS_NLWP, 5, AIX, PO|RIGHT},
{"tid", "TID", pr_tasks, PROCPS_PIDS_ID_PID, 5, AIX, TO|PIDMAX|RIGHT},
{"time", "TIME", pr_time, PROCPS_PIDS_TIME_ALL, 8, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */
{"timeout", "TMOUT", pr_nop, PROCPS_PIDS_noop, 5, LNX, AN|RIGHT}, // 2.0.xx era
{"tmout", "TMOUT", pr_nop, PROCPS_PIDS_noop, 5, LNX, AN|RIGHT}, // 2.0.xx era
{"tname", "TTY", pr_tty8, PROCPS_PIDS_TTY_NAME, 8, DEC, PO|LEFT},
{"tpgid", "TPGID", pr_tpgid, PROCPS_PIDS_ID_TPGID, 5, XXX, PO|PIDMAX|RIGHT},
{"trs", "TRS", pr_trs, PROCPS_PIDS_VSIZE_PGS, 4, AIX, PO|RIGHT},
{"trss", "TRSS", pr_trs, PROCPS_PIDS_VSIZE_PGS, 4, BSD, PO|RIGHT}, /* 4.3BSD NET/2 */
{"tsess", "TSESS", pr_nop, PROCPS_PIDS_noop, 5, BSD, PO|PIDMAX|RIGHT},
{"tsession", "TSESS", pr_nop, PROCPS_PIDS_noop, 5, DEC, PO|PIDMAX|RIGHT},
{"tsid", "TSID", pr_nop, PROCPS_PIDS_noop, 5, BSD, PO|PIDMAX|RIGHT},
{"tsig", "PENDING", pr_tsig, PROCPS_PIDS_SIGPENDING, 9, BSD, ET|SIGNAL}, /* Dragonfly used this for thread-specific, and "sig" for whole-proc */
{"tsiz", "TSIZ", pr_tsiz, PROCPS_PIDS_VSIZE_PGS, 4, BSD, PO|RIGHT},
{"tt", "TT", pr_tty8, PROCPS_PIDS_TTY_NAME, 8, BSD, PO|LEFT},
{"tty", "TT", pr_tty8, PROCPS_PIDS_TTY_NAME, 8, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
{"tty4", "TTY", pr_tty4, PROCPS_PIDS_TTY_NAME, 4, LNX, PO|LEFT},
{"tty8", "TTY", pr_tty8, PROCPS_PIDS_TTY_NAME, 8, LNX, PO|LEFT},
{"u_procp", "UPROCP", pr_nop, PROCPS_PIDS_noop, 6, DEC, AN|RIGHT},
{"ucmd", "CMD", pr_comm, PROCPS_PIDS_CMD, 15, DEC, PO|UNLIMITED}, /*ucomm*/
{"ucomm", "COMMAND", pr_comm, PROCPS_PIDS_CMD, 15, XXX, PO|UNLIMITED}, /*comm*/
{"uid", "UID", pr_euid, PROCPS_PIDS_ID_EUID, 5, XXX, ET|RIGHT},
{"uid_hack", "UID", pr_euser, PROCPS_PIDS_ID_EUSER, 8, XXX, ET|USER},
{"umask", "UMASK", pr_nop, PROCPS_PIDS_noop, 5, DEC, AN|RIGHT},
{"uname", "USER", pr_euser, PROCPS_PIDS_ID_EUSER, 8, DEC, ET|USER}, /* man page misspelling of user? */
{"unit", "UNIT", pr_sd_unit, PROCPS_PIDS_SD_UNIT, 31, LNX, ET|LEFT},
{"upr", "UPR", pr_nop, PROCPS_PIDS_noop, 3, BSD, TO|RIGHT}, /*usrpri*/
{"uprocp", "UPROCP", pr_nop, PROCPS_PIDS_noop, 8, BSD, AN|RIGHT},
{"user", "USER", pr_euser, PROCPS_PIDS_ID_EUSER, 8, U98, ET|USER}, /* BSD n forces this to UID */
{"userns", "USERNS", pr_userns, PROCPS_PIDS_NS_USER, 10, LNX, ET|RIGHT},
{"usertime", "USER", pr_nop, PROCPS_PIDS_noop, 4, DEC, ET|RIGHT},
{"usrpri", "UPR", pr_nop, PROCPS_PIDS_noop, 3, DEC, TO|RIGHT}, /*upr*/
{"util", "C", pr_c, PROCPS_PIDS_extra, 2, SGI, ET|RIGHT}, // not sure about "C"
{"utime", "UTIME", pr_nop, PROCPS_PIDS_TICS_USER, 6, LNx, ET|RIGHT},
{"utsns", "UTSNS", pr_utsns, PROCPS_PIDS_NS_UTS, 10, LNX, ET|RIGHT},
{"uunit", "UUNIT", pr_sd_uunit, PROCPS_PIDS_SD_UUNIT, 31, LNX, ET|LEFT},
{"vm_data", "DATA", pr_nop, PROCPS_PIDS_VM_DATA, 5, LNx, PO|RIGHT},
{"vm_exe", "EXE", pr_nop, PROCPS_PIDS_VM_EXE, 5, LNx, PO|RIGHT},
{"vm_lib", "LIB", pr_nop, PROCPS_PIDS_VM_LIB, 5, LNx, PO|RIGHT},
{"vm_lock", "LCK", pr_nop, PROCPS_PIDS_VM_RSS_LOCKED, 3, LNx, PO|RIGHT},
{"vm_stack", "STACK", pr_nop, PROCPS_PIDS_VM_STACK, 5, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, PROCPS_PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, PROCPS_PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/
{"wchan", "WCHAN", pr_wchan, PROCPS_PIDS_WCHAN_ADDR, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wname", "WCHAN", pr_wname, PROCPS_PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */
{"xstat", "XSTAT", pr_nop, PROCPS_PIDS_noop, 5, BSD, AN|RIGHT},
{"zone", "ZONE", pr_context, PROCPS_PIDS_ID_TGID, 31, SUN, ET|LEFT}, // Solaris zone == Linux context?
{"zoneid", "ZONEID", pr_nop, PROCPS_PIDS_noop, 31, SUN, ET|RIGHT}, // Linux only offers context names
{"~", "-", pr_nop, PROCPS_PIDS_noop, 1, LNX, AN|RIGHT} /* NULL would ruin alphabetical order */
.spec .head .pr .sr .width .vendor .flags */
{"%cpu", "%CPU", pr_pcpu, PIDS_extra, 4, BSD, ET|RIGHT}, /*pcpu*/
{"%mem", "%MEM", pr_pmem, PIDS_VM_RSS, 4, BSD, PO|RIGHT}, /*pmem*/
{"_left", "LLLLLLLL", pr_t_left, PIDS_noop, 8, TST, ET|LEFT},
{"_left2", "L2L2L2L2", pr_t_left2, PIDS_noop, 8, TST, ET|LEFT},
{"_right", "RRRRRRRRRRR", pr_t_right, PIDS_noop, 11, TST, ET|RIGHT},
{"_right2", "R2R2R2R2R2R", pr_t_right2, PIDS_noop, 11, TST, ET|RIGHT},
{"_unlimited","U", pr_t_unlimited, PIDS_noop, 16, TST, ET|UNLIMITED},
{"_unlimited2","U2", pr_t_unlimited2, PIDS_noop, 16, TST, ET|UNLIMITED},
{"acflag", "ACFLG", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT}, /*acflg*/
{"acflg", "ACFLG", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*acflag*/
{"addr", "ADDR", pr_nop, PIDS_noop, 4, XXX, AN|RIGHT},
{"addr_1", "ADDR", pr_nop, PIDS_noop, 1, LNX, AN|LEFT},
{"alarm", "ALARM", pr_alarm, PIDS_ALARM, 5, LNX, AN|RIGHT},
{"argc", "ARGC", pr_nop, PIDS_noop, 4, LNX, PO|RIGHT},
{"args", "COMMAND", pr_args, PIDS_CMDLINE, 27, U98, PO|UNLIMITED}, /*command*/
{"atime", "TIME", pr_time, PIDS_TIME_ALL, 8, SOE, ET|RIGHT}, /*cputime*/ /* was 6 wide */
{"blocked", "BLOCKED", pr_sigmask, PIDS_SIGBLOCKED, 9, BSD, TO|SIGNAL},/*sigmask*/
{"bnd", "BND", pr_nop, PIDS_noop, 1, AIX, TO|RIGHT},
{"bsdstart", "START", pr_bsdstart, PIDS_TIME_START, 6, LNX, ET|RIGHT},
{"bsdtime", "TIME", pr_bsdtime, PIDS_TICS_ALL, 6, LNX, ET|RIGHT},
{"c", "C", pr_c, PIDS_extra, 2, SUN, ET|RIGHT},
{"caught", "CAUGHT", pr_sigcatch, PIDS_SIGCATCH, 9, BSD, TO|SIGNAL}, /*sigcatch*/
{"cgname", "CGNAME", pr_cgname, PIDS_CGNAME, 27, LNX, PO|UNLIMITED},
{"cgroup", "CGROUP", pr_cgroup, PIDS_CGROUP, 27, LNX, PO|UNLIMITED},
{"class", "CLS", pr_class, PIDS_SCHED_CLASS, 3, XXX, TO|LEFT},
{"cls", "CLS", pr_class, PIDS_SCHED_CLASS, 3, HPU, TO|RIGHT}, /*says HPUX or RT*/
{"cmaj_flt", "-", pr_nop, PIDS_noop, 1, LNX, AN|RIGHT},
{"cmd", "CMD", pr_args, PIDS_CMDLINE, 27, DEC, PO|UNLIMITED}, /*ucomm*/
{"cmin_flt", "-", pr_nop, PIDS_noop, 1, LNX, AN|RIGHT},
{"cnswap", "-", pr_nop, PIDS_noop, 1, LNX, AN|RIGHT},
{"comm", "COMMAND", pr_comm, PIDS_CMD, 15, U98, PO|UNLIMITED}, /*ucomm*/
{"command", "COMMAND", pr_args, PIDS_CMDLINE, 27, XXX, PO|UNLIMITED}, /*args*/
{"context", "CONTEXT", pr_context, PIDS_ID_TGID, 31, LNX, ET|LEFT},
{"cp", "CP", pr_cp, PIDS_extra, 3, DEC, ET|RIGHT}, /*cpu*/
{"cpu", "CPU", pr_nop, PIDS_noop, 3, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
{"cpuid", "CPUID", pr_psr, PIDS_PROCESSOR, 5, BSD, TO|RIGHT}, // OpenBSD: 8 wide!
{"cputime", "TIME", pr_time, PIDS_TIME_ALL, 8, DEC, ET|RIGHT}, /*time*/
{"ctid", "CTID", pr_nop, PIDS_noop, 5, SUN, ET|RIGHT}, // resource contracts?
{"cursig", "CURSIG", pr_nop, PIDS_noop, 6, DEC, AN|RIGHT},
{"cutime", "-", pr_nop, PIDS_TICS_USER_C, 1, LNX, AN|RIGHT},
{"cwd", "CWD", pr_nop, PIDS_noop, 3, LNX, AN|LEFT},
{"drs", "DRS", pr_drs, PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT},
{"dsiz", "DSIZ", pr_dsiz, PIDS_VSIZE_PGS, 4, LNX, PO|RIGHT},
{"egid", "EGID", pr_egid, PIDS_ID_EGID, 5, LNX, ET|RIGHT},
{"egroup", "EGROUP", pr_egroup, PIDS_ID_EGROUP, 8, LNX, ET|USER},
{"eip", "EIP", pr_eip, PIDS_ADDR_KSTK_EIP, 8, LNX, TO|RIGHT},
{"emul", "EMUL", pr_nop, PIDS_noop, 13, BSD, PO|LEFT}, /* "FreeBSD ELF32" and such */
{"end_code", "E_CODE", pr_nop, PIDS_ADDR_END_CODE, 8, LNx, PO|RIGHT},
{"environ","ENVIRONMENT",pr_nop, PIDS_noop, 11, LNx, PO|UNLIMITED},
{"esp", "ESP", pr_esp, PIDS_ADDR_KSTK_ESP, 8, LNX, TO|RIGHT},
{"etime", "ELAPSED", pr_etime, PIDS_TIME_ELAPSED, 11, U98, ET|RIGHT}, /* was 7 wide */
{"etimes", "ELAPSED", pr_etimes, PIDS_TIME_ELAPSED, 7, BSD, ET|RIGHT}, /* FreeBSD */
{"euid", "EUID", pr_euid, PIDS_ID_EUID, 5, LNX, ET|RIGHT},
{"euser", "EUSER", pr_euser, PIDS_ID_EUSER, 8, LNX, ET|USER},
{"f", "F", pr_flag, PIDS_FLAGS, 1, XXX, ET|RIGHT}, /*flags*/
{"fgid", "FGID", pr_fgid, PIDS_FLAGS, 5, LNX, ET|RIGHT},
{"fgroup", "FGROUP", pr_fgroup, PIDS_ID_FGROUP, 8, LNX, ET|USER},
{"flag", "F", pr_flag, PIDS_FLAGS, 1, DEC, ET|RIGHT},
{"flags", "F", pr_flag, PIDS_FLAGS, 1, BSD, ET|RIGHT}, /*f*/ /* was FLAGS, 8 wide */
{"fname", "COMMAND", pr_fname, PIDS_CMD, 8, SUN, PO|LEFT},
{"fsgid", "FSGID", pr_fgid, PIDS_ID_FGID, 5, LNX, ET|RIGHT},
{"fsgroup", "FSGROUP", pr_fgroup, PIDS_ID_FGROUP, 8, LNX, ET|USER},
{"fsuid", "FSUID", pr_fuid, PIDS_ID_FUID, 5, LNX, ET|RIGHT},
{"fsuser", "FSUSER", pr_fuser, PIDS_ID_FUSER, 8, LNX, ET|USER},
{"fuid", "FUID", pr_fuid, PIDS_ID_FUID, 5, LNX, ET|RIGHT},
{"fuser", "FUSER", pr_fuser, PIDS_ID_FUSER, 8, LNX, ET|USER},
{"gid", "GID", pr_egid, PIDS_ID_EGID, 5, SUN, ET|RIGHT},
{"group", "GROUP", pr_egroup, PIDS_ID_EGROUP, 8, U98, ET|USER},
{"ignored", "IGNORED", pr_sigignore, PIDS_SIGIGNORE, 9, BSD, TO|SIGNAL},/*sigignore*/
{"inblk", "INBLK", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*inblock*/
{"inblock", "INBLK", pr_nop, PIDS_noop, 5, DEC, AN|RIGHT}, /*inblk*/
{"intpri", "PRI", pr_opri, PIDS_PRIORITY, 3, HPU, TO|RIGHT},
{"ipcns", "IPCNS", pr_ipcns, PIDS_NS_IPC, 10, LNX, ET|RIGHT},
{"jid", "JID", pr_nop, PIDS_noop, 1, SGI, PO|RIGHT},
{"jobc", "JOBC", pr_nop, PIDS_noop, 4, XXX, AN|RIGHT},
{"ktrace", "KTRACE", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
{"ktracep", "KTRACEP", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
{"label", "LABEL", pr_context, PIDS_ID_TGID, 31, SGI, ET|LEFT},
{"lastcpu", "C", pr_psr, PIDS_PROCESSOR, 3, BSD, TO|RIGHT}, // DragonFly
{"lim", "LIM", pr_lim, PIDS_RSS_RLIM, 5, BSD, AN|RIGHT},
{"login", "LOGNAME", pr_nop, PIDS_noop, 8, BSD, AN|LEFT}, /*logname*/ /* double check */
{"logname", "LOGNAME", pr_nop, PIDS_noop, 8, XXX, AN|LEFT}, /*login*/
{"longtname", "TTY", pr_tty8, PIDS_TTY_NAME, 8, DEC, PO|LEFT},
{"lsession", "SESSION", pr_sd_session, PIDS_SD_SESS, 11, LNX, ET|LEFT},
{"lstart", "STARTED", pr_lstart, PIDS_TIME_START, 24, XXX, ET|RIGHT},
{"luid", "LUID", pr_nop, PIDS_noop, 5, LNX, ET|RIGHT}, /* login ID */
{"luser", "LUSER", pr_nop, PIDS_noop, 8, LNX, ET|USER}, /* login USER */
{"lwp", "LWP", pr_tasks, PIDS_ID_PID, 5, SUN, TO|PIDMAX|RIGHT},
{"lxc", "LXC", pr_lxcname, PIDS_LXCNAME, 8, LNX, ET|LEFT},
{"m_drs", "DRS", pr_drs, PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
{"m_dt", "DT", pr_nop, PIDS_MEM_DT, 4, LNx, PO|RIGHT},
{"m_lrs", "LRS", pr_nop, PIDS_MEM_LRS, 5, LNx, PO|RIGHT},
{"m_resident", "RES", pr_nop, PIDS_MEM_RES, 5, LNx, PO|RIGHT},
{"m_share", "SHRD", pr_nop, PIDS_MEM_SHR, 5, LNx, PO|RIGHT},
{"m_size", "SIZE", pr_size, PIDS_VSIZE_PGS, 5, LNX, PO|RIGHT},
{"m_swap", "SWAP", pr_nop, PIDS_noop, 5, LNx, PO|RIGHT},
{"m_trs", "TRS", pr_trs, PIDS_VSIZE_PGS, 5, LNx, PO|RIGHT},
{"machine", "MACHINE", pr_sd_machine, PIDS_SD_MACH, 31, LNX, ET|LEFT},
{"maj_flt", "MAJFL", pr_majflt, PIDS_FLT_MAJ, 6, LNX, AN|RIGHT},
{"majflt", "MAJFLT", pr_majflt, PIDS_FLT_MAJ, 6, XXX, AN|RIGHT},
{"min_flt", "MINFL", pr_minflt, PIDS_FLT_MIN, 6, LNX, AN|RIGHT},
{"minflt", "MINFLT", pr_minflt, PIDS_FLT_MIN, 6, XXX, AN|RIGHT},
{"mntns", "MNTNS", pr_mntns, PIDS_NS_MNT, 10, LNX, ET|RIGHT},
{"msgrcv", "MSGRCV", pr_nop, PIDS_noop, 6, XXX, AN|RIGHT},
{"msgsnd", "MSGSND", pr_nop, PIDS_noop, 6, XXX, AN|RIGHT},
{"mwchan", "MWCHAN", pr_nop, PIDS_noop, 6, BSD, TO|WCHAN}, /* mutex (FreeBSD) */
{"netns", "NETNS", pr_netns, PIDS_NS_NET, 10, LNX, ET|RIGHT},
{"ni", "NI", pr_nice, PIDS_NICE, 3, BSD, TO|RIGHT}, /*nice*/
{"nice", "NI", pr_nice, PIDS_NICE, 3, U98, TO|RIGHT}, /*ni*/
{"nivcsw", "IVCSW", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT},
{"nlwp", "NLWP", pr_nlwp, PIDS_NLWP, 4, SUN, PO|RIGHT},
{"nsignals", "NSIGS", pr_nop, PIDS_noop, 5, DEC, AN|RIGHT}, /*nsigs*/
{"nsigs", "NSIGS", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*nsignals*/
{"nswap", "NSWAP", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT},
{"nvcsw", "VCSW", pr_nop, PIDS_noop, 5, XXX, AN|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, PIDS_WCHAN_NAME, 6, XXX, TO|RIGHT},
{"opri", "PRI", pr_opri, PIDS_PRIORITY, 3, SUN, TO|RIGHT},
{"osz", "SZ", pr_nop, PIDS_noop, 2, SUN, PO|RIGHT},
{"oublk", "OUBLK", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT}, /*oublock*/
{"oublock", "OUBLK", pr_nop, PIDS_noop, 5, DEC, AN|RIGHT}, /*oublk*/
{"ouid", "OWNER", pr_sd_ouid, PIDS_SD_OUID, 5, LNX, ET|LEFT},
{"p_ru", "P_RU", pr_nop, PIDS_noop, 6, BSD, AN|RIGHT},
{"paddr", "PADDR", pr_nop, PIDS_noop, 6, BSD, AN|RIGHT},
{"pagein", "PAGEIN", pr_majflt, PIDS_FLT_MAJ, 6, XXX, AN|RIGHT},
{"pcpu", "%CPU", pr_pcpu, PIDS_extra, 4, U98, ET|RIGHT}, /*%cpu*/
{"pending", "PENDING", pr_sig, PIDS_SIGNALS, 9, BSD, ET|SIGNAL}, /*sig*/
{"pgid", "PGID", pr_pgid, PIDS_ID_PGRP, 5, U98, PO|PIDMAX|RIGHT},
{"pgrp", "PGRP", pr_pgid, PIDS_ID_PGRP, 5, LNX, PO|PIDMAX|RIGHT},
{"pid", "PID", pr_procs, PIDS_ID_TGID, 5, U98, PO|PIDMAX|RIGHT},
{"pidns", "PIDNS", pr_pidns, PIDS_NS_PID, 10, LNX, ET|RIGHT},
{"pmem", "%MEM", pr_pmem, PIDS_VM_RSS, 4, XXX, PO|RIGHT}, /* %mem */
{"poip", "-", pr_nop, PIDS_noop, 1, BSD, AN|RIGHT},
{"policy", "POL", pr_class, PIDS_SCHED_CLASS, 3, DEC, TO|LEFT},
{"ppid", "PPID", pr_ppid, PIDS_ID_PPID, 5, U98, PO|PIDMAX|RIGHT},
{"pri", "PRI", pr_pri, PIDS_PRIORITY, 3, XXX, TO|RIGHT},
{"pri_api", "API", pr_pri_api, PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_bar", "BAR", pr_pri_bar, PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_baz", "BAZ", pr_pri_baz, PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"pri_foo", "FOO", pr_pri_foo, PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"priority", "PRI", pr_priority, PIDS_PRIORITY, 3, LNX, TO|RIGHT},
{"prmgrp", "PRMGRP", pr_nop, PIDS_noop, 12, HPU, PO|RIGHT},
{"prmid", "PRMID", pr_nop, PIDS_noop, 12, HPU, PO|RIGHT},
{"project", "PROJECT", pr_nop, PIDS_noop, 12, SUN, PO|LEFT}, // see prm* andctid
{"projid", "PROJID", pr_nop, PIDS_noop, 5, SUN, PO|RIGHT},
{"pset", "PSET", pr_nop, PIDS_noop, 4, DEC, TO|RIGHT},
{"psr", "PSR", pr_psr, PIDS_PROCESSOR, 3, DEC, TO|RIGHT},
{"psxpri", "PPR", pr_nop, PIDS_noop, 3, DEC, TO|RIGHT},
{"re", "RE", pr_nop, PIDS_noop, 3, BSD, AN|RIGHT},
{"resident", "RES", pr_nop, PIDS_MEM_RES, 5, LNX, PO|RIGHT},
{"rgid", "RGID", pr_rgid, PIDS_ID_RGID, 5, XXX, ET|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, PIDS_ID_RGROUP, 8, U98, ET|USER}, /* was 8 wide */
{"rlink", "RLINK", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
{"rss", "RSS", pr_rss, PIDS_VM_RSS, 5, XXX, PO|RIGHT}, /* was 5 wide */
{"rssize", "RSS", pr_rss, PIDS_VM_RSS, 5, DEC, PO|RIGHT}, /*rsz*/
{"rsz", "RSZ", pr_rss, PIDS_VM_RSS, 5, BSD, PO|RIGHT}, /*rssize*/
{"rtprio", "RTPRIO", pr_rtprio, PIDS_RTPRIO, 6, BSD, TO|RIGHT},
{"ruid", "RUID", pr_ruid, PIDS_ID_RUID, 5, XXX, ET|RIGHT},
{"ruser", "RUSER", pr_ruser, PIDS_ID_RUSER, 8, U98, ET|USER},
{"s", "S", pr_s, PIDS_STATE, 1, SUN, TO|LEFT}, /*stat,state*/
{"sched", "SCH", pr_sched, PIDS_SCHED_CLASS, 3, AIX, TO|RIGHT},
{"scnt", "SCNT", pr_nop, PIDS_noop, 4, DEC, AN|RIGHT}, /* man page misspelling of scount? */
{"scount", "SC", pr_nop, PIDS_noop, 4, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
{"seat", "SEAT", pr_sd_seat, PIDS_SD_SEAT, 11, LNX, ET|LEFT},
{"sess", "SESS", pr_sess, PIDS_ID_SESSION, 5, XXX, PO|PIDMAX|RIGHT},
{"session", "SESS", pr_sess, PIDS_ID_SESSION, 5, LNX, PO|PIDMAX|RIGHT},
{"sgi_p", "P", pr_sgi_p, PIDS_STATE, 1, LNX, TO|RIGHT}, /* "cpu" number */
{"sgi_rss", "RSS", pr_rss, PIDS_VM_RSS, 4, LNX, PO|LEFT}, /* SZ:RSS */
{"sgid", "SGID", pr_sgid, PIDS_ID_SGID, 5, LNX, ET|RIGHT},
{"sgroup", "SGROUP", pr_sgroup, PIDS_ID_SGROUP, 8, LNX, ET|USER},
{"share", "-", pr_nop, PIDS_noop, 1, LNX, PO|RIGHT},
{"sid", "SID", pr_sess, PIDS_ID_SESSION, 5, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */
{"sig", "PENDING", pr_sig, PIDS_SIGNALS, 9, XXX, ET|SIGNAL}, /*pending -- Dragonfly uses this for whole-proc and "tsig" for thread */
{"sig_block", "BLOCKED", pr_sigmask, PIDS_SIGBLOCKED, 9, LNX, TO|SIGNAL},
{"sig_catch", "CATCHED", pr_sigcatch, PIDS_SIGCATCH, 9, LNX, TO|SIGNAL},
{"sig_ignore", "IGNORED",pr_sigignore, PIDS_SIGIGNORE, 9, LNX, TO|SIGNAL},
{"sig_pend", "SIGNAL", pr_sig, PIDS_SIGNALS, 9, LNX, ET|SIGNAL},
{"sigcatch", "CAUGHT", pr_sigcatch, PIDS_SIGCATCH, 9, XXX, TO|SIGNAL}, /*caught*/
{"sigignore", "IGNORED", pr_sigignore, PIDS_SIGIGNORE, 9, XXX, TO|SIGNAL}, /*ignored*/
{"sigmask", "BLOCKED", pr_sigmask, PIDS_SIGBLOCKED, 9, XXX, TO|SIGNAL}, /*blocked*/
{"size", "SIZE", pr_swapable, PIDS_VSIZE_PGS, 5, SCO, PO|RIGHT},
{"sl", "SL", pr_nop, PIDS_noop, 3, XXX, AN|RIGHT},
{"slice", "SLICE", pr_sd_slice, PIDS_SD_SLICE, 31, LNX, ET|LEFT},
{"spid", "SPID", pr_tasks, PIDS_ID_PID, 5, SGI, TO|PIDMAX|RIGHT},
{"stackp", "STACKP", pr_stackp, PIDS_ADDR_START_STACK, 8, LNX, PO|RIGHT}, /*start_stack*/
{"start", "STARTED", pr_start, PIDS_TIME_START, 8, XXX, ET|RIGHT},
{"start_code", "S_CODE", pr_nop, PIDS_noop, 8, LNx, PO|RIGHT},
{"start_stack", "STACKP", pr_stackp, PIDS_ADDR_START_STACK, 8, LNX, PO|RIGHT}, /*stackp*/
{"start_time", "START", pr_stime, PIDS_TIME_START, 5, LNx, ET|RIGHT},
{"stat", "STAT", pr_stat, PIDS_STATE, 4, BSD, TO|LEFT}, /*state,s*/
{"state", "S", pr_s, PIDS_STATE, 1, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */
{"status", "STATUS", pr_nop, PIDS_noop, 6, DEC, AN|RIGHT},
{"stime", "STIME", pr_stime, PIDS_TIME_START, 5, XXX, ET|RIGHT}, /* was 6 wide */
{"suid", "SUID", pr_suid, PIDS_ID_SUID, 5, LNx, ET|RIGHT},
{"supgid", "SUPGID", pr_supgid, PIDS_SUPGIDS, 20, LNX, PO|UNLIMITED},
{"supgrp", "SUPGRP", pr_supgrp, PIDS_SUPGROUPS, 40, LNX, PO|UNLIMITED},
{"suser", "SUSER", pr_suser, PIDS_ID_SUSER, 8, LNx, ET|USER},
{"svgid", "SVGID", pr_sgid, PIDS_ID_SGID, 5, XXX, ET|RIGHT},
{"svgroup", "SVGROUP", pr_sgroup, PIDS_ID_SGROUP, 8, LNX, ET|USER},
{"svuid", "SVUID", pr_suid, PIDS_ID_SUID, 5, XXX, ET|RIGHT},
{"svuser", "SVUSER", pr_suser, PIDS_ID_SUSER, 8, LNX, ET|USER},
{"systime", "SYSTEM", pr_nop, PIDS_noop, 6, DEC, ET|RIGHT},
{"sz", "SZ", pr_sz, PIDS_VM_SIZE, 5, HPU, PO|RIGHT},
{"taskid", "TASKID", pr_nop, PIDS_noop, 5, SUN, TO|PIDMAX|RIGHT}, // is this a thread ID?
{"tdev", "TDEV", pr_nop, PIDS_noop, 4, XXX, AN|RIGHT},
{"tgid", "TGID", pr_procs, PIDS_ID_TGID, 5, LNX, PO|PIDMAX|RIGHT},
{"thcount", "THCNT", pr_nlwp, PIDS_NLWP, 5, AIX, PO|RIGHT},
{"tid", "TID", pr_tasks, PIDS_ID_PID, 5, AIX, TO|PIDMAX|RIGHT},
{"time", "TIME", pr_time, PIDS_TIME_ALL, 8, U98, ET|RIGHT}, /*cputime*/ /* was 6 wide */
{"timeout", "TMOUT", pr_nop, PIDS_noop, 5, LNX, AN|RIGHT}, // 2.0.xx era
{"tmout", "TMOUT", pr_nop, PIDS_noop, 5, LNX, AN|RIGHT}, // 2.0.xx era
{"tname", "TTY", pr_tty8, PIDS_TTY_NAME, 8, DEC, PO|LEFT},
{"tpgid", "TPGID", pr_tpgid, PIDS_ID_TPGID, 5, XXX, PO|PIDMAX|RIGHT},
{"trs", "TRS", pr_trs, PIDS_VSIZE_PGS, 4, AIX, PO|RIGHT},
{"trss", "TRSS", pr_trs, PIDS_VSIZE_PGS, 4, BSD, PO|RIGHT}, /* 4.3BSD NET/2 */
{"tsess", "TSESS", pr_nop, PIDS_noop, 5, BSD, PO|PIDMAX|RIGHT},
{"tsession", "TSESS", pr_nop, PIDS_noop, 5, DEC, PO|PIDMAX|RIGHT},
{"tsid", "TSID", pr_nop, PIDS_noop, 5, BSD, PO|PIDMAX|RIGHT},
{"tsig", "PENDING", pr_tsig, PIDS_SIGPENDING, 9, BSD, ET|SIGNAL}, /* Dragonfly used this for thread-specific, and "sig" for whole-proc */
{"tsiz", "TSIZ", pr_tsiz, PIDS_VSIZE_PGS, 4, BSD, PO|RIGHT},
{"tt", "TT", pr_tty8, PIDS_TTY_NAME, 8, BSD, PO|LEFT},
{"tty", "TT", pr_tty8, PIDS_TTY_NAME, 8, U98, PO|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
{"tty4", "TTY", pr_tty4, PIDS_TTY_NAME, 4, LNX, PO|LEFT},
{"tty8", "TTY", pr_tty8, PIDS_TTY_NAME, 8, LNX, PO|LEFT},
{"u_procp", "UPROCP", pr_nop, PIDS_noop, 6, DEC, AN|RIGHT},
{"ucmd", "CMD", pr_comm, PIDS_CMD, 15, DEC, PO|UNLIMITED}, /*ucomm*/
{"ucomm", "COMMAND", pr_comm, PIDS_CMD, 15, XXX, PO|UNLIMITED}, /*comm*/
{"uid", "UID", pr_euid, PIDS_ID_EUID, 5, XXX, ET|RIGHT},
{"uid_hack", "UID", pr_euser, PIDS_ID_EUSER, 8, XXX, ET|USER},
{"umask", "UMASK", pr_nop, PIDS_noop, 5, DEC, AN|RIGHT},
{"uname", "USER", pr_euser, PIDS_ID_EUSER, 8, DEC, ET|USER}, /* man page misspelling of user? */
{"unit", "UNIT", pr_sd_unit, PIDS_SD_UNIT, 31, LNX, ET|LEFT},
{"upr", "UPR", pr_nop, PIDS_noop, 3, BSD, TO|RIGHT}, /*usrpri*/
{"uprocp", "UPROCP", pr_nop, PIDS_noop, 8, BSD, AN|RIGHT},
{"user", "USER", pr_euser, PIDS_ID_EUSER, 8, U98, ET|USER}, /* BSD n forces this to UID */
{"userns", "USERNS", pr_userns, PIDS_NS_USER, 10, LNX, ET|RIGHT},
{"usertime", "USER", pr_nop, PIDS_noop, 4, DEC, ET|RIGHT},
{"usrpri", "UPR", pr_nop, PIDS_noop, 3, DEC, TO|RIGHT}, /*upr*/
{"util", "C", pr_c, PIDS_extra, 2, SGI, ET|RIGHT}, // not sure about "C"
{"utime", "UTIME", pr_nop, PIDS_TICS_USER, 6, LNx, ET|RIGHT},
{"utsns", "UTSNS", pr_utsns, PIDS_NS_UTS, 10, LNX, ET|RIGHT},
{"uunit", "UUNIT", pr_sd_uunit, PIDS_SD_UUNIT, 31, LNX, ET|LEFT},
{"vm_data", "DATA", pr_nop, PIDS_VM_DATA, 5, LNx, PO|RIGHT},
{"vm_exe", "EXE", pr_nop, PIDS_VM_EXE, 5, LNx, PO|RIGHT},
{"vm_lib", "LIB", pr_nop, PIDS_VM_LIB, 5, LNx, PO|RIGHT},
{"vm_lock", "LCK", pr_nop, PIDS_VM_RSS_LOCKED, 3, LNx, PO|RIGHT},
{"vm_stack", "STACK", pr_nop, PIDS_VM_STACK, 5, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, PIDS_VSIZE_PGS, 6, DEC, PO|RIGHT}, /*vsz*/
{"vsz", "VSZ", pr_vsz, PIDS_VM_SIZE, 6, U98, PO|RIGHT}, /*vsize*/
{"wchan", "WCHAN", pr_wchan, PIDS_WCHAN_ADDR, 6, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"wname", "WCHAN", pr_wname, PIDS_WCHAN_NAME, 6, SGI, TO|WCHAN}, /* opposite of nwchan */
{"xstat", "XSTAT", pr_nop, PIDS_noop, 5, BSD, AN|RIGHT},
{"zone", "ZONE", pr_context, PIDS_ID_TGID, 31, SUN, ET|LEFT}, // Solaris zone == Linux context?
{"zoneid", "ZONEID", pr_nop, PIDS_noop, 31, SUN, ET|RIGHT}, // Linux only offers context names
{"~", "-", pr_nop, PIDS_noop, 1, LNX, AN|RIGHT} /* NULL would ruin alphabetical order */
};
#undef USER

View File

@ -317,9 +317,9 @@ static const char *format_parse(sf_node *sfn){
/**************** Parse single sort specifier *******************/
static sort_node *do_one_sort_spec(const char *spec){
const format_struct *fs;
enum pids_sort_order reverse = PROCPS_PIDS_ASCEND;
enum pids_sort_order reverse = PIDS_SORT_ASCEND;
if(*spec == '-'){
reverse = PROCPS_PIDS_DESCEND;
reverse = PIDS_SORT_DESCEND;
spec++;
} else if(*spec == '+'){
spec++;
@ -452,7 +452,7 @@ static const char *verify_short_sort(const char *arg){
/************ parse short sorting option *************/
static const char *short_sort_parse(sf_node *sfn){
enum pids_sort_order direction = PROCPS_PIDS_ASCEND;
enum pids_sort_order direction = PIDS_SORT_ASCEND;
const char *walk;
int tmp;
sort_node *snode;
@ -466,10 +466,10 @@ static const char *short_sort_parse(sf_node *sfn){
already_parsed_sort = 1;
return NULL;
case '+':
direction = PROCPS_PIDS_ASCEND;
direction = PIDS_SORT_ASCEND;
break;
case '-':
direction = PROCPS_PIDS_DESCEND;
direction = PIDS_SORT_DESCEND;
break;
default:
ss = search_shortsort_array(tmp);

22
skill.c
View File

@ -70,12 +70,12 @@ thing##s[thing##_count++] = addme; \
}while(0)
enum pids_item items[] = {
PROCPS_PIDS_ID_PID,
PROCPS_PIDS_ID_EUID,
PROCPS_PIDS_ID_EUSER,
PROCPS_PIDS_TTY,
PROCPS_PIDS_TTY_NAME,
PROCPS_PIDS_CMD};
PIDS_ID_PID,
PIDS_ID_EUID,
PIDS_ID_EUSER,
PIDS_TTY,
PIDS_TTY_NAME,
PIDS_CMD};
enum rel_items {
EU_PID, EU_EUID, EU_EUSER, EU_TTY, EU_TTYNAME, EU_CMD};
@ -164,8 +164,8 @@ static int match_ns(const int pid)
static int ask_user(struct pids_stack *stack)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, stack)
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, stack)
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, stack)
char *buf=NULL;
size_t len=0;
@ -262,8 +262,8 @@ static void show_lists(void)
static void scan_procs(struct run_time_conf_t *run_time)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, reap->stacks[i])
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i])
struct pids_info *info=NULL;
struct pids_fetch *reap;
int i, total_procs;
@ -271,7 +271,7 @@ static void scan_procs(struct run_time_conf_t *run_time)
if (procps_pids_new(&info, items, 6) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create pid info structure"));
if ((reap = procps_pids_reap(info, PROCPS_FETCH_TASKS_ONLY)) == NULL)
if ((reap = procps_pids_reap(info, PIDS_FETCH_TASKS_ONLY)) == NULL)
xerrx(EXIT_FAILURE,
_("Unable to load process information"));

View File

@ -44,7 +44,7 @@
#include "strutils.h"
#include <proc/procps.h>
#define DEFAULT_SORT PROCPS_SLABNODE_OBJS
#define DEFAULT_SORT SLABNODE_OBJS
#define CHAINS_ALLOC 150
#define MAXTBL(t) (int)( sizeof(t) / sizeof(t[0]) )
@ -56,15 +56,15 @@ static int Run_once = 0;
static struct slabinfo_info *Slab_info;
enum slabinfo_item Sort_item = DEFAULT_SORT;
enum slabinfo_sort_order Sort_Order = PROCPS_SLABINFO_DESCEND;
enum slabinfo_sort_order Sort_Order = SLABINFO_SORT_DESCEND;
enum slabinfo_item Node_items[] = {
PROCPS_SLABNODE_OBJS, PROCPS_SLABNODE_AOBJS, PROCPS_SLABNODE_USE,
PROCPS_SLABNODE_OBJ_SIZE, PROCPS_SLABNODE_SLABS, PROCPS_SLABNODE_OBJS_PER_SLAB,
PROCPS_SLABNODE_SIZE, PROCPS_SLABNODE_NAME,
SLABNODE_OBJS, SLABNODE_AOBJS, SLABNODE_USE,
SLABNODE_OBJ_SIZE, SLABNODE_SLABS, SLABNODE_OBJS_PER_SLAB,
SLABNODE_SIZE, SLABNODE_NAME,
/* next 2 are sortable but are not displayable,
thus they need not be represented in the Relative_enums */
PROCPS_SLABNODE_PAGES_PER_SLAB, PROCPS_SLABNODE_ASLABS };
SLABNODE_PAGES_PER_SLAB, SLABNODE_ASLABS };
enum Relative_enums {
my_OBJS, my_AOBJS, my_USE, my_OSIZE,
@ -127,39 +127,39 @@ static void __attribute__((__noreturn__)) usage (FILE *out)
static void set_sort_stuff (const char key)
{
Sort_item = DEFAULT_SORT;
Sort_Order = PROCPS_SLABINFO_DESCEND;
Sort_Order = SLABINFO_SORT_DESCEND;
switch (tolower(key)) {
case 'n':
Sort_item = PROCPS_SLABNODE_NAME;
Sort_Order = PROCPS_SLABINFO_ASCEND;
Sort_item = SLABNODE_NAME;
Sort_Order = SLABINFO_SORT_ASCEND;
break;
case 'o':
Sort_item = PROCPS_SLABNODE_OBJS;
Sort_item = SLABNODE_OBJS;
break;
case 'a':
Sort_item = PROCPS_SLABNODE_AOBJS;
Sort_item = SLABNODE_AOBJS;
break;
case 's':
Sort_item = PROCPS_SLABNODE_OBJ_SIZE;
Sort_item = SLABNODE_OBJ_SIZE;
break;
case 'b':
Sort_item = PROCPS_SLABNODE_OBJS_PER_SLAB;
Sort_item = SLABNODE_OBJS_PER_SLAB;
break;
case 'p':
Sort_item = PROCPS_SLABNODE_PAGES_PER_SLAB;
Sort_item = SLABNODE_PAGES_PER_SLAB;
break;
case 'l':
Sort_item = PROCPS_SLABNODE_SLABS;
Sort_item = SLABNODE_SLABS;
break;
case 'v':
Sort_item = PROCPS_SLABNODE_ASLABS;
Sort_item = SLABNODE_ASLABS;
break;
case 'c':
Sort_item = PROCPS_SLABNODE_SIZE;
Sort_item = SLABNODE_SIZE;
break;
case 'u':
Sort_item = PROCPS_SLABNODE_USE;
Sort_item = SLABNODE_USE;
break;
default:
break;
@ -206,12 +206,12 @@ static void parse_opts (int argc, char **argv)
static void print_summary (void)
{
enum slabinfo_item items[] = {
PROCPS_SLABS_AOBJS, PROCPS_SLABS_OBJS,
PROCPS_SLABS_ASLABS, PROCPS_SLABS_SLABS,
PROCPS_SLABS_ACACHES, PROCPS_SLABS_CACHES,
PROCPS_SLABS_SIZE_ACTIVE, PROCPS_SLABS_SIZE_TOTAL,
PROCPS_SLABS_SIZE_MIN, PROCPS_SLABS_SIZE_AVG,
PROCPS_SLABS_SIZE_MAX
SLABS_AOBJS, SLABS_OBJS,
SLABS_ASLABS, SLABS_SLABS,
SLABS_ACACHES, SLABS_CACHES,
SLABS_SIZE_ACTIVE, SLABS_SIZE_TOTAL,
SLABS_SIZE_MIN, SLABS_SIZE_AVG,
SLABS_SIZE_MAX
};
enum slabs_enums {
stat_AOBJS, stat_OBJS, stat_ASLABS, stat_SLABS,
@ -223,7 +223,7 @@ static void print_summary (void)
if (!(p = procps_slabinfo_select(Slab_info, items, MAXTBL(items))))
xerrx(EXIT_FAILURE, _("Error getting slab summary results"));
/* we really should use the provided PROCPS_SLABINFO_VAL macro but,
/* we really should use the provided SLABINFO_VAL macro but,
let's do this instead to salvage as much original code as possible ... */
stats = p->head;

200
top/top.c
View File

@ -201,14 +201,14 @@ static const char Graph_bars[] = "||||||||||||||||||||||||||||||||||||||||||||||
static struct meminfo_info *Mem_ctx;
static struct meminfo_stack *Mem_stack;
static enum meminfo_item Mem_items[] = {
PROCPS_MEMINFO_MEM_FREE, PROCPS_MEMINFO_MEM_USED, PROCPS_MEMINFO_MEM_TOTAL,
PROCPS_MEMINFO_MEM_CACHED, PROCPS_MEMINFO_MEM_BUFFERS, PROCPS_MEMINFO_MEM_AVAILABLE,
PROCPS_MEMINFO_SWAP_TOTAL, PROCPS_MEMINFO_SWAP_FREE, PROCPS_MEMINFO_SWAP_USED };
MEMINFO_MEM_FREE, MEMINFO_MEM_USED, MEMINFO_MEM_TOTAL,
MEMINFO_MEM_CACHED, MEMINFO_MEM_BUFFERS, MEMINFO_MEM_AVAILABLE,
MEMINFO_SWAP_TOTAL, MEMINFO_SWAP_FREE, MEMINFO_SWAP_USED };
enum Rel_memitems {
mem_FRE, mem_USE, mem_TOT, mem_QUE, mem_BUF, mem_AVL,
swp_TOT, swp_FRE, swp_USE };
// mem stack results extractor macro, where e=rel enum
#define MEM_VAL(e) PROCPS_MEMINFO_VAL(e, ul_int, Mem_stack)
#define MEM_VAL(e) MEMINFO_VAL(e, ul_int, Mem_stack)
// --- <proc/pids.h> --------------------------------------------------
static struct pids_info *Pids_ctx;
static int Pids_itms_cur; // 'current' max (<= Fieldstab)
@ -218,22 +218,22 @@ static struct pids_fetch *Pids_reap; // for reap or select
// pid stack results extractor macro, where e=our EU enum, t=type, s=stack
// ( we'll exploit that <proc/pids.h> provided macro as much as possible )
// ( but many functions use their own unique tailored version for access )
#define PID_VAL(e,t,s) PROCPS_PIDS_VAL(Fieldstab[ e ].erel, t, s)
#define PID_VAL(e,t,s) PIDS_VAL(Fieldstab[ e ].erel, t, s)
// --- <proc/stat.h> --------------------------------------------------
static struct stat_info *Stat_ctx;
static struct stat_reaped *Stat_reap;
static enum stat_item Stat_items[] = {
PROCPS_STAT_TIC_ID, PROCPS_STAT_TIC_NUMA_NODE,
PROCPS_STAT_TIC_DELTA_USER, PROCPS_STAT_TIC_DELTA_SYSTEM,
PROCPS_STAT_TIC_DELTA_NICE, PROCPS_STAT_TIC_DELTA_IDLE,
PROCPS_STAT_TIC_DELTA_IOWAIT, PROCPS_STAT_TIC_DELTA_IRQ,
PROCPS_STAT_TIC_DELTA_SOFTIRQ, PROCPS_STAT_TIC_DELTA_STOLEN };
STAT_TIC_ID, STAT_TIC_NUMA_NODE,
STAT_TIC_DELTA_USER, STAT_TIC_DELTA_SYSTEM,
STAT_TIC_DELTA_NICE, STAT_TIC_DELTA_IDLE,
STAT_TIC_DELTA_IOWAIT, STAT_TIC_DELTA_IRQ,
STAT_TIC_DELTA_SOFTIRQ, STAT_TIC_DELTA_STOLEN };
enum Rel_statitems {
stat_ID, stat_NU, stat_US, stat_SY, stat_NI,
stat_IL, stat_IO, stat_IR, stat_SI, stat_ST };
// cpu/node stack results extractor macros, where e=rel enum, x=index
#define CPU_VAL(e,x) PROCPS_STAT_VAL(e, s_int, Stat_reap->cpus->stacks[x])
#define NOD_VAL(e,x) PROCPS_STAT_VAL(e, s_int, Stat_reap->nodes->stacks[x])
#define CPU_VAL(e,x) STAT_VAL(e, s_int, Stat_reap->cpus->stacks[x])
#define NOD_VAL(e,x) STAT_VAL(e, s_int, Stat_reap->nodes->stacks[x])
/*###### Tiny useful routine(s) ########################################*/
@ -1496,100 +1496,100 @@ static struct {
a 0 width represents columns set once at startup (see zap_fieldstab)
.width .scale .align .erel .item
------ ------ -------- ----- ------------------------- */
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_PID }, // s_int EU_PID
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_PPID }, // s_int EU_PPD
{ 5, -1, A_right, -1, PROCPS_PIDS_ID_EUID }, // u_int EU_UED
{ 8, -1, A_left, -1, PROCPS_PIDS_ID_EUSER }, // str EU_UEN
{ 5, -1, A_right, -1, PROCPS_PIDS_ID_RUID }, // u_int EU_URD
{ 8, -1, A_left, -1, PROCPS_PIDS_ID_RUSER }, // str EU_URN
{ 5, -1, A_right, -1, PROCPS_PIDS_ID_SUID }, // u_int EU_USD
{ 8, -1, A_left, -1, PROCPS_PIDS_ID_SUSER }, // str EU_USN
{ 5, -1, A_right, -1, PROCPS_PIDS_ID_EGID }, // u_int EU_GID
{ 8, -1, A_left, -1, PROCPS_PIDS_ID_EGROUP }, // str EU_GRP
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_PGRP }, // s_int EU_PGD
{ 8, -1, A_left, -1, PROCPS_PIDS_TTY_NAME }, // str EU_TTY
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_TPGID }, // s_int EU_TPG
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_SESSION }, // s_int EU_SID
{ 3, -1, A_right, -1, PROCPS_PIDS_PRIORITY }, // s_int EU_PRI
{ 3, -1, A_right, -1, PROCPS_PIDS_NICE }, // sl_int EU_NCE
{ 3, -1, A_right, -1, PROCPS_PIDS_NLWP }, // s_int EU_THD
{ 0, -1, A_right, -1, PROCPS_PIDS_PROCESSOR }, // u_int EU_CPN
{ 0, -1, A_right, -1, PROCPS_PIDS_TICS_DELTA }, // sl_int EU_CPU
{ 6, -1, A_right, -1, PROCPS_PIDS_TICS_ALL }, // ull_int EU_TME
{ 9, -1, A_right, -1, PROCPS_PIDS_TICS_ALL }, // ull_int EU_TM2
------ ------ -------- ----- ------------------ */
{ 0, -1, A_right, -1, PIDS_ID_PID }, // s_int EU_PID
{ 0, -1, A_right, -1, PIDS_ID_PPID }, // s_int EU_PPD
{ 5, -1, A_right, -1, PIDS_ID_EUID }, // u_int EU_UED
{ 8, -1, A_left, -1, PIDS_ID_EUSER }, // str EU_UEN
{ 5, -1, A_right, -1, PIDS_ID_RUID }, // u_int EU_URD
{ 8, -1, A_left, -1, PIDS_ID_RUSER }, // str EU_URN
{ 5, -1, A_right, -1, PIDS_ID_SUID }, // u_int EU_USD
{ 8, -1, A_left, -1, PIDS_ID_SUSER }, // str EU_USN
{ 5, -1, A_right, -1, PIDS_ID_EGID }, // u_int EU_GID
{ 8, -1, A_left, -1, PIDS_ID_EGROUP }, // str EU_GRP
{ 0, -1, A_right, -1, PIDS_ID_PGRP }, // s_int EU_PGD
{ 8, -1, A_left, -1, PIDS_TTY_NAME }, // str EU_TTY
{ 0, -1, A_right, -1, PIDS_ID_TPGID }, // s_int EU_TPG
{ 0, -1, A_right, -1, PIDS_ID_SESSION }, // s_int EU_SID
{ 3, -1, A_right, -1, PIDS_PRIORITY }, // s_int EU_PRI
{ 3, -1, A_right, -1, PIDS_NICE }, // sl_int EU_NCE
{ 3, -1, A_right, -1, PIDS_NLWP }, // s_int EU_THD
{ 0, -1, A_right, -1, PIDS_PROCESSOR }, // u_int EU_CPN
{ 0, -1, A_right, -1, PIDS_TICS_DELTA }, // sl_int EU_CPU
{ 6, -1, A_right, -1, PIDS_TICS_ALL }, // ull_int EU_TME
{ 9, -1, A_right, -1, PIDS_TICS_ALL }, // ull_int EU_TM2
#ifdef BOOST_PERCNT
{ 5, -1, A_right, -1, PROCPS_PIDS_VM_RSS }, // sl_int EU_MEM
{ 5, -1, A_right, -1, PIDS_VM_RSS }, // sl_int EU_MEM
#else
{ 4, -1, A_right, -1, PROCPS_PIDS_VM_RSS }, // sl_int EU_MEM,
{ 4, -1, A_right, -1, PIDS_VM_RSS }, // sl_int EU_MEM,
#endif
#ifndef NOBOOST_MEMS
{ 7, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_SWAP }, // sl_int EU_SWP
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS }, // sl_int EU_RES
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 7, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
{ 7, SK_Kb, A_right, -1, PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 6, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // sl_int EU_SWP
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS }, // sl_int EU_RES
{ 6, SK_Kb, A_right, -1, PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 7, SK_Kb, A_right, -1, PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 6, SK_Kb, A_right, -1, PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
#else
{ 5, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_SWAP }, // sl_int EU_SWP
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS }, // sl_int EU_RES
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 5, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
{ 5, SK_Kb, A_right, -1, PIDS_MEM_VIRT_KIB }, // sl_int EU_VRT
{ 4, SK_Kb, A_right, -1, PIDS_VM_SWAP }, // sl_int EU_SWP
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS }, // sl_int EU_RES
{ 4, SK_Kb, A_right, -1, PIDS_MEM_CODE_KIB }, // sl_int EU_COD
{ 5, SK_Kb, A_right, -1, PIDS_MEM_DATA_KIB }, // sl_int EU_DAT
{ 4, SK_Kb, A_right, -1, PIDS_MEM_SHR_KIB }, // sl_int EU_SHR
#endif
{ 4, -1, A_right, -1, PROCPS_PIDS_FLT_MAJ }, // sl_int EU_FL1
{ 4, -1, A_right, -1, PROCPS_PIDS_FLT_MIN }, // sl_int EU_FL2
{ 4, -1, A_right, -1, PROCPS_PIDS_MEM_DT }, // sl_int EU_DRT ( always 0 w/ since 2.6 )
{ 1, -1, A_right, -1, PROCPS_PIDS_STATE }, // s_ch EU_STA
{ -1, -1, A_left, -1, PROCPS_PIDS_CMD }, // str EU_CMD
{ 10, -1, A_left, -1, PROCPS_PIDS_WCHAN_NAME }, // str EU_WCH
{ 8, -1, A_left, -1, PROCPS_PIDS_FLAGS }, // ul_int EU_FLG
{ -1, -1, A_left, -1, PROCPS_PIDS_CGROUP }, // str EU_CGR
{ -1, -1, A_left, -1, PROCPS_PIDS_SUPGIDS }, // str EU_SGD
{ -1, -1, A_left, -1, PROCPS_PIDS_SUPGROUPS }, // str EU_SGN
{ 0, -1, A_right, -1, PROCPS_PIDS_ID_TGID }, // s_int EU_TGD
{ 5, -1, A_right, -1, PROCPS_PIDS_OOM_ADJ }, // s_int EU_OOA
{ 4, -1, A_right, -1, PROCPS_PIDS_OOM_SCORE }, // s_int EU_OOM
{ -1, -1, A_left, -1, PROCPS_PIDS_ENVIRON }, // str EU_ENV
{ 3, -1, A_right, -1, PROCPS_PIDS_FLT_MAJ_DELTA }, // sl_int EU_FV1
{ 3, -1, A_right, -1, PROCPS_PIDS_FLT_MIN_DELTA }, // sl_int EU_FV2
{ 4, -1, A_right, -1, PIDS_FLT_MAJ }, // sl_int EU_FL1
{ 4, -1, A_right, -1, PIDS_FLT_MIN }, // sl_int EU_FL2
{ 4, -1, A_right, -1, PIDS_MEM_DT }, // sl_int EU_DRT ( always 0 w/ since 2.6 )
{ 1, -1, A_right, -1, PIDS_STATE }, // s_ch EU_STA
{ -1, -1, A_left, -1, PIDS_CMD }, // str EU_CMD
{ 10, -1, A_left, -1, PIDS_WCHAN_NAME }, // str EU_WCH
{ 8, -1, A_left, -1, PIDS_FLAGS }, // ul_int EU_FLG
{ -1, -1, A_left, -1, PIDS_CGROUP }, // str EU_CGR
{ -1, -1, A_left, -1, PIDS_SUPGIDS }, // str EU_SGD
{ -1, -1, A_left, -1, PIDS_SUPGROUPS }, // str EU_SGN
{ 0, -1, A_right, -1, PIDS_ID_TGID }, // s_int EU_TGD
{ 5, -1, A_right, -1, PIDS_OOM_ADJ }, // s_int EU_OOA
{ 4, -1, A_right, -1, PIDS_OOM_SCORE }, // s_int EU_OOM
{ -1, -1, A_left, -1, PIDS_ENVIRON }, // str EU_ENV
{ 3, -1, A_right, -1, PIDS_FLT_MAJ_DELTA }, // sl_int EU_FV1
{ 3, -1, A_right, -1, PIDS_FLT_MIN_DELTA }, // sl_int EU_FV2
#ifndef NOBOOST_MEMS
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_USED }, // sl_int EU_USE
{ 6, SK_Kb, A_right, -1, PIDS_VM_USED }, // sl_int EU_USE
#else
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_USED }, // sl_int EU_USE
{ 4, SK_Kb, A_right, -1, PIDS_VM_USED }, // sl_int EU_USE
#endif
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_IPC }, // ul_int EU_NS1
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_MNT }, // ul_int EU_NS2
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_NET }, // ul_int EU_NS3
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_PID }, // ul_int EU_NS4
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_USER }, // ul_int EU_NS5
{ 10, -1, A_right, -1, PROCPS_PIDS_NS_UTS }, // ul_int EU_NS6
{ 8, -1, A_left, -1, PROCPS_PIDS_LXCNAME }, // str EU_LXC
{ 10, -1, A_right, -1, PIDS_NS_IPC }, // ul_int EU_NS1
{ 10, -1, A_right, -1, PIDS_NS_MNT }, // ul_int EU_NS2
{ 10, -1, A_right, -1, PIDS_NS_NET }, // ul_int EU_NS3
{ 10, -1, A_right, -1, PIDS_NS_PID }, // ul_int EU_NS4
{ 10, -1, A_right, -1, PIDS_NS_USER }, // ul_int EU_NS5
{ 10, -1, A_right, -1, PIDS_NS_UTS }, // ul_int EU_NS6
{ 8, -1, A_left, -1, PIDS_LXCNAME }, // str EU_LXC
#ifndef NOBOOST_MEMS
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 6, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 6, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
#else
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 4, SK_Kb, A_right, -1, PROCPS_PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_ANON }, // sl_int EU_RZA
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_FILE }, // sl_int EU_RZF
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_LOCKED }, // sl_int EU_RZL
{ 4, SK_Kb, A_right, -1, PIDS_VM_RSS_SHARED }, // sl_int EU_RZS
#endif
{ -1, -1, A_left, -1, PROCPS_PIDS_CGNAME }, // str EU_CGN
#define eu_LAST EU_CGN // ( the last real pflag, currently )
// xtra Fieldstab 'pseudo pflag' entries for the newlib interface . . . ----------------------------------
{ -1, -1, A_left, -1, PIDS_CGNAME }, // str EU_CGN
#define eu_LAST EU_CGN
// xtra Fieldstab 'pseudo pflag' entries for the newlib interface . . . . . . .
#define eu_CMDLINE eu_LAST +1
#define eu_TICS_ALL_C eu_LAST +2
#define eu_TIME_START eu_LAST +3
#define eu_ID_FUID eu_LAST +4
#define eu_XTRA eu_LAST +5
{ -1, -1, -1, -1, PROCPS_PIDS_CMDLINE }, // str ( if Show_CMDLIN )
{ -1, -1, -1, -1, PROCPS_PIDS_TICS_ALL_C }, // ull_int ( if Show_CTIMES )
{ -1, -1, -1, -1, PROCPS_PIDS_TIME_START }, // ull_int ( if Show_FOREST )
{ -1, -1, -1, -1, PROCPS_PIDS_ID_FUID }, // u_int ( if a usrseltyp )
{ -1, -1, -1, -1, PROCPS_PIDS_extra } // u_int ( if Show_FOREST )
{ -1, -1, -1, -1, PIDS_CMDLINE }, // str ( if Show_CMDLIN )
{ -1, -1, -1, -1, PIDS_TICS_ALL_C }, // ull_int ( if Show_CTIMES )
{ -1, -1, -1, -1, PIDS_TIME_START }, // ull_int ( if Show_FOREST )
{ -1, -1, -1, -1, PIDS_ID_FUID }, // u_int ( if a usrseltyp )
{ -1, -1, -1, -1, PIDS_extra } // u_int ( if Show_FOREST )
#undef A_left
#undef A_right
};
@ -2207,8 +2207,8 @@ static void procs_refresh (void) {
// if in Solaris mode, adjust our scaling for all cpus
Frame_etscale = 100.0f / ((float)Hertz * (float)et * (Rc.mode_irixps ? 1 : Cpu_cnt));
if (Monpidsidx) Pids_reap = procps_pids_select(Pids_ctx, Monpids, Monpidsidx, PROCPS_SELECT_PID);
else Pids_reap = procps_pids_reap(Pids_ctx, Thread_mode ? PROCPS_FETCH_THREADS_TOO : PROCPS_FETCH_TASKS_ONLY);
if (Monpidsidx) Pids_reap = procps_pids_select(Pids_ctx, Monpids, Monpidsidx, PIDS_SELECT_PID);
else Pids_reap = procps_pids_reap(Pids_ctx, Thread_mode ? PIDS_FETCH_THREADS_TOO : PIDS_FETCH_TASKS_ONLY);
if (!Pids_reap)
error_exit(fmtmk(N_fmt(LIB_errorpid_fmt),__LINE__));
@ -2845,7 +2845,7 @@ static void before (char *me) {
// establish max depth for newlib pids stack (# of result structs)
Pids_itms = alloc_c(sizeof(enum pids_item) * MAXTBL(Fieldstab));
for (i = 0; i < MAXTBL(Fieldstab); i++)
Pids_itms[i] = PROCPS_PIDS_noop;
Pids_itms[i] = PIDS_noop;
Pids_itms_cur = i;
// we will identify specific items in the build_headers() function
if (procps_pids_new(&Pids_ctx, Pids_itms, Pids_itms_cur))
@ -4491,7 +4491,7 @@ static void forest_begin (WIN_t *q) {
}
#ifndef TREE_SCANALL
if (!(procps_pids_sort(Pids_ctx, Seed_ppt, PIDSmaxt
, PROCPS_PIDS_TIME_START, PROCPS_PIDS_ASCEND)))
, PIDS_TIME_START, PIDS_SORT_ASCEND)))
error_exit(fmtmk(N_fmt(LIB_errorpid_fmt),__LINE__));
#endif
for (i = 0; i < PIDSmaxt; i++) // avoid any hidepid distortions
@ -4609,7 +4609,7 @@ all_done:
* display and thus requiring the cpu summary toggle */
static void summary_hlp (struct stat_stack *this, const char *pfx) {
// a tailored 'results stack value' extractor macro
#define rSv(E) PROCPS_STAT_VAL(E, sl_int, this)
#define rSv(E) STAT_VAL(E, sl_int, this)
SIC_t u_frme, s_frme, n_frme, i_frme, w_frme, x_frme, y_frme, z_frme, tot_frme;
float scale;
@ -4702,7 +4702,7 @@ numa_oops:
// display each cpu node's states
for (i = 0; i < Numa_node_tot; i++) {
struct stat_stack *nod_ptr = Stat_reap->nodes->stacks[i];
if (NOD_VAL(stat_ID, i) == PROCPS_STAT_NODE_INVALID) continue;
if (NOD_VAL(stat_ID, i) == STAT_NODE_INVALID) continue;
if (!isROOM(anyFLG, 1)) break;
snprintf(tmp, sizeof(tmp), N_fmt(NUMA_nodenam_fmt), NOD_VAL(stat_ID, i));
summary_hlp(nod_ptr, tmp);
@ -5045,7 +5045,7 @@ static const char *task_show (const WIN_t *q, struct pids_stack *p) {
static int window_show (WIN_t *q, int wmax) {
#define sORDER CHKw(q, Qsrt_NORMAL) ? PROCPS_PIDS_DESCEND : PROCPS_PIDS_ASCEND
#define sORDER CHKw(q, Qsrt_NORMAL) ? PIDS_SORT_DESCEND : PIDS_SORT_ASCEND
/* the isBUSY macro determines if a task is 'active' --
it returns true if some cpu was used since the last sample.
( actual 'running' tasks will be a subset of those selected ) */
@ -5060,10 +5060,10 @@ static int window_show (WIN_t *q, int wmax) {
forest_begin(q);
else {
enum pids_item item = Fieldstab[q->rc.sortindx].item;
if (item == PROCPS_PIDS_CMD && CHKw(q, Show_CMDLIN))
item = PROCPS_PIDS_CMDLINE;
else if (item == PROCPS_PIDS_TICS_ALL && CHKw(q, Show_CTIMES))
item = PROCPS_PIDS_TICS_ALL_C;
if (item == PIDS_CMD && CHKw(q, Show_CMDLIN))
item = PIDS_CMDLINE;
else if (item == PIDS_TICS_ALL && CHKw(q, Show_CTIMES))
item = PIDS_TICS_ALL_C;
if (!(procps_pids_sort(Pids_ctx, q->ppt , PIDSmaxt, item, sORDER)))
error_exit(fmtmk(N_fmt(LIB_errorpid_fmt),__LINE__));
}

237
vmstat.c
View File

@ -85,32 +85,32 @@ static unsigned int height;
static unsigned int moreheaders = TRUE;
static enum stat_item First_stat_items[] = {
PROCPS_STAT_SYS_PROC_RUNNING,
PROCPS_STAT_SYS_PROC_BLOCKED,
PROCPS_STAT_SYS_INTERRUPTS,
PROCPS_STAT_SYS_CTX_SWITCHES,
PROCPS_STAT_TIC_USER,
PROCPS_STAT_TIC_NICE,
PROCPS_STAT_TIC_SYSTEM,
PROCPS_STAT_TIC_IRQ,
PROCPS_STAT_TIC_SOFTIRQ,
PROCPS_STAT_TIC_IDLE,
PROCPS_STAT_TIC_IOWAIT,
PROCPS_STAT_TIC_STOLEN
STAT_SYS_PROC_RUNNING,
STAT_SYS_PROC_BLOCKED,
STAT_SYS_INTERRUPTS,
STAT_SYS_CTX_SWITCHES,
STAT_TIC_USER,
STAT_TIC_NICE,
STAT_TIC_SYSTEM,
STAT_TIC_IRQ,
STAT_TIC_SOFTIRQ,
STAT_TIC_IDLE,
STAT_TIC_IOWAIT,
STAT_TIC_STOLEN
};
static enum stat_item Loop_stat_items[] = {
PROCPS_STAT_SYS_PROC_RUNNING,
PROCPS_STAT_SYS_PROC_BLOCKED,
PROCPS_STAT_SYS_DELTA_INTERRUPTS,
PROCPS_STAT_SYS_DELTA_CTX_SWITCHES,
PROCPS_STAT_TIC_DELTA_USER,
PROCPS_STAT_TIC_DELTA_NICE,
PROCPS_STAT_TIC_DELTA_SYSTEM,
PROCPS_STAT_TIC_DELTA_IRQ,
PROCPS_STAT_TIC_DELTA_SOFTIRQ,
PROCPS_STAT_TIC_DELTA_IDLE,
PROCPS_STAT_TIC_DELTA_IOWAIT,
PROCPS_STAT_TIC_DELTA_STOLEN
STAT_SYS_PROC_RUNNING,
STAT_SYS_PROC_BLOCKED,
STAT_SYS_DELTA_INTERRUPTS,
STAT_SYS_DELTA_CTX_SWITCHES,
STAT_TIC_DELTA_USER,
STAT_TIC_DELTA_NICE,
STAT_TIC_DELTA_SYSTEM,
STAT_TIC_DELTA_IRQ,
STAT_TIC_DELTA_SOFTIRQ,
STAT_TIC_DELTA_IDLE,
STAT_TIC_DELTA_IOWAIT,
STAT_TIC_DELTA_STOLEN
};
enum Rel_statitems {
stat_PRU, stat_PBL, stat_INT, stat_CTX,
@ -119,31 +119,31 @@ enum Rel_statitems {
};
static enum meminfo_item Mem_items[] = {
PROCPS_MEMINFO_SWAP_USED,
PROCPS_MEMINFO_MEM_FREE,
PROCPS_MEMINFO_MEM_ACTIVE,
PROCPS_MEMINFO_MEM_INACTIVE,
PROCPS_MEMINFO_MEM_BUFFERS,
PROCPS_MEMINFO_MEM_CACHED
MEMINFO_SWAP_USED,
MEMINFO_MEM_FREE,
MEMINFO_MEM_ACTIVE,
MEMINFO_MEM_INACTIVE,
MEMINFO_MEM_BUFFERS,
MEMINFO_MEM_CACHED
};
enum Rel_memitems {
mem_SUS, mem_FREE, mem_ACT, mem_INA, mem_BUF, mem_CAC, MAX_mem
};
static enum diskstats_item Disk_items[] = {
PROCPS_DISKSTATS_TYPE,
PROCPS_DISKSTATS_NAME,
PROCPS_DISKSTATS_READS,
PROCPS_DISKSTATS_READS_MERGED,
PROCPS_DISKSTATS_READ_SECTORS,
PROCPS_DISKSTATS_READ_TIME,
PROCPS_DISKSTATS_WRITES,
PROCPS_DISKSTATS_WRITES_MERGED,
PROCPS_DISKSTATS_WRITE_SECTORS,
PROCPS_DISKSTATS_WRITE_TIME,
PROCPS_DISKSTATS_IO_INPROGRESS,
PROCPS_DISKSTATS_IO_TIME,
PROCPS_DISKSTATS_IO_WTIME
DISKSTATS_TYPE,
DISKSTATS_NAME,
DISKSTATS_READS,
DISKSTATS_READS_MERGED,
DISKSTATS_READ_SECTORS,
DISKSTATS_READ_TIME,
DISKSTATS_WRITES,
DISKSTATS_WRITES_MERGED,
DISKSTATS_WRITE_SECTORS,
DISKSTATS_WRITE_TIME,
DISKSTATS_IO_INPROGRESS,
DISKSTATS_IO_TIME,
DISKSTATS_IO_WTIME
};
enum Rel_diskitems {
disk_TYPE, disk_NAME,
@ -153,30 +153,30 @@ enum Rel_diskitems {
};
static enum diskstats_item Part_items[] = {
PROCPS_DISKSTATS_READS,
PROCPS_DISKSTATS_READ_SECTORS,
PROCPS_DISKSTATS_WRITES,
PROCPS_DISKSTATS_WRITE_SECTORS
DISKSTATS_READS,
DISKSTATS_READ_SECTORS,
DISKSTATS_WRITES,
DISKSTATS_WRITE_SECTORS
};
enum Rel_partitems {
part_READ, part_READ_SECT, part_WRITE, part_WRITE_SECT, MAX_part
};
static enum stat_item Sum_stat_items[] = {
PROCPS_STAT_TIC_USER,
PROCPS_STAT_TIC_NICE,
PROCPS_STAT_TIC_SYSTEM,
PROCPS_STAT_TIC_IDLE,
PROCPS_STAT_TIC_IOWAIT,
PROCPS_STAT_TIC_IRQ,
PROCPS_STAT_TIC_SOFTIRQ,
PROCPS_STAT_TIC_STOLEN,
PROCPS_STAT_TIC_GUEST,
PROCPS_STAT_TIC_GUEST_NICE,
PROCPS_STAT_SYS_CTX_SWITCHES,
PROCPS_STAT_SYS_INTERRUPTS,
PROCPS_STAT_SYS_TIME_OF_BOOT,
PROCPS_STAT_SYS_PROC_CREATED
STAT_TIC_USER,
STAT_TIC_NICE,
STAT_TIC_SYSTEM,
STAT_TIC_IDLE,
STAT_TIC_IOWAIT,
STAT_TIC_IRQ,
STAT_TIC_SOFTIRQ,
STAT_TIC_STOLEN,
STAT_TIC_GUEST,
STAT_TIC_GUEST_NICE,
STAT_SYS_CTX_SWITCHES,
STAT_SYS_INTERRUPTS,
STAT_SYS_TIME_OF_BOOT,
STAT_SYS_PROC_CREATED
};
enum Rel_sumstatitems {
sstat_USR, sstat_NIC, sstat_SYS, sstat_IDL, sstat_IOW, sstat_IRQ,
@ -185,16 +185,16 @@ enum Rel_sumstatitems {
};
static enum meminfo_item Sum_mem_items[] = {
PROCPS_MEMINFO_MEM_TOTAL,
PROCPS_MEMINFO_MEM_USED,
PROCPS_MEMINFO_MEM_ACTIVE,
PROCPS_MEMINFO_MEM_INACTIVE,
PROCPS_MEMINFO_MEM_FREE,
PROCPS_MEMINFO_MEM_BUFFERS,
PROCPS_MEMINFO_MEM_CACHED,
PROCPS_MEMINFO_SWAP_TOTAL,
PROCPS_MEMINFO_SWAP_USED,
PROCPS_MEMINFO_SWAP_FREE,
MEMINFO_MEM_TOTAL,
MEMINFO_MEM_USED,
MEMINFO_MEM_ACTIVE,
MEMINFO_MEM_INACTIVE,
MEMINFO_MEM_FREE,
MEMINFO_MEM_BUFFERS,
MEMINFO_MEM_CACHED,
MEMINFO_SWAP_TOTAL,
MEMINFO_SWAP_USED,
MEMINFO_SWAP_FREE,
};
enum Rel_summemitems {
smem_MTOT, smem_MUSE, smem_MACT, smem_MIAC, smem_MFRE,
@ -323,11 +323,11 @@ static unsigned long unitConvert(unsigned long size)
static void new_format(void)
{
#define TICv(E) PROCPS_STAT_VAL(E, ull_int, stat_stack)
#define DTICv(E) PROCPS_STAT_VAL(E, sl_int, stat_stack)
#define SYSv(E) PROCPS_STAT_VAL(E, ul_int, stat_stack)
#define MEMv(E) PROCPS_STAT_VAL(E, ul_int, mem_stack)
#define DSYSv(E) PROCPS_STAT_VAL(E, s_int, stat_stack)
#define TICv(E) STAT_VAL(E, ull_int, stat_stack)
#define DTICv(E) STAT_VAL(E, sl_int, stat_stack)
#define SYSv(E) STAT_VAL(E, ul_int, stat_stack)
#define MEMv(E) STAT_VAL(E, ul_int, mem_stack)
#define DSYSv(E) STAT_VAL(E, s_int, stat_stack)
const char format[] =
"%2lu %2lu %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u";
const char wide_format[] =
@ -346,7 +346,7 @@ static void new_format(void)
time_t the_time;
char timebuf[32];
struct vmstat_info *vm_info = NULL;
struct stat_info *sys_info = NULL;
struct stat_info *stat_info = NULL;
struct stat_stack *stat_stack;
struct meminfo_info *mem_info = NULL;
struct meminfo_stack *mem_stack;
@ -355,10 +355,9 @@ static void new_format(void)
hz = procps_hertz_get();
new_header();
if (procps_vmstat_new(&vm_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create vmstat structure"));
if (procps_stat_new(&sys_info) < 0)
if (procps_stat_new(&stat_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create system stat structure"));
if (procps_meminfo_new(&mem_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create meminfo structure"));
@ -369,7 +368,7 @@ static void new_format(void)
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
}
/* Do the initial fill */
if (!(stat_stack = procps_stat_select(sys_info, First_stat_items, MAX_stat)))
if (!(stat_stack = procps_stat_select(stat_info, First_stat_items, MAX_stat)))
xerrx(EXIT_FAILURE, _("Unable to select stat information"));
cpu_use = TICv(stat_USR) + TICv(stat_NIC);
cpu_sys = TICv(stat_SYS) + TICv(stat_IRQ) + TICv(stat_SRQ);
@ -377,10 +376,10 @@ static void new_format(void)
cpu_iow = TICv(stat_IOW);
cpu_sto = TICv(stat_STO);
pgpgin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int);
pswpout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int);
pgpgin[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int);
pswpout[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int);
if (!(mem_stack = procps_meminfo_select(mem_info, Mem_items, MAX_mem)))
xerrx(EXIT_FAILURE, _("Unable to select memory information"));
@ -399,10 +398,10 @@ static void new_format(void)
unitConvert(MEMv(mem_FREE)),
unitConvert((a_option?MEMv(mem_INA):MEMv(mem_BUF))),
unitConvert((a_option?MEMv(mem_ACT):MEMv(mem_CAC))),
(unsigned)( (unitConvert(PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (unitConvert(PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int) * hz + divo2) / Div ),
(unsigned)( (PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int) * hz + divo2) / Div ),
(unsigned)( (unitConvert(VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (unitConvert(VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int) * kb_per_page) * hz + divo2) / Div ),
(unsigned)( (VMSTAT_GET(vm_info, VMSTAT_PGPGIN, ul_int) * hz + divo2) / Div ),
(unsigned)( (VMSTAT_GET(vm_info, VMSTAT_PGPGOUT, ul_int) * hz + divo2) / Div ),
(unsigned)( (SYSv(stat_INT) * hz + divo2) / Div ),
(unsigned)( (SYSv(stat_CTX) * hz + divo2) / Div ),
(unsigned)( (100*cpu_use + divo2) / Div ),
@ -425,7 +424,7 @@ static void new_format(void)
new_header();
tog = !tog;
if (!(stat_stack = procps_stat_select(sys_info, Loop_stat_items, MAX_stat)))
if (!(stat_stack = procps_stat_select(stat_info, Loop_stat_items, MAX_stat)))
xerrx(EXIT_FAILURE, _("Unable to select stat information"));
cpu_use = DTICv(stat_USR) + DTICv(stat_NIC);
@ -433,10 +432,10 @@ static void new_format(void)
cpu_idl = DTICv(stat_IDL);
cpu_iow = DTICv(stat_IOW);
cpu_sto = DTICv(stat_STO);
pgpgin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int);
pswpout[tog] = PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int);
pgpgin[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGIN, ul_int);
pgpgout[tog] = VMSTAT_GET(vm_info, VMSTAT_PGPGOUT, ul_int);
pswpin[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int);
pswpout[tog] = VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int);
if (t_option) {
(void) time( &the_time );
@ -495,7 +494,7 @@ static void new_format(void)
printf("\n");
}
/* Cleanup */
procps_stat_unref(&sys_info);
procps_stat_unref(&stat_info);
procps_vmstat_unref(&vm_info);
procps_meminfo_unref(&mem_info);
#undef TICv
@ -529,7 +528,7 @@ static void diskpartition_header(const char *partition_name)
static void diskpartition_format(const char *partition_name)
{
#define partVAL(x) PROCPS_DISKSTATS_VAL(x, ul_int, stack)
#define partVAL(x) DISKSTATS_VAL(x, ul_int, stack)
struct diskstats_info *disk_stat;
struct diskstats_stack *stack;
struct diskstats_result *got;
@ -540,7 +539,7 @@ static void diskpartition_format(const char *partition_name)
xerr(EXIT_FAILURE,
_("Unable to create diskstat structure"));
if (!(got = procps_diskstats_get(disk_stat, partition_name, PROCPS_DISKSTATS_TYPE)))
if (!(got = procps_diskstats_get(disk_stat, partition_name, DISKSTATS_TYPE)))
xerrx(EXIT_FAILURE, _("Disk/Partition %s not found"), partition_name);
diskpartition_header(partition_name);
@ -627,7 +626,7 @@ static void diskheader(void)
static void diskformat(void)
{
#define diskVAL(e,t) PROCPS_DISKSTATS_VAL(e, t, reap->stacks[j])
#define diskVAL(e,t) DISKSTATS_VAL(e, t, reap->stacks[j])
struct diskstats_info *disk_stat;
struct diskstats_reap *reap;
int i, j;
@ -654,7 +653,7 @@ static void diskformat(void)
strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm_ptr);
}
for (j = 0; j < reap->total; j++) {
if (diskVAL(disk_TYPE, s_int) != PROCPS_DISKSTATS_TYPE_DISK)
if (diskVAL(disk_TYPE, s_int) != DISKSTATS_TYPE_DISK)
continue; /* not a disk */
if (moreheaders && ((j % height) == 0))
diskheader();
@ -708,9 +707,9 @@ static void slabformat (void)
struct slabinfo_reap *reaped;
int i, j;
enum slabinfo_item node_items[] = {
PROCPS_SLABNODE_AOBJS, PROCPS_SLABNODE_OBJS,
PROCPS_SLABNODE_OBJ_SIZE, PROCPS_SLABNODE_OBJS_PER_SLAB,
PROCPS_SLABNODE_NAME };
SLABNODE_AOBJS, SLABNODE_OBJS,
SLABNODE_OBJ_SIZE, SLABNODE_OBJS_PER_SLAB,
SLABNODE_NAME };
enum rel_enums {
slab_AOBJS, slab_OBJS, slab_OSIZE, slab_OPS, slab_NAME };
@ -723,7 +722,7 @@ static void slabformat (void)
for (i = 0; infinite_updates || i < num_updates; i++) {
if (!(reaped = procps_slabinfo_reap(slab_info, node_items, MAX_ITEMS)))
xerrx(EXIT_FAILURE, _("Unable to get slabinfo node data"));
if (!(procps_slabinfo_sort(slab_info, reaped->stacks, reaped->total, PROCPS_SLABNODE_NAME, PROCPS_SLABINFO_ASCEND)))
if (!(procps_slabinfo_sort(slab_info, reaped->stacks, reaped->total, SLABNODE_NAME, SLABINFO_SORT_ASCEND)))
xerrx(EXIT_FAILURE, _("Unable to sort slab nodes"));
for (j = 0; j < reaped->total; j++) {
@ -746,7 +745,7 @@ static void slabformat (void)
static void disksum_format(void)
{
#define diskVAL(e,t) PROCPS_DISKSTATS_VAL(e, t, reap->stacks[j])
#define diskVAL(e,t) DISKSTATS_VAL(e, t, reap->stacks[j])
struct diskstats_info *disk_stat;
struct diskstats_reap *reap;
int j, disk_count, part_count;
@ -767,7 +766,7 @@ static void disksum_format(void)
_("Unable to retrieve disk statistics"));
for (j = 0; j < reap->total; j++) {
if (diskVAL(disk_TYPE, s_int) != PROCPS_DISKSTATS_TYPE_DISK) {
if (diskVAL(disk_TYPE, s_int) != DISKSTATS_TYPE_DISK) {
part_count++;
continue; /* not a disk */
}
@ -805,18 +804,18 @@ static void disksum_format(void)
static void sum_format(void)
{
#define TICv(E) PROCPS_STAT_VAL(E, ull_int, stat_stack)
#define SYSv(E) PROCPS_STAT_VAL(E, ul_int, stat_stack)
#define MEMv(E) unitConvert(PROCPS_STAT_VAL(E, ul_int, mem_stack))
struct stat_info *sys_info = NULL;
#define TICv(E) STAT_VAL(E, ull_int, stat_stack)
#define SYSv(E) STAT_VAL(E, ul_int, stat_stack)
#define MEMv(E) unitConvert(STAT_VAL(E, ul_int, mem_stack))
struct stat_info *stat_info = NULL;
struct vmstat_info *vm_info = NULL;
struct meminfo_info *mem_info = NULL;
struct stat_stack *stat_stack;
struct meminfo_stack *mem_stack;
if (procps_stat_new(&sys_info) < 0)
if (procps_stat_new(&stat_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create system stat structure"));
if (!(stat_stack = procps_stat_select(sys_info, Sum_stat_items, 14)))
if (!(stat_stack = procps_stat_select(stat_info, Sum_stat_items, 14)))
xerrx(EXIT_FAILURE, _("Unable to select stat information"));
if (procps_vmstat_new(&vm_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create vmstat structure"));
@ -845,17 +844,17 @@ static void sum_format(void)
printf(_("%13lld stolen cpu ticks\n"), TICv(sstat_STO));
printf(_("%13lld non-nice guest cpu ticks\n"), TICv(sstat_GST));
printf(_("%13lld nice guest cpu ticks\n"), TICv(sstat_GNI));
printf(_("%13lu pages paged in\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGIN, ul_int));
printf(_("%13lu pages paged out\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PGPGOUT, ul_int));
printf(_("%13lu pages swapped in\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPIN, ul_int));
printf(_("%13lu pages swapped out\n"), PROCPS_VMSTAT_GET(vm_info, PROCPS_VMSTAT_PSWPOUT, ul_int));
printf(_("%13lu pages paged in\n"), VMSTAT_GET(vm_info, VMSTAT_PGPGIN, ul_int));
printf(_("%13lu pages paged out\n"), VMSTAT_GET(vm_info, VMSTAT_PGPGOUT, ul_int));
printf(_("%13lu pages swapped in\n"), VMSTAT_GET(vm_info, VMSTAT_PSWPIN, ul_int));
printf(_("%13lu pages swapped out\n"), VMSTAT_GET(vm_info, VMSTAT_PSWPOUT, ul_int));
printf(_("%13lu interrupts\n"), SYSv(sstat_INT));
printf(_("%13lu CPU context switches\n"), SYSv(sstat_CTX));
printf(_("%13lu boot time\n"), SYSv(sstat_TOB));
printf(_("%13lu forks\n"), SYSv(sstat_PCR));
/* Cleanup */
procps_stat_unref(&sys_info);
procps_stat_unref(&stat_info);
procps_vmstat_unref(&vm_info);
procps_meminfo_unref(&mem_info);
#undef TICv
@ -865,14 +864,14 @@ static void sum_format(void)
static void fork_format(void)
{
struct stat_info *sys_info = NULL;
struct stat_info *stat_info = NULL;
if (procps_stat_new(&sys_info) < 0)
if (procps_stat_new(&stat_info) < 0)
xerrx(EXIT_FAILURE, _("Unable to create system stat structure"));
printf(_("%13lu forks\n"), PROCPS_STAT_GET(sys_info, PROCPS_STAT_SYS_PROC_CREATED, ul_int));
printf(_("%13lu forks\n"), STAT_GET(stat_info, STAT_SYS_PROC_CREATED, ul_int));
/* Cleanup */
procps_stat_unref(&sys_info);
procps_stat_unref(&stat_info);
}
static int winhi(void)

28
w.c
View File

@ -343,9 +343,9 @@ static int find_best_proc(
unsigned long long *restrict const pcpu,
char *cmdline)
{
#define PIDS_GETINT(e) PROCPS_PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETULL(e) PROCPS_PIDS_VAL(EU_ ## e, ull_int, reap->stacks[i])
#define PIDS_GETSTR(e) PROCPS_PIDS_VAL(EU_ ## e, str, reap->stacks[i])
#define PIDS_GETINT(e) PIDS_VAL(EU_ ## e, s_int, reap->stacks[i])
#define PIDS_GETULL(e) PIDS_VAL(EU_ ## e, ull_int, reap->stacks[i])
#define PIDS_GETSTR(e) PIDS_VAL(EU_ ## e, str, reap->stacks[i])
unsigned uid = ~0U;
int found_utpid = 0;
int i, total_procs, line;
@ -355,15 +355,15 @@ static int find_best_proc(
struct pids_info *info=NULL;
struct pids_fetch *reap;
enum pids_item items[] = {
PROCPS_PIDS_ID_TGID,
PROCPS_PIDS_TIME_START,
PROCPS_PIDS_ID_EUID,
PROCPS_PIDS_ID_RUID,
PROCPS_PIDS_ID_TPGID,
PROCPS_PIDS_ID_PGRP,
PROCPS_PIDS_TTY,
PROCPS_PIDS_TICS_ALL,
PROCPS_PIDS_CMDLINE};
PIDS_ID_TGID,
PIDS_TIME_START,
PIDS_ID_EUID,
PIDS_ID_RUID,
PIDS_ID_TPGID,
PIDS_ID_PGRP,
PIDS_TTY,
PIDS_TICS_ALL,
PIDS_CMDLINE};
enum rel_items {
EU_TGID, EU_START, EU_EUID, EU_RUID, EU_TPGID, EU_PGRP, EU_TTY,
EU_TICS_ALL, EU_CMDLINE};
@ -386,7 +386,7 @@ static int find_best_proc(
if (procps_pids_new(&info, items, 9) < 0)
xerrx(EXIT_FAILURE,
_("Unable to create pid info structure"));
if ((reap = procps_pids_reap(info, PROCPS_FETCH_TASKS_ONLY)) == NULL)
if ((reap = procps_pids_reap(info, PIDS_FETCH_TASKS_ONLY)) == NULL)
xerrx(EXIT_FAILURE,
_("Unable to load process information"));
total_procs = reap->counts->total;
@ -404,7 +404,7 @@ static int find_best_proc(
}
if (PIDS_GETINT(TTY) != line)
continue;
(*jcpu) += PROCPS_PIDS_VAL(EU_TICS_ALL, ull_int, reap->stacks[i]);
(*jcpu) += PIDS_VAL(EU_TICS_ALL, ull_int, reap->stacks[i]);
if (!(secondbest_time && PIDS_GETULL(START) <= secondbest_time)) {
secondbest_time = PIDS_GETULL(START);
if (cmdline[0] == '-' && cmdline[1] == '\0') {