hard disk about to die

This commit is contained in:
albert 2003-09-28 02:45:05 +00:00
parent c462dcfad5
commit ac6260bc23
11 changed files with 449 additions and 399 deletions

View File

@ -18,9 +18,9 @@
VERSION := 3 VERSION := 3
SUBVERSION := 1 SUBVERSION := 1
MINORVERSION := 13 MINORVERSION := 14
TARVERSION := 3.1.13 TARVERSION := 3.1.14
LIBVERSION := 3.1.13 LIBVERSION := 3.1.14
############ vars ############ vars

4
NEWS
View File

@ -1,3 +1,7 @@
procps-3.1.13 --> procps-3.1.14
handle 32-bit dev_t of Linux 2.6
procps-3.1.12 --> procps-3.1.13 procps-3.1.12 --> procps-3.1.13
ps: can display NPTL threads w/ kernel patch ps: can display NPTL threads w/ kernel patch

View File

@ -16,7 +16,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <sys/sysmacros.h>
#include "version.h" #include "version.h"
#include "devname.h" #include "devname.h"
@ -31,10 +30,23 @@
* dev_to_tty top, ps * dev_to_tty top, ps
*/ */
#if 0
#include <sys/sysmacros.h>
#define MAJOR_OF(d) ((unsigned)major(d))
#define MINOR_OF(d) ((unsigned)minor(d))
#else
#define MAJOR_OF(d) ( ((unsigned)(d)>>8u) & 0xfffu )
#define MINOR_OF(d) ( ((unsigned)(d)&0xffu) | (((unsigned)(d)&0xfff00000u)>>20u) )
#undef major
#undef minor
#define major <-- do not use -->
#define minor <-- do not use -->
#endif
typedef struct tty_map_node { typedef struct tty_map_node {
struct tty_map_node *next; struct tty_map_node *next;
int major_number; /* not unsigned! Ugh... */ unsigned major_number;
int minor_first, minor_last; unsigned minor_first, minor_last;
char name[16]; char name[16];
char devfs_type; char devfs_type;
} tty_map_node; } tty_map_node;
@ -76,7 +88,7 @@ static void load_drivers(void){
tmn->major_number = atoi(p); tmn->major_number = atoi(p);
p += strspn(p, "0123456789"); p += strspn(p, "0123456789");
while(*p == ' ') p++; while(*p == ' ') p++;
switch(sscanf(p, "%d-%d", &tmn->minor_first, &tmn->minor_last)){ switch(sscanf(p, "%u-%u", &tmn->minor_first, &tmn->minor_last)){
default: default:
/* Can't finish parsing this line so we remove it from the list */ /* Can't finish parsing this line so we remove it from the list */
tty_map = tty_map->next; tty_map = tty_map->next;
@ -95,7 +107,7 @@ fail:
} }
/* Try to guess the device name from /proc/tty/drivers info. */ /* Try to guess the device name from /proc/tty/drivers info. */
static int driver_name(char *restrict const buf, int maj, int min){ static int driver_name(char *restrict const buf, unsigned maj, unsigned min){
struct stat sbuf; struct stat sbuf;
tty_map_node *tmn; tty_map_node *tmn;
if(!tty_map) load_drivers(); if(!tty_map) load_drivers();
@ -112,16 +124,16 @@ static int driver_name(char *restrict const buf, int maj, int min){
sprintf(buf, "/dev/%s", tmn->name); /* like "/dev/ttyZZ255" */ sprintf(buf, "/dev/%s", tmn->name); /* like "/dev/ttyZZ255" */
if(stat(buf, &sbuf) < 0) return 0; if(stat(buf, &sbuf) < 0) return 0;
} }
if(min != minor(sbuf.st_rdev)) return 0; if(min != MINOR_OF(sbuf.st_rdev)) return 0;
if(maj != major(sbuf.st_rdev)) return 0; if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
return 1; return 1;
} }
/* Try to guess the device name (useful until /proc/PID/tty is added) */ /* Try to guess the device name (useful until /proc/PID/tty is added) */
static int guess_name(char *restrict const buf, int maj, int min){ static int guess_name(char *restrict const buf, unsigned maj, unsigned min){
struct stat sbuf; struct stat sbuf;
int t0, t1; int t0, t1;
int tmpmin = min; unsigned tmpmin = min;
switch(maj){ switch(maj){
case 4: case 4:
if(min<64){ if(min<64){
@ -166,8 +178,8 @@ static int guess_name(char *restrict const buf, int maj, int min){
default: return 0; default: return 0;
} }
if(stat(buf, &sbuf) < 0) return 0; if(stat(buf, &sbuf) < 0) return 0;
if(min != minor(sbuf.st_rdev)) return 0; if(min != MINOR_OF(sbuf.st_rdev)) return 0;
if(maj != major(sbuf.st_rdev)) return 0; if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
return 1; return 1;
} }
@ -175,7 +187,7 @@ static int guess_name(char *restrict const buf, int maj, int min){
* Useful names could be in /proc/PID/fd/2 (stderr, seldom redirected) * Useful names could be in /proc/PID/fd/2 (stderr, seldom redirected)
* and in /proc/PID/fd/255 (used by bash to remember the tty). * and in /proc/PID/fd/255 (used by bash to remember the tty).
*/ */
static int link_name(char *restrict const buf, int maj, int min, int pid, const char *restrict name){ static int link_name(char *restrict const buf, unsigned maj, unsigned min, int pid, const char *restrict name){
struct stat sbuf; struct stat sbuf;
char path[32]; char path[32];
int count; int count;
@ -184,25 +196,26 @@ static int link_name(char *restrict const buf, int maj, int min, int pid, const
if(count == -1) return 0; if(count == -1) return 0;
buf[count] = '\0'; buf[count] = '\0';
if(stat(buf, &sbuf) < 0) return 0; if(stat(buf, &sbuf) < 0) return 0;
if(min != minor(sbuf.st_rdev)) return 0; if(min != MINOR_OF(sbuf.st_rdev)) return 0;
if(maj != major(sbuf.st_rdev)) return 0; if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
return 1; return 1;
} }
/* number --> name */ /* number --> name */
unsigned dev_to_tty(char *restrict ret, unsigned chop, int dev, int pid, unsigned int flags) { unsigned dev_to_tty(char *restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags) {
static char buf[PAGE_SIZE]; static char buf[PAGE_SIZE];
char *restrict tmp = buf; char *restrict tmp = buf;
unsigned dev = dev_t_dev;
unsigned i = 0; unsigned i = 0;
int c; int c;
if((short)dev == (short)0) goto no_tty; if(dev == 0u) goto no_tty;
if(linux_version_code > LINUX_VERSION(2, 7, 0)){ // not likely to make 2.6.xx if(linux_version_code > LINUX_VERSION(2, 7, 0)){ // not likely to make 2.6.xx
if(link_name(tmp, major(dev), minor(dev), pid, "tty" )) goto abbrev; if(link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "tty" )) goto abbrev;
} }
if(driver_name(tmp, major(dev), minor(dev) )) goto abbrev; if(driver_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) goto abbrev;
if( link_name(tmp, major(dev), minor(dev), pid, "fd/2" )) goto abbrev; if( link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "fd/2" )) goto abbrev;
if( guess_name(tmp, major(dev), minor(dev) )) goto abbrev; if( guess_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) goto abbrev;
if( link_name(tmp, major(dev), minor(dev), pid, "fd/255")) goto abbrev; if( link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "fd/255")) goto abbrev;
// fall through if unable to find a device file // fall through if unable to find a device file
no_tty: no_tty:
strcpy(ret, "?"); strcpy(ret, "?");

View File

@ -9,7 +9,7 @@ EXTERN_C_BEGIN
#define ABBREV_TTY 2 /* remove tty */ #define ABBREV_TTY 2 /* remove tty */
#define ABBREV_PTS 4 /* remove pts/ */ #define ABBREV_PTS 4 /* remove pts/ */
extern unsigned dev_to_tty(char *restrict ret, unsigned chop, int dev, int pid, unsigned int flags); extern unsigned dev_to_tty(char *restrict ret, unsigned chop, dev_t dev_t_dev, int pid, unsigned int flags);
extern int tty_to_dev(const char *restrict const name); extern int tty_to_dev(const char *restrict const name);

View File

@ -65,7 +65,8 @@ typedef struct status_table_struct {
// Derived from: // Derived from:
// gperf -7 --language=ANSI-C --key-positions=1,3,4 -C -n -c sml.gperf // gperf -7 --language=ANSI-C --key-positions=1,3,4 -C -n -c sml.gperf
static void status2proc(char *S, proc_t *restrict P){ static void status2proc(char *S, proc_t *restrict P, int is_proc){
char ShdPnd[16] = "";
static const unsigned char asso[] = { static const unsigned char asso[] = {
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
@ -271,6 +272,13 @@ ENTER(0x220);
P->vm_stack = strtol(S,&S,10); P->vm_stack = strtol(S,&S,10);
continue; continue;
} }
// recent kernels supply per-tgid pending signals
if(is_proc && *ShdPnd){
memcpy(P->signal, ShdPnd, 16);
P->signal[16] = '\0';
}
LEAVE(0x220); LEAVE(0x220);
} }
@ -494,7 +502,7 @@ static proc_t* simple_readproc(PROCTAB *restrict const PT, proc_t *restrict cons
if (flags & PROC_FILLSTATUS) { /* read, parse /proc/#/status */ if (flags & PROC_FILLSTATUS) { /* read, parse /proc/#/status */
if (likely( file2str(path, "status", sbuf, sizeof sbuf) != -1 )){ if (likely( file2str(path, "status", sbuf, sizeof sbuf) != -1 )){
status2proc(sbuf, p); status2proc(sbuf, p, 1);
} }
} }
@ -559,13 +567,23 @@ static proc_t* simple_readtask(PROCTAB *restrict const PT, const proc_t *restric
} }
if (unlikely(flags & PROC_FILLMEM)) { /* read, parse /proc/#/statm */ if (unlikely(flags & PROC_FILLMEM)) { /* read, parse /proc/#/statm */
#if 0
if (likely( file2str(path, "statm", sbuf, sizeof sbuf) != -1 )) if (likely( file2str(path, "statm", sbuf, sizeof sbuf) != -1 ))
statm2proc(sbuf, t); /* ignore statm errors here */ statm2proc(sbuf, t); /* ignore statm errors here */
#else
t->size = p->size;
t->resident = p->resident;
t->share = p->share;
t->trs = p->trs;
t->lrs = p->lrs;
t->drs = p->drs;
t->dt = p->dt;
#endif
} /* statm fields just zero */ } /* statm fields just zero */
if (flags & PROC_FILLSTATUS) { /* read, parse /proc/#/status */ if (flags & PROC_FILLSTATUS) { /* read, parse /proc/#/status */
if (likely( file2str(path, "status", sbuf, sizeof sbuf) != -1 )){ if (likely( file2str(path, "status", sbuf, sizeof sbuf) != -1 )){
status2proc(sbuf, t); status2proc(sbuf, t, 0);
} }
} }

View File

@ -1,14 +1,14 @@
#ifndef PROCPS_PROC_READPROC_H #ifndef PROCPS_PROC_READPROC_H
#define PROCPS_PROC_READPROC_H #define PROCPS_PROC_READPROC_H
/* /*
* New Interface to Process Table -- PROCTAB Stream (a la Directory streams) // New Interface to Process Table -- PROCTAB Stream (a la Directory streams)
* Copyright 1996 Charles L. Blake. // Copyright 1996 Charles L. Blake.
* Copyright 1998 Michael K. Johnson // Copyright 1998 Michael K. Johnson
* Copyright 1998-2003 Albert Cahalan // Copyright 1998-2003 Albert Cahalan
* May be distributed under the terms of the // May be distributed under the terms of the
* GNU Library General Public License, a copy of which is provided // GNU Library General Public License, a copy of which is provided
* in the file COPYING // in the file COPYING
*/
#include "procps.h" #include "procps.h"
@ -16,136 +16,134 @@
EXTERN_C_BEGIN EXTERN_C_BEGIN
/* // ld cutime, cstime, priority, nice, timeout, it_real_value, rss,
ld cutime, cstime, priority, nice, timeout, it_real_value, rss, // c state,
c state, // d ppid, pgrp, session, tty, tpgid,
d ppid, pgrp, session, tty, tpgid, // s signal, blocked, sigignore, sigcatch,
s signal, blocked, sigignore, sigcatch, // lu flags, min_flt, cmin_flt, maj_flt, cmaj_flt, utime, stime,
lu flags, min_flt, cmin_flt, maj_flt, cmaj_flt, utime, stime, // lu rss_rlim, start_code, end_code, start_stack, kstk_esp, kstk_eip,
lu rss_rlim, start_code, end_code, start_stack, kstk_esp, kstk_eip, // lu start_time, vsize, wchan, nswap, cnswap,
lu start_time, vsize, wchan, nswap, cnswap,
*/
// This is to help document a transition from pid to tgid/tid caused // This is to help document a transition from pid to tgid/tid caused
// by the introduction of thread support. It is used in cases where // by the introduction of thread support. It is used in cases where
// neither tgid nor tid seemed correct. (in other words, FIXME) // neither tgid nor tid seemed correct. (in other words, FIXME)
#define XXXID tid #define XXXID tid
/* Basic data structure which holds all information we can get about a process. // Basic data structure which holds all information we can get about a process.
* (unless otherwise specified, fields are read from /proc/#/stat) // (unless otherwise specified, fields are read from /proc/#/stat)
* //
* Most of it comes from task_struct in linux/sched.h // Most of it comes from task_struct in linux/sched.h
*/ //
typedef struct proc_t { typedef struct proc_t {
// 1st 16 bytes // 1st 16 bytes
int int
tid, /* process id */ tid, // (special) task id, the POSIX thread ID (see also: tgid)
ppid; /* pid of parent process */ ppid; // stat,status pid of parent process
unsigned unsigned
pcpu; /* %CPU usage (is not filled in by readproc!!!) */ pcpu; // stat (special) %CPU usage (is not filled in by readproc!!!)
char char
state, /* single-char code for process state (S=sleeping) */ state, // stat,status single-char code for process state (S=sleeping)
pad_1, /* padding */ pad_1, // n/a padding
pad_2, /* padding */ pad_2, // n/a padding
pad_3; /* padding */ pad_3; // n/a padding
// 2nd 16 bytes // 2nd 16 bytes
unsigned long long unsigned long long
utime, /* user-mode CPU time accumulated by process */ utime, // stat user-mode CPU time accumulated by process
stime, /* kernel-mode CPU time accumulated by process */ stime, // stat kernel-mode CPU time accumulated by process
// and so on... // and so on...
cutime, /* cumulative utime of process and reaped children */ cutime, // stat cumulative utime of process and reaped children
cstime, /* cumulative stime of process and reaped children */ cstime, // stat cumulative stime of process and reaped children
start_time; /* start time of process -- seconds since 1-1-70 */ start_time; // stat start time of process -- seconds since 1-1-70
#ifdef SIGNAL_STRING #ifdef SIGNAL_STRING
char char
/* Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding. */ // Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
signal[18], /* mask of pending signals */ signal[18], // status mask of pending signals
blocked[18], /* mask of blocked signals */ blocked[18], // status mask of blocked signals
sigignore[18], /* mask of ignored signals */ sigignore[18], // status mask of ignored signals
sigcatch[18]; /* mask of caught signals */ sigcatch[18]; // status mask of caught signals
#else #else
long long long long
/* Linux 2.1.7x and up have 64 signals. */ // Linux 2.1.7x and up have 64 signals.
signal, /* mask of pending signals */ signal, // status mask of pending signals
blocked, /* mask of blocked signals */ blocked, // status mask of blocked signals
sigignore, /* mask of ignored signals */ sigignore, // status mask of ignored signals
sigcatch; /* mask of caught signals */ sigcatch; // status mask of caught signals
#endif #endif
long long
priority, /* kernel scheduling priority */ priority, // stat kernel scheduling priority
timeout, /* ? */ timeout, // stat ?
nice, /* standard unix nice level of process */ nice, // stat standard unix nice level of process
rss, /* resident set size from /proc/#/stat (pages) */ rss, // stat resident set size from /proc/#/stat (pages)
it_real_value, /* ? */ it_real_value, // stat ?
/* the next 7 members come from /proc/#/statm */ // the next 7 members come from /proc/#/statm
size, /* total # of pages of memory */ size, // statm total # of pages of memory
resident, /* number of resident set (non-swapped) pages (4k) */ resident, // statm number of resident set (non-swapped) pages (4k)
share, /* number of pages of shared (mmap'd) memory */ share, // statm number of pages of shared (mmap'd) memory
trs, /* text resident set size */ trs, // statm text resident set size
lrs, /* shared-lib resident set size */ lrs, // statm shared-lib resident set size
drs, /* data resident set size */ drs, // statm data resident set size
dt; /* dirty pages */ dt; // statm dirty pages
unsigned long unsigned long
vm_size, /* same as vsize in kb */ vm_size, // status same as vsize in kb
vm_lock, /* locked pages in kb */ vm_lock, // status locked pages in kb
vm_rss, /* same as rss in kb */ vm_rss, // status same as rss in kb
vm_data, /* data size */ vm_data, // status data size
vm_stack, /* stack size */ vm_stack, // status stack size
vm_exe, /* executable size */ vm_exe, // status executable size
vm_lib, /* library size (all pages, not just used ones) */ vm_lib, // status library size (all pages, not just used ones)
rtprio, /* real-time priority */ rtprio, // stat real-time priority
sched, /* scheduling class */ sched, // stat scheduling class
vsize, /* number of pages of virtual memory ... */ vsize, // stat number of pages of virtual memory ...
rss_rlim, /* resident set size limit? */ rss_rlim, // stat resident set size limit?
flags, /* kernel flags for the process */ flags, // stat kernel flags for the process
min_flt, /* number of minor page faults since process start */ min_flt, // stat number of minor page faults since process start
maj_flt, /* number of major page faults since process start */ maj_flt, // stat number of major page faults since process start
cmin_flt, /* cumulative min_flt of process and child processes */ cmin_flt, // stat cumulative min_flt of process and child processes
cmaj_flt, /* cumulative maj_flt of process and child processes */ cmaj_flt, // stat cumulative maj_flt of process and child processes
nswap, /* ? */ nswap, // stat ?
cnswap; /* cumulative nswap ? */ cnswap; // stat cumulative nswap ?
unsigned KLONG unsigned KLONG
start_code, /* address of beginning of code segment */ start_code, // stat address of beginning of code segment
end_code, /* address of end of code segment */ end_code, // stat address of end of code segment
start_stack, /* address of the bottom of stack for the process */ start_stack, // stat address of the bottom of stack for the process
kstk_esp, /* kernel stack pointer */ kstk_esp, // stat kernel stack pointer
kstk_eip, /* kernel instruction pointer */ kstk_eip, // stat kernel instruction pointer
wchan; /* address of kernel wait channel proc is sleeping in */ wchan; // stat (special) address of kernel wait channel proc is sleeping in
char char
**environ, /* environment string vector (/proc/#/environ) */ **environ, // (special) environment string vector (/proc/#/environ)
**cmdline; /* command line string vector (/proc/#/cmdline) */ **cmdline; // (special) command line string vector (/proc/#/cmdline)
char char
/* Be compatible: Digital allows 16 and NT allows 14 ??? */ // Be compatible: Digital allows 16 and NT allows 14 ???
ruser[16], /* real user name */ euser[16], // stat(),status effective user name
euser[16], /* effective user name */ ruser[16], // status real user name
suser[16], /* saved user name */ suser[16], // status saved user name
fuser[16], /* filesystem user name */ fuser[16], // status filesystem user name
rgroup[16], /* real group name */ rgroup[16], // status real group name
egroup[16], /* effective group name */ egroup[16], // status effective group name
sgroup[16], /* saved group name */ sgroup[16], // status saved group name
fgroup[16], /* filesystem group name */ fgroup[16], // status filesystem group name
cmd[16]; /* basename of executable file in call to exec(2) */ cmd[16]; // stat,status basename of executable file in call to exec(2)
struct proc_t struct proc_t
*ring, // thread group ring *ring, // n/a thread group ring
*next; // various library uses *next; // n/a various library uses
int int
ruid, rgid, /* real */ pgrp, // stat process group id
euid, egid, /* effective */ session, // stat session id
suid, sgid, /* saved */ tgid, // (special) task group ID, the POSIX PID (see also: tid)
fuid, fgid, /* fs (used for file access only) */ tty, // stat full device number of controlling terminal
pgrp, /* process group id */ euid, egid, // stat(),status effective
session, /* session id */ ruid, rgid, // status real
tty, /* full device number of controlling terminal */ suid, sgid, // status saved
tpgid, /* terminal process group id */ fuid, fgid, // status fs (used for file access only)
tgid, /* thread group ID */ tpgid, // stat terminal process group id
exit_signal, /* might not be SIGCHLD */ exit_signal, // stat might not be SIGCHLD
processor; /* current (or most recent?) CPU */ processor; // stat current (or most recent?) CPU
} proc_t; } proc_t;
/* PROCTAB: data structure holding the persistent information readproc needs // PROCTAB: data structure holding the persistent information readproc needs
* from openproc(). The setup is intentionally similar to the dirent interface // from openproc(). The setup is intentionally similar to the dirent interface
* and other system table interfaces (utmp+wtmp come to mind). // and other system table interfaces (utmp+wtmp come to mind).
*/
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
@ -161,9 +159,9 @@ typedef struct PROCTAB {
int(*taskfinder)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const); int(*taskfinder)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const);
proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const); proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const);
unsigned flags; unsigned flags;
pid_t* pids; /* pids of the procs */ pid_t* pids; // pids of the procs
uid_t* uids; /* uids of procs */ uid_t* uids; // uids of procs
int nuid; /* cannot really sentinel-terminate unsigned short[] */ int nuid; // cannot really sentinel-terminate unsigned short[]
int i; // generic int i; // generic
unsigned u; // generic unsigned u; // generic
void * vp; // generic void * vp; // generic
@ -175,11 +173,11 @@ typedef struct PROCTAB {
extern PROCTAB* openproc(int flags, ... /* pid_t*|uid_t*|dev_t*|char* [, int n] */ ); extern PROCTAB* openproc(int flags, ... /* pid_t*|uid_t*|dev_t*|char* [, int n] */ );
/* Convenient wrapper around openproc and readproc to slurp in the whole process // Convenient wrapper around openproc and readproc to slurp in the whole process
* table subset satisfying the constraints of flags and the optional PID list. // table subset satisfying the constraints of flags and the optional PID list.
* Free allocated memory with exit(). Access via tab[N]->member. The pointer // Free allocated memory with exit(). Access via tab[N]->member. The pointer
* list is NULL terminated. // list is NULL terminated.
*/
extern proc_t** readproctab(int flags, ... /* same as openproc */ ); extern proc_t** readproctab(int flags, ... /* same as openproc */ );
// clean-up open files, etc from the openproc() // clean-up open files, etc from the openproc()
@ -194,37 +192,37 @@ extern int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid);
extern void look_up_our_self(proc_t *p); extern void look_up_our_self(proc_t *p);
/* deallocate space allocated by readproc // deallocate space allocated by readproc
*/
extern void freeproc(proc_t* p); extern void freeproc(proc_t* p);
/* openproc/readproctab: // openproc/readproctab:
* //
* Return PROCTAB* / *proc_t[] or NULL on error ((probably) "/proc" cannot be // Return PROCTAB* / *proc_t[] or NULL on error ((probably) "/proc" cannot be
* opened.) By default readproc will consider all processes as valid to parse // opened.) By default readproc will consider all processes as valid to parse
* and return, but not actually fill in the cmdline, environ, and /proc/#/statm // and return, but not actually fill in the cmdline, environ, and /proc/#/statm
* derived memory fields. // derived memory fields.
* //
* `flags' (a bitwise-or of PROC_* below) modifies the default behavior. The // `flags' (a bitwise-or of PROC_* below) modifies the default behavior. The
* "fill" options will cause more of the proc_t to be filled in. The "filter" // "fill" options will cause more of the proc_t to be filled in. The "filter"
* options all use the second argument as the pointer to a list of objects: // options all use the second argument as the pointer to a list of objects:
* process status', process id's, user id's. The third // process status', process id's, user id's. The third
* argument is the length of the list (currently only used for lists of user // argument is the length of the list (currently only used for lists of user
* id's since uid_t supports no convenient termination sentinel.) // id's since uid_t supports no convenient termination sentinel.)
*/
#define PROC_FILLMEM 0x0001 /* read statm */
#define PROC_FILLCOM 0x0002 /* alloc and fill in `cmdline' */
#define PROC_FILLENV 0x0004 /* alloc and fill in `environ' */
#define PROC_FILLUSR 0x0008 /* resolve user id number -> user name */
#define PROC_FILLGRP 0x0010 /* resolve group id number -> group name */
#define PROC_FILLSTATUS 0x0020 /* read status -- currently unconditional */
#define PROC_FILLSTAT 0x0040 /* read stat -- currently unconditional */
#define PROC_FILLWCHAN 0x0080 /* look up WCHAN name */
#define PROC_FILLARG 0x0100 /* alloc and fill in `cmdline' */
/* Obsolete, consider only processes with one of the passed: */ #define PROC_FILLMEM 0x0001 // read statm
#define PROC_PID 0x1000 /* process id numbers ( 0 terminated) */ #define PROC_FILLCOM 0x0002 // alloc and fill in `cmdline'
#define PROC_UID 0x4000 /* user id numbers ( length needed ) */ #define PROC_FILLENV 0x0004 // alloc and fill in `environ'
#define PROC_FILLUSR 0x0008 // resolve user id number -> user name
#define PROC_FILLGRP 0x0010 // resolve group id number -> group name
#define PROC_FILLSTATUS 0x0020 // read status -- currently unconditional
#define PROC_FILLSTAT 0x0040 // read stat -- currently unconditional
#define PROC_FILLWCHAN 0x0080 // look up WCHAN name
#define PROC_FILLARG 0x0100 // alloc and fill in `cmdline'
// Obsolete, consider only processes with one of the passed:
#define PROC_PID 0x1000 // process id numbers ( 0 terminated)
#define PROC_UID 0x4000 // user id numbers ( length needed )
// it helps to give app code a few spare bits // it helps to give app code a few spare bits
#define PROC_SPARE_1 0x01000000 #define PROC_SPARE_1 0x01000000

View File

@ -1,15 +1,15 @@
Begin4 Begin4
Title: procps Title: procps
Version: 3.1.13 Version: 3.1.14
Entered-date: 2003-09-17 Entered-date: 2003-09-26
Description: Linux system utilities Description: Linux system utilities
Keywords: procps /proc libproc sysctl pmap ps uptime tload Keywords: procps /proc libproc sysctl pmap ps uptime tload
free w top vmstat watch skill snice kill pgrep pkill free w top vmstat watch skill snice kill pgrep pkill
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc. Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
Maintained-by: various <procps-feedback@lists.sf.net> Maintained-by: various <procps-feedback@lists.sf.net>
Primary-site: http://procps.sf.net/ Primary-site: http://procps.sf.net/
242kB procps-3.1.13.tar.gz 242kB procps-3.1.14.tar.gz
Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html Alternate-site: http://www.debian.org/Packages/unstable/base/procps.html
242kB procps-3.1.13.tar.gz 242kB procps-3.1.14.tar.gz
Copying-policy: mixed Copying-policy: mixed
End End

View File

@ -3,7 +3,7 @@ Summary: System and process monitoring utilities
Name: procps Name: procps
%define major_version 3 %define major_version 3
%define minor_version 1 %define minor_version 1
%define revision 13 %define revision 14
%define version %{major_version}.%{minor_version}.%{revision} %define version %{major_version}.%{minor_version}.%{revision}
Version: %{version} Version: %{version}
Release: 1 Release: 1

View File

@ -1131,6 +1131,11 @@ static int sr_context ( const proc_t* P, const proc_t* Q ) {
#define GRP PROC_FILLGRP /* gid_t -> group names */ #define GRP PROC_FILLGRP /* gid_t -> group names */
#define WCH PROC_FILLWCHAN /* do WCHAN lookup */ #define WCH PROC_FILLWCHAN /* do WCHAN lookup */
#define TO PRINT_THREAD_ONLY
#define PO PRINT_PROCESS_ONLY
#define ET PRINT_EVERY_TIME
#define AN PRINT_AS_NEEDED // no idea
/* TODO /* TODO
* pull out annoying BSD aliases into another table (to macro table?) * pull out annoying BSD aliases into another table (to macro table?)
* add sorting functions here (to unify names) * add sorting functions here (to unify names)
@ -1144,220 +1149,226 @@ static int sr_context ( const proc_t* P, const proc_t* Q ) {
/* Many of these are placeholders for unsupported options. */ /* Many of these are placeholders for unsupported options. */
static const format_struct format_array[] = { static const format_struct format_array[] = {
/* code header print() sort() width need vendor flags */ /* code header print() sort() width need vendor flags */
{"%cpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, BSD, RIGHT}, /*pcpu*/ {"%cpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, BSD, ET|RIGHT}, /*pcpu*/
{"%mem", "%MEM", pr_pmem, sr_nop, 4, 0, BSD, RIGHT}, /*pmem*/ {"%mem", "%MEM", pr_pmem, sr_nop, 4, 0, BSD, PO|RIGHT}, /*pmem*/
{"acflag", "ACFLG", pr_nop, sr_nop, 5, 0, XXX, RIGHT}, /*acflg*/ {"acflag", "ACFLG", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, /*acflg*/
{"acflg", "ACFLG", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*acflag*/ {"acflg", "ACFLG", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*acflag*/
{"addr", "ADDR", pr_nop, sr_nop, 4, 0, XXX, RIGHT}, {"addr", "ADDR", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
{"addr_1", "ADDR", pr_nop, sr_nop, 1, 0, LNX, LEFT}, {"addr_1", "ADDR", pr_nop, sr_nop, 1, 0, LNX, AN|LEFT},
{"alarm", "ALARM", pr_alarm, sr_it_real_value, 5, 0, LNX, RIGHT}, {"alarm", "ALARM", pr_alarm, sr_it_real_value,5, 0, LNX, AN|RIGHT},
{"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, RIGHT}, {"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, PO|RIGHT},
{"args", "COMMAND", pr_args, sr_nop, 16, ARG, U98, UNLIMITED}, /*command*/ {"args", "COMMAND", pr_args, sr_nop, 16, ARG, U98, PO|UNLIMITED}, /*command*/
{"atime", "TIME", pr_time, sr_nop, 8, 0, SOE, CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */ {"atime", "TIME", pr_time, sr_nop, 8, 0, SOE, ET|CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */
{"blocked", "BLOCKED", pr_sigmask, sr_nop, 9, 0, BSD, SIGNAL}, /*sigmask*/ {"blocked", "BLOCKED", pr_sigmask, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigmask*/
{"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, RIGHT}, {"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, TO|RIGHT},
{"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, RIGHT}, {"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, AN|RIGHT},
{"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, RIGHT}, {"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, AN|RIGHT},
{"c", "C", pr_c, sr_pcpu, 2, 0, SUN, RIGHT}, {"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT},
{"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, SIGNAL}, /*sigcatch*/ {"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/
{"class", "CLS", pr_class, sr_sched, 3, 0, XXX, LEFT}, {"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT},
{"cls", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT}, {"cls", "-", pr_nop, sr_nop, 1, 0, HPU, AN|RIGHT},
{"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, RIGHT}, {"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT},
{"cmd", "CMD", pr_args, sr_cmd, 16, ARG, DEC, UNLIMITED}, /*ucomm*/ {"cmd", "CMD", pr_args, sr_cmd, 16, ARG, DEC, PO|UNLIMITED}, /*ucomm*/
{"cmin_flt", "-", pr_nop, sr_cmin_flt, 1, 0, LNX, RIGHT}, {"cmin_flt", "-", pr_nop, sr_cmin_flt, 1, 0, LNX, AN|RIGHT},
{"cnswap", "-", pr_nop, sr_cnswap, 1, 0, LNX, RIGHT}, {"cnswap", "-", pr_nop, sr_cnswap, 1, 0, LNX, AN|RIGHT},
{"comm", "COMMAND", pr_comm, sr_nop, 16, COM, U98, UNLIMITED}, /*ucomm*/ {"comm", "COMMAND", pr_comm, sr_nop, 16, COM, U98, PO|UNLIMITED}, /*ucomm*/
{"command", "COMMAND", pr_args, sr_nop, 16, ARG, XXX, UNLIMITED}, /*args*/ {"command", "COMMAND", pr_args, sr_nop, 16, ARG, XXX, PO|UNLIMITED}, /*args*/
{"context", "CONTEXT", pr_context, sr_context,40, 0, LNX, LEFT}, {"context", "CONTEXT", pr_context, sr_context,40, 0, LNX, AN|LEFT},
{"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, RIGHT}, /*cpu*/ {"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, ET|RIGHT}, /*cpu*/
{"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */ {"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
{"cputime", "TIME", pr_time, sr_nop, 8, 0, DEC, RIGHT}, /*time*/ {"cputime", "TIME", pr_time, sr_nop, 8, 0, DEC, ET|RIGHT}, /*time*/
{"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, RIGHT}, {"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, AN|RIGHT},
{"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, RIGHT}, {"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
{"cutime", "-", pr_nop, sr_cutime, 1, 0, LNX, RIGHT}, {"cutime", "-", pr_nop, sr_cutime, 1, 0, LNX, AN|RIGHT},
{"cwd", "CWD", pr_nop, sr_nop, 3, 0, LNX, LEFT}, {"cwd", "CWD", pr_nop, sr_nop, 3, 0, LNX, AN|LEFT},
{"drs", "DRS", pr_drs, sr_drs, 4, MEM, LNX, RIGHT}, {"drs", "DRS", pr_drs, sr_drs, 4, MEM, LNX, ET|RIGHT},
{"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, RIGHT}, {"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, ET|RIGHT},
{"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, RIGHT}, {"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, ET|RIGHT},
{"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, USER}, {"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, ET|USER},
{"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, RIGHT}, {"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, TO|RIGHT},
{"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, RIGHT}, {"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, PO|RIGHT},
{"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, UNLIMITED}, {"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, PO|UNLIMITED},
{"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, RIGHT}, {"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, PO|RIGHT},
{"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, RIGHT}, /* was 7 wide */ {"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, AN|RIGHT}, /* was 7 wide */
{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, RIGHT}, {"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT},
{"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, USER}, {"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, ET|USER},
{"f", "F", pr_flag, sr_nop, 1, 0, XXX, RIGHT}, /*flags*/ {"f", "F", pr_flag, sr_nop, 1, 0, XXX, ET|RIGHT}, /*flags*/
{"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, RIGHT}, {"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT},
{"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, USER}, {"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER},
{"flag", "F", pr_flag, sr_flags, 1, 0, DEC, RIGHT}, {"flag", "F", pr_flag, sr_flags, 1, 0, DEC, ET|RIGHT},
{"flags", "F", pr_flag, sr_flags, 1, 0, BSD, RIGHT}, /*f*/ /* was FLAGS, 8 wide */ {"flags", "F", pr_flag, sr_flags, 1, 0, BSD, ET|RIGHT}, /*f*/ /* was FLAGS, 8 wide */
{"fname", "COMMAND", pr_fname, sr_nop, 8, 0, SUN, LEFT}, {"fname", "COMMAND", pr_fname, sr_nop, 8, 0, SUN, PO|LEFT},
{"fsgid", "FSGID", pr_fgid, sr_fgid, 5, 0, LNX, RIGHT}, {"fsgid", "FSGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT},
{"fsgroup", "FSGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, USER}, {"fsgroup", "FSGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER},
{"fsuid", "FSUID", pr_fuid, sr_fuid, 5, 0, LNX, RIGHT}, {"fsuid", "FSUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT},
{"fsuser", "FSUSER", pr_fuser, sr_fuser, 8, USR, LNX, USER}, {"fsuser", "FSUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER},
{"fuid", "FUID", pr_fuid, sr_fuid, 5, 0, LNX, RIGHT}, {"fuid", "FUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT},
{"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, USER}, {"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER},
{"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, RIGHT}, {"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, ET|RIGHT},
{"group", "GROUP", pr_egroup, sr_egroup, 5, GRP, U98, USER}, /* was 8 wide */ {"group", "GROUP", pr_egroup, sr_egroup, 5, GRP, U98, ET|USER}, /* was 8 wide */
{"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, SIGNAL}, /*sigignore*/ {"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigignore*/
{"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*inblock*/ {"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*inblock*/
{"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*inblk*/ {"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*inblk*/
{"intpri", "PRI", pr_opri, sr_priority, 3, 0, HPU, RIGHT}, {"intpri", "PRI", pr_opri, sr_priority, 3, 0, HPU, TO|RIGHT},
{"jobc", "JOBC", pr_nop, sr_nop, 4, 0, XXX, RIGHT}, {"jobc", "JOBC", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
{"ktrace", "KTRACE", pr_nop, sr_nop, 8, 0, BSD, RIGHT}, {"ktrace", "KTRACE", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
{"ktracep", "KTRACEP", pr_nop, sr_nop, 8, 0, BSD, RIGHT}, {"ktracep", "KTRACEP", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
{"label", "LABEL", pr_nop, sr_nop, 25, 0, SGI, LEFT}, {"label", "LABEL", pr_nop, sr_nop, 25, 0, SGI, AN|LEFT},
{"lim", "LIM", pr_lim, sr_rss_rlim, 5, 0, BSD, RIGHT}, {"lim", "LIM", pr_lim, sr_rss_rlim, 5, 0, BSD, AN|RIGHT},
{"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, LEFT}, /*logname*/ /* double check */ {"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, AN|LEFT}, /*logname*/ /* double check */
{"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, LEFT}, /*login*/ {"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, AN|LEFT}, /*login*/
{"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, LEFT}, {"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, AN|LEFT},
{"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, RIGHT}, {"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, AN|RIGHT},
{"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, RIGHT}, /* login ID */ {"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, ET|RIGHT}, /* login ID */
{"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, USER}, /* login USER */ {"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, ET|USER}, /* login USER */
{"lwp", "LWP", pr_thread, sr_tid, 5, 0, SUN, PIDMAX|RIGHT}, {"lwp", "LWP", pr_thread, sr_tid, 5, 0, SUN, TO|PIDMAX|RIGHT},
{"m_drs", "DRS", pr_drs, sr_drs, 5, MEM, LNx, RIGHT}, {"m_drs", "DRS", pr_drs, sr_drs, 5, MEM, LNx, PO|RIGHT},
{"m_dt", "DT", pr_nop, sr_dt, 4, MEM, LNx, RIGHT}, {"m_dt", "DT", pr_nop, sr_dt, 4, MEM, LNx, PO|RIGHT},
{"m_lrs", "LRS", pr_nop, sr_lrs, 5, MEM, LNx, RIGHT}, {"m_lrs", "LRS", pr_nop, sr_lrs, 5, MEM, LNx, PO|RIGHT},
{"m_resident", "RES", pr_nop, sr_resident, 5,MEM, LNx, RIGHT}, {"m_resident", "RES", pr_nop, sr_resident, 5,MEM, LNx, PO|RIGHT},
{"m_share", "SHRD", pr_nop, sr_share, 5, MEM, LNx, RIGHT}, {"m_share", "SHRD", pr_nop, sr_share, 5, MEM, LNx, PO|RIGHT},
{"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, RIGHT}, {"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, PO|RIGHT},
{"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, RIGHT}, {"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, PO|RIGHT},
{"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, RIGHT}, {"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, PO|RIGHT},
{"maj_flt", "MAJFL", pr_majflt, sr_maj_flt, 6, 0, LNX, CUMUL|RIGHT}, {"maj_flt", "MAJFL", pr_majflt, sr_maj_flt, 6, 0, LNX, AN|CUMUL|RIGHT},
{"majflt", "MAJFLT", pr_majflt, sr_maj_flt, 6, 0, XXX, RIGHT}, {"majflt", "MAJFLT", pr_majflt, sr_maj_flt, 6, 0, XXX, AN|RIGHT},
{"min_flt", "MINFL", pr_minflt, sr_min_flt, 6, 0, LNX, CUMUL|RIGHT}, {"min_flt", "MINFL", pr_minflt, sr_min_flt, 6, 0, LNX, AN|CUMUL|RIGHT},
{"minflt", "MINFLT", pr_minflt, sr_min_flt, 6, 0, XXX, RIGHT}, {"minflt", "MINFLT", pr_minflt, sr_min_flt, 6, 0, XXX, AN|RIGHT},
{"msgrcv", "MSGRCV", pr_nop, sr_nop, 6, 0, XXX, RIGHT}, {"msgrcv", "MSGRCV", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT},
{"msgsnd", "MSGSND", pr_nop, sr_nop, 6, 0, XXX, RIGHT}, {"msgsnd", "MSGSND", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT},
{"ni", "NI", pr_nice, sr_nice, 3, 0, BSD, RIGHT}, /*nice*/ {"mwchan", "MWCHAN", pr_nop, sr_nop, 6, WCH, BSD, AN|WCHAN}, /* mutex (FreeBSD) */
{"nice", "NI", pr_nice, sr_nice, 3, 0, U98, RIGHT}, /*ni*/ {"ni", "NI", pr_nice, sr_nice, 3, 0, BSD, TO|RIGHT}, /*nice*/
{"nivcsw", "IVCSW", pr_nop, sr_nop, 5, 0, XXX, RIGHT}, {"nice", "NI", pr_nice, sr_nice, 3, 0, U98, TO|RIGHT}, /*ni*/
{"nlwp", "NLWP", pr_nlwp, sr_nop, 4, 0, SUN, RIGHT}, {"nivcsw", "IVCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
{"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*nsigs*/ {"nlwp", "NLWP", pr_nlwp, sr_nop, 4, 0, SUN, AN|RIGHT},
{"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*nsignals*/ {"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*nsigs*/
{"nswap", "NSWAP", pr_nop, sr_nswap, 5, 0, XXX, RIGHT}, {"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*nsignals*/
{"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, RIGHT}, {"nswap", "NSWAP", pr_nop, sr_nswap, 5, 0, XXX, AN|RIGHT},
{"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, RIGHT}, {"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
{"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, RIGHT}, {"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, TO|RIGHT},
{"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, RIGHT}, {"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, TO|RIGHT},
{"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*oublock*/ {"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, PO|RIGHT},
{"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*oublk*/ {"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*oublock*/
{"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, RIGHT}, {"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*oublk*/
{"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, RIGHT}, {"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
{"pagein", "PAGEIN", pr_majflt, sr_nop, 6, 0, XXX, RIGHT}, {"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
{"pcpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, U98, RIGHT}, /*%cpu*/ {"pagein", "PAGEIN", pr_majflt, sr_nop, 6, 0, XXX, AN|RIGHT},
{"pending", "PENDING", pr_sig, sr_nop, 9, 0, BSD, SIGNAL}, /*sig*/ {"pcpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, U98, TO|RIGHT}, /*%cpu*/
{"pgid", "PGID", pr_pgid, sr_pgrp, 5, 0, U98, PIDMAX|RIGHT}, {"pending", "PENDING", pr_sig, sr_nop, 9, 0, BSD, ET|SIGNAL}, /*sig*/
{"pgrp", "PGRP", pr_pgid, sr_pgrp, 5, 0, LNX, PIDMAX|RIGHT}, {"pgid", "PGID", pr_pgid, sr_pgrp, 5, 0, U98, PO|PIDMAX|RIGHT},
{"pid", "PID", pr_pid, sr_tgid, 5, 0, U98, PIDMAX|RIGHT}, {"pgrp", "PGRP", pr_pgid, sr_pgrp, 5, 0, LNX, PO|PIDMAX|RIGHT},
{"pmem", "%MEM", pr_pmem, sr_nop, 4, 0, XXX, RIGHT}, /*%mem*/ {"pid", "PID", pr_pid, sr_tgid, 5, 0, U98, PO|PIDMAX|RIGHT},
{"poip", "-", pr_nop, sr_nop, 1, 0, BSD, RIGHT}, {"pmem", "%MEM", pr_pmem, sr_nop, 4, 0, XXX, PO|RIGHT}, /*%mem*/
{"policy", "POL", pr_class, sr_sched, 3, 0, DEC, LEFT}, {"poip", "-", pr_nop, sr_nop, 1, 0, BSD, AN|RIGHT},
{"ppid", "PPID", pr_ppid, sr_ppid, 5, 0, U98, PIDMAX|RIGHT}, {"policy", "POL", pr_class, sr_sched, 3, 0, DEC, TO|LEFT},
{"pri", "PRI", pr_pri, sr_nop, 3, 0, XXX, RIGHT}, {"ppid", "PPID", pr_ppid, sr_ppid, 5, 0, U98, AN|PIDMAX|RIGHT},
{"priority", "PRI", pr_priority, sr_priority, 3, 0, LNX, RIGHT}, /*ni,nice*/ /* from Linux sorting names */ {"pri", "PRI", pr_pri, sr_nop, 3, 0, XXX, TO|RIGHT},
{"prmgrp", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT}, {"priority", "PRI", pr_priority, sr_priority, 3, 0, LNX, TO|RIGHT}, /*ni,nice*/ /* from Linux sorting names */
{"prmid", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT}, {"prmgrp", "-", pr_nop, sr_nop, 1, 0, HPU, PO|RIGHT},
{"pset", "PSET", pr_nop, sr_nop, 4, 0, DEC, RIGHT}, {"prmid", "-", pr_nop, sr_nop, 1, 0, HPU, PO|RIGHT},
{"psr", "PSR", pr_psr, sr_nop, 3, 0, DEC, RIGHT}, {"pset", "PSET", pr_nop, sr_nop, 4, 0, DEC, TO|RIGHT},
{"psxpri", "PPR", pr_nop, sr_nop, 3, 0, DEC, RIGHT}, {"psr", "PSR", pr_psr, sr_nop, 3, 0, DEC, TO|RIGHT},
{"re", "RE", pr_nop, sr_nop, 3, 0, BSD, RIGHT}, {"psxpri", "PPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT},
{"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, RIGHT}, {"re", "RE", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT},
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, RIGHT}, {"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, PO|RIGHT},
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, USER}, /* was 8 wide */ {"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT},
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, RIGHT}, {"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */
{"rss", "RSS", pr_rss, sr_rss, 4, 0, XXX, RIGHT}, /* was 5 wide */ {"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
{"rssize", "RSS", pr_rss, sr_vm_rss, 4, 0, DEC, RIGHT}, /*rsz*/ {"rss", "RSS", pr_rss, sr_rss, 4, 0, XXX, PO|RIGHT}, /* was 5 wide */
{"rsz", "RSZ", pr_rss, sr_vm_rss, 4, 0, BSD, RIGHT}, /*rssize*/ {"rssize", "RSS", pr_rss, sr_vm_rss, 4, 0, DEC, PO|RIGHT}, /*rsz*/
{"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, RIGHT}, {"rsz", "RSZ", pr_rss, sr_vm_rss, 4, 0, BSD, PO|RIGHT}, /*rssize*/
{"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, RIGHT}, {"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, TO|RIGHT},
{"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, USER}, {"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, ET|RIGHT},
{"s", "S", pr_s, sr_state, 1, 0, SUN, LEFT}, /*stat,state*/ {"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, ET|USER},
{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, RIGHT}, {"s", "S", pr_s, sr_state, 1, 0, SUN, ET|LEFT}, /*stat,state*/
{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, RIGHT}, /* man page misspelling of scount? */ {"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, TO|RIGHT},
{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, RIGHT}, /* scnt==scount, DEC claims both */ {"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, AN|RIGHT}, /* man page misspelling of scount? */
{"secsid", "SID", pr_secsid, sr_secsid, 6, 0, LNX, RIGHT}, /* Flask Linux */ {"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PIDMAX|RIGHT}, {"secsid", "SID", pr_secsid, sr_secsid, 6, 0, LNX, AN|RIGHT}, /* Flask Linux */
{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PIDMAX|RIGHT}, {"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT},
{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, RIGHT}, /* "cpu" number */ {"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PO|PIDMAX|RIGHT},
{"sgi_rss", "RSS", pr_rss, sr_nop, 4, 0, LNX, LEFT}, /* SZ:RSS */ {"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, TO|RIGHT}, /* "cpu" number */
{"sgid", "SGID", pr_sgid, sr_sgid, 5, 0, LNX, RIGHT}, {"sgi_rss", "RSS", pr_rss, sr_nop, 4, 0, LNX, PO|LEFT}, /* SZ:RSS */
{"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, USER}, {"sgid", "SGID", pr_sgid, sr_sgid, 5, 0, LNX, ET|RIGHT},
{"share", "-", pr_nop, sr_share, 1, MEM, LNX, RIGHT}, {"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER},
{"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PIDMAX|RIGHT}, /* Sun & HP */ {"share", "-", pr_nop, sr_share, 1, MEM, LNX, PO|RIGHT},
{"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, SIGNAL}, /*pending*/ {"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */
{"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, SIGNAL}, {"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, ET|SIGNAL}, /*pending*/
{"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, SIGNAL}, {"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, TO|SIGNAL},
{"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, SIGNAL}, {"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, TO|SIGNAL},
{"sig_pend", "SIGNAL", pr_sig, sr_nop, 9, 0, LNX, SIGNAL}, {"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, TO|SIGNAL},
{"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, SIGNAL}, /*caught*/ {"sig_pend", "SIGNAL", pr_sig, sr_nop, 9, 0, LNX, ET|SIGNAL},
{"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, SIGNAL}, /*ignored*/ {"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*caught*/
{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, SIGNAL}, /*blocked*/ {"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, TO|SIGNAL}, /*ignored*/
{"size", "SZ", pr_swapable, sr_swapable, 1, 0, SCO, RIGHT}, {"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, RIGHT}, {"size", "SZ", pr_swapable, sr_swapable, 1, 0, SCO, PO|RIGHT},
{"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, PIDMAX|RIGHT}, {"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT},
{"stackp", "STACKP", pr_stackp, sr_nop, 8, 0, LNX, RIGHT}, /*start_stack*/ {"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, TO|PIDMAX|RIGHT},
{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, RIGHT}, {"stackp", "STACKP", pr_stackp, sr_nop, 8, 0, LNX, AN|RIGHT}, /*start_stack*/
{"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, RIGHT}, {"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, AN|RIGHT},
{"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, RIGHT}, /*stackp*/ {"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, PO|RIGHT},
{"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, RIGHT}, {"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*stackp*/
{"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, LEFT}, /*state,s*/ {"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, AN|RIGHT},
{"state", "S", pr_s, sr_state, 1, 0, XXX, LEFT}, /*stat,s*/ /* was STAT */ {"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, TO|LEFT}, /*state,s*/
{"status", "STATUS", pr_nop, sr_nop, 6, 0, DEC, RIGHT}, {"state", "S", pr_s, sr_state, 1, 0, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */
{"stime", "STIME", pr_stime, sr_stime, 5, 0, XXX, /* CUMUL| */RIGHT}, /* was 6 wide */ {"status", "STATUS", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
{"suid", "SUID", pr_suid, sr_suid, 5, 0, LNx, RIGHT}, {"stime", "STIME", pr_stime, sr_stime, 5, 0, XXX, AN|/* CUMUL| */RIGHT}, /* was 6 wide */
{"suser", "SUSER", pr_suser, sr_suser, 8, USR, LNx, USER}, {"suid", "SUID", pr_suid, sr_suid, 5, 0, LNx, ET|RIGHT},
{"svgid", "SVGID", pr_sgid, sr_sgid, 5, 0, XXX, RIGHT}, {"suser", "SUSER", pr_suser, sr_suser, 8, USR, LNx, ET|USER},
{"svgroup", "SVGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, USER}, {"svgid", "SVGID", pr_sgid, sr_sgid, 5, 0, XXX, ET|RIGHT},
{"svuid", "SVUID", pr_suid, sr_suid, 5, 0, XXX, RIGHT}, {"svgroup", "SVGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER},
{"svuser", "SVUSER", pr_suser, sr_suser, 8, USR, LNX, USER}, {"svuid", "SVUID", pr_suid, sr_suid, 5, 0, XXX, ET|RIGHT},
{"systime", "SYSTEM", pr_nop, sr_nop, 6, 0, DEC, RIGHT}, {"svuser", "SVUSER", pr_suser, sr_suser, 8, USR, LNX, ET|USER},
{"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, RIGHT}, {"systime", "SYSTEM", pr_nop, sr_nop, 6, 0, DEC, ET|RIGHT},
{"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, RIGHT}, {"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, PO|RIGHT},
{"thcount", "THCNT", pr_nlwp, sr_nop, 5, 0, AIX, RIGHT}, {"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
{"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, PIDMAX|RIGHT}, {"thcount", "THCNT", pr_nlwp, sr_nop, 5, 0, AIX, AN|RIGHT},
{"time", "TIME", pr_time, sr_nop, 8, 0, U98, CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */ {"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, TO|PIDMAX|RIGHT},
{"timeout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, RIGHT}, {"time", "TIME", pr_time, sr_nop, 8, 0, U98, ET|CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */
{"tmout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, RIGHT}, {"timeout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, AN|RIGHT},
{"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, LEFT}, {"tmout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, AN|RIGHT},
{"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, PIDMAX|RIGHT}, {"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, AN|LEFT},
{"trs", "TRS", pr_trs, sr_trs, 4, MEM, AIX, RIGHT}, {"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, AN|PIDMAX|RIGHT},
{"trss", "TRSS", pr_trs, sr_trs, 4, MEM, BSD, RIGHT}, /* 4.3BSD NET/2 */ {"trs", "TRS", pr_trs, sr_trs, 4, MEM, AIX, PO|RIGHT},
{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PIDMAX|RIGHT}, {"trss", "TRSS", pr_trs, sr_trs, 4, MEM, BSD, PO|RIGHT}, /* 4.3BSD NET/2 */
{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PIDMAX|RIGHT}, {"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, AN|PIDMAX|RIGHT},
{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, RIGHT}, {"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, AN|PIDMAX|RIGHT},
{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, LEFT}, {"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, AN|RIGHT},
{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */ {"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, AN|LEFT},
{"tty4", "TTY", pr_tty4, sr_tty, 4, 0, LNX, LEFT}, {"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, AN|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
{"tty8", "TTY", pr_tty8, sr_tty, 8, 0, LNX, LEFT}, {"tty4", "TTY", pr_tty4, sr_tty, 4, 0, LNX, AN|LEFT},
{"u_procp", "UPROCP", pr_nop, sr_nop, 6, 0, DEC, RIGHT}, {"tty8", "TTY", pr_tty8, sr_tty, 8, 0, LNX, AN|LEFT},
{"ucmd", "CMD", pr_comm, sr_cmd, 16, COM, DEC, UNLIMITED}, /*ucomm*/ {"u_procp", "UPROCP", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
{"ucomm", "COMMAND", pr_comm, sr_nop, 16, COM, XXX, UNLIMITED}, /*comm*/ {"ucmd", "CMD", pr_comm, sr_cmd, 16, COM, DEC, PO|UNLIMITED}, /*ucomm*/
{"uid", "UID", pr_euid, sr_euid, 5, 0, XXX, RIGHT}, {"ucomm", "COMMAND", pr_comm, sr_nop, 16, COM, XXX, PO|UNLIMITED}, /*comm*/
{"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, USER}, {"uid", "UID", pr_euid, sr_euid, 5, 0, XXX, ET|RIGHT},
{"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, {"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, ET|USER},
{"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, USER}, /* man page misspelling of user? */ {"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT},
{"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, RIGHT}, /*usrpri*/ {"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, AN|USER}, /* man page misspelling of user? */
{"uprocp", "-", pr_nop, sr_nop, 1, 0, BSD, RIGHT}, {"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, TO|RIGHT}, /*usrpri*/
{"user", "USER", pr_euser, sr_euser, 8, USR, U98, USER}, /* BSD n forces this to UID */ {"uprocp", "-", pr_nop, sr_nop, 1, 0, BSD, AN|RIGHT},
{"usertime", "USER", pr_nop, sr_nop, 4, 0, DEC, RIGHT}, {"user", "USER", pr_euser, sr_euser, 8, USR, U98, ET|USER}, /* BSD n forces this to UID */
{"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, RIGHT}, /*upr*/ {"usertime", "USER", pr_nop, sr_nop, 4, 0, DEC, ET|RIGHT},
{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, CUMUL|RIGHT}, {"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT}, /*upr*/
{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, RIGHT}, {"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, ET|CUMUL|RIGHT},
{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, RIGHT}, {"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, PO|RIGHT},
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, RIGHT}, {"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, PO|RIGHT},
{"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, RIGHT}, {"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT},
{"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, RIGHT}, {"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, PO|RIGHT},
{"vsize", "VSZ", pr_vsz, sr_vsize, 5, 0, DEC, RIGHT}, /*vsz*/ {"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, PO|RIGHT},
{"vsz", "VSZ", pr_vsz, sr_vm_size, 5, 0, U98, RIGHT}, /*vsize*/ {"vsize", "VSZ", pr_vsz, sr_vsize, 5, 0, DEC, PO|RIGHT}, /*vsz*/
{"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */ {"vsz", "VSZ", pr_vsz, sr_vm_size, 5, 0, U98, PO|RIGHT}, /*vsize*/
{"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, WCHAN}, /* opposite of nwchan */ {"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
{"xstat", "XSTAT", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, {"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, TO|WCHAN}, /* opposite of nwchan */
{"~", "-", pr_nop, sr_nop, 1, 0, LNX, RIGHT} /* NULL would ruin alphabetical order */ {"xstat", "XSTAT", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT},
{"~", "-", pr_nop, sr_nop, 1, 0, LNX, AN|RIGHT} /* NULL would ruin alphabetical order */
}; };
#undef PO
#undef TO
#undef AN
#undef ET
static const int format_array_count = sizeof(format_array)/sizeof(format_struct); static const int format_array_count = sizeof(format_array)/sizeof(format_struct);

View File

@ -315,10 +315,12 @@ static const char *parse_sysv_option(void){
exclusive("-V"); exclusive("-V");
display_version(); display_version();
exit(0); exit(0);
#if 0
case 'Z': /* full Mandatory Access Control level info */ case 'Z': /* full Mandatory Access Control level info */
trace("-Z shows full MAC info\n"); trace("-Z shows full MAC info\n");
return "Don't understand MAC on Linux."; return "Don't understand MAC on Linux.";
break; break;
#endif
case 'a': case 'a':
trace("-a select all with a tty, but omit session leaders.\n"); trace("-a select all with a tty, but omit session leaders.\n");
simple_select |= SS_U_a; simple_select |= SS_U_a;
@ -442,10 +444,12 @@ static const char *parse_sysv_option(void){
trace("-y Print lnone info in UID/USER column or do Sun -l hack.\n"); trace("-y Print lnone info in UID/USER column or do Sun -l hack.\n");
format_modifiers |= FM_y; format_modifiers |= FM_y;
break; break;
#if 0
case 'z': /* alias of Mandatory Access Control level info */ case 'z': /* alias of Mandatory Access Control level info */
trace("-z shows aliased MAC info\n"); trace("-z shows aliased MAC info\n");
return "Don't understand MAC on Linux."; return "Don't understand MAC on Linux.";
break; break;
#endif
case '-': case '-':
return "Embedded '-' among SysV options makes no sense."; return "Embedded '-' among SysV options makes no sense.";
break; break;
@ -595,11 +599,13 @@ static const char *parse_bsd_option(void){
trace("j job control format\n"); trace("j job control format\n");
format_flags |= FF_Bj; format_flags |= FF_Bj;
break; break;
case 'k': // The OpenBSD way (NetBSD:s OpenBSD:k FreeBSD:H -- NIH???) #if 0
case 'k': // OpenBSD: don't hide "kernel threads" -- like the swapper?
trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n"); trace("k Print LWP (thread) info.\n"); // was: Use /vmcore as c-dumpfile\n");
thread_flags |= TF_show_task; // FIXME: determine if TF_show_proc is needed thread_flags |= TF_show_task; // FIXME: determine if TF_show_proc is needed
//format_modifiers |= FM_L; // FIXME: determine if we need something like this //format_modifiers |= FM_L; // FIXME: determine if we need something like this
break; break;
#endif
case 'l': case 'l':
trace("l Display long format\n"); trace("l Display long format\n");
format_flags |= FF_Bl; format_flags |= FF_Bl;

View File

@ -17,13 +17,13 @@
#include "../proc/readproc.h" #include "../proc/readproc.h"
#include "../proc/procps.h" #include "../proc/procps.h"
#define session_leader(p) ((p)->session == (p)->tgid) //#define process_group_leader(p) ((p)->pgid == (p)->tgid)
#define process_group_leader(p) ((p)->pgid == (p)->tgid) //#define some_other_user(p) ((p)->euid != cached_euid)
#define without_a_tty(p) ((unsigned short)((p)->tty) == (unsigned short)0) #define has_our_euid(p) ((unsigned)(p)->euid == (unsigned)cached_euid)
#define some_other_user(p) ((p)->euid != cached_euid) #define on_our_tty(p) ((unsigned)(p)->tty == (unsigned)cached_tty)
#define running(p) (((p)->state=='R')||((p)->state=='D')) #define running(p) (((p)->state=='R')||((p)->state=='D'))
#define has_our_euid(p) ((unsigned short)((p)->euid) == (unsigned short)cached_euid) #define session_leader(p) ((p)->session == (p)->tgid)
#define on_our_tty(p) ((unsigned short)((p)->tty) == (unsigned short)cached_tty) #define without_a_tty(p) (!(p)->tty)
static unsigned long select_bits = 0; static unsigned long select_bits = 0;
@ -87,7 +87,7 @@ static int proc_was_listed(proc_t *buf){
#define return_if_match(foo,bar) \ #define return_if_match(foo,bar) \
i=sn->n; while(i--) \ i=sn->n; while(i--) \
if((unsigned short )(buf->foo) == (unsigned short)(*(sn->u+i)).bar) \ if((unsigned)(buf->foo) == (unsigned)(*(sn->u+i)).bar) \
return 1 return 1
break; case SEL_RUID: return_if_match(ruid,uid); break; case SEL_RUID: return_if_match(ruid,uid);