hard disk about to die
This commit is contained in:
parent
c462dcfad5
commit
ac6260bc23
6
Makefile
6
Makefile
@ -18,9 +18,9 @@
|
||||
|
||||
VERSION := 3
|
||||
SUBVERSION := 1
|
||||
MINORVERSION := 13
|
||||
TARVERSION := 3.1.13
|
||||
LIBVERSION := 3.1.13
|
||||
MINORVERSION := 14
|
||||
TARVERSION := 3.1.14
|
||||
LIBVERSION := 3.1.14
|
||||
|
||||
############ vars
|
||||
|
||||
|
4
NEWS
4
NEWS
@ -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
|
||||
|
||||
ps: can display NPTL threads w/ kernel patch
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include "version.h"
|
||||
#include "devname.h"
|
||||
|
||||
@ -31,10 +30,23 @@
|
||||
* 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 {
|
||||
struct tty_map_node *next;
|
||||
int major_number; /* not unsigned! Ugh... */
|
||||
int minor_first, minor_last;
|
||||
unsigned major_number;
|
||||
unsigned minor_first, minor_last;
|
||||
char name[16];
|
||||
char devfs_type;
|
||||
} tty_map_node;
|
||||
@ -76,7 +88,7 @@ static void load_drivers(void){
|
||||
tmn->major_number = atoi(p);
|
||||
p += strspn(p, "0123456789");
|
||||
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:
|
||||
/* Can't finish parsing this line so we remove it from the list */
|
||||
tty_map = tty_map->next;
|
||||
@ -95,7 +107,7 @@ fail:
|
||||
}
|
||||
|
||||
/* 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;
|
||||
tty_map_node *tmn;
|
||||
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" */
|
||||
if(stat(buf, &sbuf) < 0) return 0;
|
||||
}
|
||||
if(min != minor(sbuf.st_rdev)) return 0;
|
||||
if(maj != major(sbuf.st_rdev)) return 0;
|
||||
if(min != MINOR_OF(sbuf.st_rdev)) return 0;
|
||||
if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
int t0, t1;
|
||||
int tmpmin = min;
|
||||
unsigned tmpmin = min;
|
||||
switch(maj){
|
||||
case 4:
|
||||
if(min<64){
|
||||
@ -166,8 +178,8 @@ static int guess_name(char *restrict const buf, int maj, int min){
|
||||
default: return 0;
|
||||
}
|
||||
if(stat(buf, &sbuf) < 0) return 0;
|
||||
if(min != minor(sbuf.st_rdev)) return 0;
|
||||
if(maj != major(sbuf.st_rdev)) return 0;
|
||||
if(min != MINOR_OF(sbuf.st_rdev)) return 0;
|
||||
if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
|
||||
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)
|
||||
* 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;
|
||||
char path[32];
|
||||
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;
|
||||
buf[count] = '\0';
|
||||
if(stat(buf, &sbuf) < 0) return 0;
|
||||
if(min != minor(sbuf.st_rdev)) return 0;
|
||||
if(maj != major(sbuf.st_rdev)) return 0;
|
||||
if(min != MINOR_OF(sbuf.st_rdev)) return 0;
|
||||
if(maj != MAJOR_OF(sbuf.st_rdev)) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* 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];
|
||||
char *restrict tmp = buf;
|
||||
unsigned dev = dev_t_dev;
|
||||
unsigned i = 0;
|
||||
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(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( link_name(tmp, major(dev), minor(dev), pid, "fd/2" )) goto abbrev;
|
||||
if( guess_name(tmp, major(dev), minor(dev) )) goto abbrev;
|
||||
if( link_name(tmp, major(dev), minor(dev), pid, "fd/255")) goto abbrev;
|
||||
if(driver_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) goto abbrev;
|
||||
if( link_name(tmp, MAJOR_OF(dev), MINOR_OF(dev), pid, "fd/2" )) goto abbrev;
|
||||
if( guess_name(tmp, MAJOR_OF(dev), MINOR_OF(dev) )) 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
|
||||
no_tty:
|
||||
strcpy(ret, "?");
|
||||
|
@ -9,7 +9,7 @@ EXTERN_C_BEGIN
|
||||
#define ABBREV_TTY 2 /* remove tty */
|
||||
#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);
|
||||
|
||||
|
@ -65,7 +65,8 @@ typedef struct status_table_struct {
|
||||
// Derived from:
|
||||
// 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[] = {
|
||||
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);
|
||||
continue;
|
||||
}
|
||||
|
||||
// recent kernels supply per-tgid pending signals
|
||||
if(is_proc && *ShdPnd){
|
||||
memcpy(P->signal, ShdPnd, 16);
|
||||
P->signal[16] = '\0';
|
||||
}
|
||||
|
||||
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 (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 0
|
||||
if (likely( file2str(path, "statm", sbuf, sizeof sbuf) != -1 ))
|
||||
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 */
|
||||
|
||||
if (flags & PROC_FILLSTATUS) { /* read, parse /proc/#/status */
|
||||
if (likely( file2str(path, "status", sbuf, sizeof sbuf) != -1 )){
|
||||
status2proc(sbuf, t);
|
||||
status2proc(sbuf, t, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
290
proc/readproc.h
290
proc/readproc.h
@ -1,14 +1,14 @@
|
||||
#ifndef PROCPS_PROC_READPROC_H
|
||||
#define PROCPS_PROC_READPROC_H
|
||||
/*
|
||||
* New Interface to Process Table -- PROCTAB Stream (a la Directory streams)
|
||||
* Copyright 1996 Charles L. Blake.
|
||||
* Copyright 1998 Michael K. Johnson
|
||||
* Copyright 1998-2003 Albert Cahalan
|
||||
* May be distributed under the terms of the
|
||||
* GNU Library General Public License, a copy of which is provided
|
||||
* in the file COPYING
|
||||
*/
|
||||
// New Interface to Process Table -- PROCTAB Stream (a la Directory streams)
|
||||
// Copyright 1996 Charles L. Blake.
|
||||
// Copyright 1998 Michael K. Johnson
|
||||
// Copyright 1998-2003 Albert Cahalan
|
||||
// May be distributed under the terms of the
|
||||
// GNU Library General Public License, a copy of which is provided
|
||||
// in the file COPYING
|
||||
|
||||
|
||||
#include "procps.h"
|
||||
|
||||
@ -16,136 +16,134 @@
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
|
||||
/*
|
||||
ld cutime, cstime, priority, nice, timeout, it_real_value, rss,
|
||||
c state,
|
||||
d ppid, pgrp, session, tty, tpgid,
|
||||
s signal, blocked, sigignore, sigcatch,
|
||||
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 start_time, vsize, wchan, nswap, cnswap,
|
||||
*/
|
||||
// ld cutime, cstime, priority, nice, timeout, it_real_value, rss,
|
||||
// c state,
|
||||
// d ppid, pgrp, session, tty, tpgid,
|
||||
// s signal, blocked, sigignore, sigcatch,
|
||||
// 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 start_time, vsize, wchan, nswap, cnswap,
|
||||
|
||||
// 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
|
||||
// neither tgid nor tid seemed correct. (in other words, FIXME)
|
||||
#define XXXID tid
|
||||
|
||||
/* Basic data structure which holds all information we can get about a process.
|
||||
* (unless otherwise specified, fields are read from /proc/#/stat)
|
||||
*
|
||||
* Most of it comes from task_struct in linux/sched.h
|
||||
*/
|
||||
// Basic data structure which holds all information we can get about a process.
|
||||
// (unless otherwise specified, fields are read from /proc/#/stat)
|
||||
//
|
||||
// Most of it comes from task_struct in linux/sched.h
|
||||
//
|
||||
typedef struct proc_t {
|
||||
// 1st 16 bytes
|
||||
int
|
||||
tid, /* process id */
|
||||
ppid; /* pid of parent process */
|
||||
tid, // (special) task id, the POSIX thread ID (see also: tgid)
|
||||
ppid; // stat,status pid of parent process
|
||||
unsigned
|
||||
pcpu; /* %CPU usage (is not filled in by readproc!!!) */
|
||||
pcpu; // stat (special) %CPU usage (is not filled in by readproc!!!)
|
||||
char
|
||||
state, /* single-char code for process state (S=sleeping) */
|
||||
pad_1, /* padding */
|
||||
pad_2, /* padding */
|
||||
pad_3; /* padding */
|
||||
state, // stat,status single-char code for process state (S=sleeping)
|
||||
pad_1, // n/a padding
|
||||
pad_2, // n/a padding
|
||||
pad_3; // n/a padding
|
||||
// 2nd 16 bytes
|
||||
unsigned long long
|
||||
utime, /* user-mode CPU time accumulated by process */
|
||||
stime, /* kernel-mode CPU time accumulated by process */
|
||||
utime, // stat user-mode CPU time accumulated by process
|
||||
stime, // stat kernel-mode CPU time accumulated by process
|
||||
// and so on...
|
||||
cutime, /* cumulative utime of process and reaped children */
|
||||
cstime, /* cumulative stime of process and reaped children */
|
||||
start_time; /* start time of process -- seconds since 1-1-70 */
|
||||
cutime, // stat cumulative utime of process and reaped children
|
||||
cstime, // stat cumulative stime of process and reaped children
|
||||
start_time; // stat start time of process -- seconds since 1-1-70
|
||||
#ifdef SIGNAL_STRING
|
||||
char
|
||||
/* Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding. */
|
||||
signal[18], /* mask of pending signals */
|
||||
blocked[18], /* mask of blocked signals */
|
||||
sigignore[18], /* mask of ignored signals */
|
||||
sigcatch[18]; /* mask of caught signals */
|
||||
// Linux 2.1.7x and up have 64 signals. Allow 64, plus '\0' and padding.
|
||||
signal[18], // status mask of pending signals
|
||||
blocked[18], // status mask of blocked signals
|
||||
sigignore[18], // status mask of ignored signals
|
||||
sigcatch[18]; // status mask of caught signals
|
||||
#else
|
||||
long long
|
||||
/* Linux 2.1.7x and up have 64 signals. */
|
||||
signal, /* mask of pending signals */
|
||||
blocked, /* mask of blocked signals */
|
||||
sigignore, /* mask of ignored signals */
|
||||
sigcatch; /* mask of caught signals */
|
||||
// Linux 2.1.7x and up have 64 signals.
|
||||
signal, // status mask of pending signals
|
||||
blocked, // status mask of blocked signals
|
||||
sigignore, // status mask of ignored signals
|
||||
sigcatch; // status mask of caught signals
|
||||
#endif
|
||||
long
|
||||
priority, /* kernel scheduling priority */
|
||||
timeout, /* ? */
|
||||
nice, /* standard unix nice level of process */
|
||||
rss, /* resident set size from /proc/#/stat (pages) */
|
||||
it_real_value, /* ? */
|
||||
/* the next 7 members come from /proc/#/statm */
|
||||
size, /* total # of pages of memory */
|
||||
resident, /* number of resident set (non-swapped) pages (4k) */
|
||||
share, /* number of pages of shared (mmap'd) memory */
|
||||
trs, /* text resident set size */
|
||||
lrs, /* shared-lib resident set size */
|
||||
drs, /* data resident set size */
|
||||
dt; /* dirty pages */
|
||||
priority, // stat kernel scheduling priority
|
||||
timeout, // stat ?
|
||||
nice, // stat standard unix nice level of process
|
||||
rss, // stat resident set size from /proc/#/stat (pages)
|
||||
it_real_value, // stat ?
|
||||
// the next 7 members come from /proc/#/statm
|
||||
size, // statm total # of pages of memory
|
||||
resident, // statm number of resident set (non-swapped) pages (4k)
|
||||
share, // statm number of pages of shared (mmap'd) memory
|
||||
trs, // statm text resident set size
|
||||
lrs, // statm shared-lib resident set size
|
||||
drs, // statm data resident set size
|
||||
dt; // statm dirty pages
|
||||
unsigned long
|
||||
vm_size, /* same as vsize in kb */
|
||||
vm_lock, /* locked pages in kb */
|
||||
vm_rss, /* same as rss in kb */
|
||||
vm_data, /* data size */
|
||||
vm_stack, /* stack size */
|
||||
vm_exe, /* executable size */
|
||||
vm_lib, /* library size (all pages, not just used ones) */
|
||||
rtprio, /* real-time priority */
|
||||
sched, /* scheduling class */
|
||||
vsize, /* number of pages of virtual memory ... */
|
||||
rss_rlim, /* resident set size limit? */
|
||||
flags, /* kernel flags for the process */
|
||||
min_flt, /* number of minor page faults since process start */
|
||||
maj_flt, /* number of major page faults since process start */
|
||||
cmin_flt, /* cumulative min_flt of process and child processes */
|
||||
cmaj_flt, /* cumulative maj_flt of process and child processes */
|
||||
nswap, /* ? */
|
||||
cnswap; /* cumulative nswap ? */
|
||||
vm_size, // status same as vsize in kb
|
||||
vm_lock, // status locked pages in kb
|
||||
vm_rss, // status same as rss in kb
|
||||
vm_data, // status data size
|
||||
vm_stack, // status stack size
|
||||
vm_exe, // status executable size
|
||||
vm_lib, // status library size (all pages, not just used ones)
|
||||
rtprio, // stat real-time priority
|
||||
sched, // stat scheduling class
|
||||
vsize, // stat number of pages of virtual memory ...
|
||||
rss_rlim, // stat resident set size limit?
|
||||
flags, // stat kernel flags for the process
|
||||
min_flt, // stat number of minor page faults since process start
|
||||
maj_flt, // stat number of major page faults since process start
|
||||
cmin_flt, // stat cumulative min_flt of process and child processes
|
||||
cmaj_flt, // stat cumulative maj_flt of process and child processes
|
||||
nswap, // stat ?
|
||||
cnswap; // stat cumulative nswap ?
|
||||
unsigned KLONG
|
||||
start_code, /* address of beginning of code segment */
|
||||
end_code, /* address of end of code segment */
|
||||
start_stack, /* address of the bottom of stack for the process */
|
||||
kstk_esp, /* kernel stack pointer */
|
||||
kstk_eip, /* kernel instruction pointer */
|
||||
wchan; /* address of kernel wait channel proc is sleeping in */
|
||||
start_code, // stat address of beginning of code segment
|
||||
end_code, // stat address of end of code segment
|
||||
start_stack, // stat address of the bottom of stack for the process
|
||||
kstk_esp, // stat kernel stack pointer
|
||||
kstk_eip, // stat kernel instruction pointer
|
||||
wchan; // stat (special) address of kernel wait channel proc is sleeping in
|
||||
char
|
||||
**environ, /* environment string vector (/proc/#/environ) */
|
||||
**cmdline; /* command line string vector (/proc/#/cmdline) */
|
||||
**environ, // (special) environment string vector (/proc/#/environ)
|
||||
**cmdline; // (special) command line string vector (/proc/#/cmdline)
|
||||
char
|
||||
/* Be compatible: Digital allows 16 and NT allows 14 ??? */
|
||||
ruser[16], /* real user name */
|
||||
euser[16], /* effective user name */
|
||||
suser[16], /* saved user name */
|
||||
fuser[16], /* filesystem user name */
|
||||
rgroup[16], /* real group name */
|
||||
egroup[16], /* effective group name */
|
||||
sgroup[16], /* saved group name */
|
||||
fgroup[16], /* filesystem group name */
|
||||
cmd[16]; /* basename of executable file in call to exec(2) */
|
||||
// Be compatible: Digital allows 16 and NT allows 14 ???
|
||||
euser[16], // stat(),status effective user name
|
||||
ruser[16], // status real user name
|
||||
suser[16], // status saved user name
|
||||
fuser[16], // status filesystem user name
|
||||
rgroup[16], // status real group name
|
||||
egroup[16], // status effective group name
|
||||
sgroup[16], // status saved group name
|
||||
fgroup[16], // status filesystem group name
|
||||
cmd[16]; // stat,status basename of executable file in call to exec(2)
|
||||
struct proc_t
|
||||
*ring, // thread group ring
|
||||
*next; // various library uses
|
||||
*ring, // n/a thread group ring
|
||||
*next; // n/a various library uses
|
||||
int
|
||||
ruid, rgid, /* real */
|
||||
euid, egid, /* effective */
|
||||
suid, sgid, /* saved */
|
||||
fuid, fgid, /* fs (used for file access only) */
|
||||
pgrp, /* process group id */
|
||||
session, /* session id */
|
||||
tty, /* full device number of controlling terminal */
|
||||
tpgid, /* terminal process group id */
|
||||
tgid, /* thread group ID */
|
||||
exit_signal, /* might not be SIGCHLD */
|
||||
processor; /* current (or most recent?) CPU */
|
||||
pgrp, // stat process group id
|
||||
session, // stat session id
|
||||
tgid, // (special) task group ID, the POSIX PID (see also: tid)
|
||||
tty, // stat full device number of controlling terminal
|
||||
euid, egid, // stat(),status effective
|
||||
ruid, rgid, // status real
|
||||
suid, sgid, // status saved
|
||||
fuid, fgid, // status fs (used for file access only)
|
||||
tpgid, // stat terminal process group id
|
||||
exit_signal, // stat might not be SIGCHLD
|
||||
processor; // stat current (or most recent?) CPU
|
||||
} proc_t;
|
||||
|
||||
/* PROCTAB: data structure holding the persistent information readproc needs
|
||||
* from openproc(). The setup is intentionally similar to the dirent interface
|
||||
* and other system table interfaces (utmp+wtmp come to mind).
|
||||
*/
|
||||
// PROCTAB: data structure holding the persistent information readproc needs
|
||||
// from openproc(). The setup is intentionally similar to the dirent interface
|
||||
// and other system table interfaces (utmp+wtmp come to mind).
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.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);
|
||||
proc_t*(*taskreader)(struct PROCTAB *restrict const, const proc_t *restrict const, proc_t *restrict const, char *restrict const);
|
||||
unsigned flags;
|
||||
pid_t* pids; /* pids of the procs */
|
||||
uid_t* uids; /* uids of procs */
|
||||
int nuid; /* cannot really sentinel-terminate unsigned short[] */
|
||||
pid_t* pids; // pids of the procs
|
||||
uid_t* uids; // uids of procs
|
||||
int nuid; // cannot really sentinel-terminate unsigned short[]
|
||||
int i; // generic
|
||||
unsigned u; // 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] */ );
|
||||
|
||||
|
||||
/* Convenient wrapper around openproc and readproc to slurp in the whole process
|
||||
* table subset satisfying the constraints of flags and the optional PID list.
|
||||
* Free allocated memory with exit(). Access via tab[N]->member. The pointer
|
||||
* list is NULL terminated.
|
||||
*/
|
||||
// Convenient wrapper around openproc and readproc to slurp in the whole process
|
||||
// table subset satisfying the constraints of flags and the optional PID list.
|
||||
// Free allocated memory with exit(). Access via tab[N]->member. The pointer
|
||||
// list is NULL terminated.
|
||||
|
||||
extern proc_t** readproctab(int flags, ... /* same as 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);
|
||||
|
||||
/* deallocate space allocated by readproc
|
||||
*/
|
||||
// deallocate space allocated by readproc
|
||||
|
||||
extern void freeproc(proc_t* p);
|
||||
|
||||
/* openproc/readproctab:
|
||||
*
|
||||
* Return PROCTAB* / *proc_t[] or NULL on error ((probably) "/proc" cannot be
|
||||
* 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
|
||||
* derived memory fields.
|
||||
*
|
||||
* `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"
|
||||
* options all use the second argument as the pointer to a list of objects:
|
||||
* process status', process id's, user id's. The third
|
||||
* argument is the length of the list (currently only used for lists of user
|
||||
* 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' */
|
||||
// openproc/readproctab:
|
||||
//
|
||||
// Return PROCTAB* / *proc_t[] or NULL on error ((probably) "/proc" cannot be
|
||||
// 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
|
||||
// derived memory fields.
|
||||
//
|
||||
// `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"
|
||||
// options all use the second argument as the pointer to a list of objects:
|
||||
// process status', process id's, user id's. The third
|
||||
// argument is the length of the list (currently only used for lists of user
|
||||
// id's since uid_t supports no convenient termination sentinel.)
|
||||
|
||||
/* 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 ) */
|
||||
#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_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
|
||||
#define PROC_SPARE_1 0x01000000
|
||||
|
@ -1,15 +1,15 @@
|
||||
Begin4
|
||||
Title: procps
|
||||
Version: 3.1.13
|
||||
Entered-date: 2003-09-17
|
||||
Version: 3.1.14
|
||||
Entered-date: 2003-09-26
|
||||
Description: Linux system utilities
|
||||
Keywords: procps /proc libproc sysctl pmap ps uptime tload
|
||||
free w top vmstat watch skill snice kill pgrep pkill
|
||||
Author: Albert Cahalan, Michael K. Johnson, Jim Warner, etc.
|
||||
Maintained-by: various <procps-feedback@lists.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
|
||||
242kB procps-3.1.13.tar.gz
|
||||
242kB procps-3.1.14.tar.gz
|
||||
Copying-policy: mixed
|
||||
End
|
||||
|
@ -3,7 +3,7 @@ Summary: System and process monitoring utilities
|
||||
Name: procps
|
||||
%define major_version 3
|
||||
%define minor_version 1
|
||||
%define revision 13
|
||||
%define revision 14
|
||||
%define version %{major_version}.%{minor_version}.%{revision}
|
||||
Version: %{version}
|
||||
Release: 1
|
||||
|
435
ps/output.c
435
ps/output.c
@ -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 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
|
||||
* pull out annoying BSD aliases into another table (to macro table?)
|
||||
* 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. */
|
||||
static const format_struct format_array[] = {
|
||||
/* code header print() sort() width need vendor flags */
|
||||
{"%cpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, BSD, RIGHT}, /*pcpu*/
|
||||
{"%mem", "%MEM", pr_pmem, sr_nop, 4, 0, BSD, RIGHT}, /*pmem*/
|
||||
{"acflag", "ACFLG", pr_nop, sr_nop, 5, 0, XXX, RIGHT}, /*acflg*/
|
||||
{"acflg", "ACFLG", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*acflag*/
|
||||
{"addr", "ADDR", pr_nop, sr_nop, 4, 0, XXX, RIGHT},
|
||||
{"addr_1", "ADDR", pr_nop, sr_nop, 1, 0, LNX, LEFT},
|
||||
{"alarm", "ALARM", pr_alarm, sr_it_real_value, 5, 0, LNX, RIGHT},
|
||||
{"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, RIGHT},
|
||||
{"args", "COMMAND", pr_args, sr_nop, 16, ARG, U98, UNLIMITED}, /*command*/
|
||||
{"atime", "TIME", pr_time, sr_nop, 8, 0, SOE, CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */
|
||||
{"blocked", "BLOCKED", pr_sigmask, sr_nop, 9, 0, BSD, SIGNAL}, /*sigmask*/
|
||||
{"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, RIGHT},
|
||||
{"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, RIGHT},
|
||||
{"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, RIGHT},
|
||||
{"c", "C", pr_c, sr_pcpu, 2, 0, SUN, RIGHT},
|
||||
{"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, SIGNAL}, /*sigcatch*/
|
||||
{"class", "CLS", pr_class, sr_sched, 3, 0, XXX, LEFT},
|
||||
{"cls", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT},
|
||||
{"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, RIGHT},
|
||||
{"cmd", "CMD", pr_args, sr_cmd, 16, ARG, DEC, UNLIMITED}, /*ucomm*/
|
||||
{"cmin_flt", "-", pr_nop, sr_cmin_flt, 1, 0, LNX, RIGHT},
|
||||
{"cnswap", "-", pr_nop, sr_cnswap, 1, 0, LNX, RIGHT},
|
||||
{"comm", "COMMAND", pr_comm, sr_nop, 16, COM, U98, UNLIMITED}, /*ucomm*/
|
||||
{"command", "COMMAND", pr_args, sr_nop, 16, ARG, XXX, UNLIMITED}, /*args*/
|
||||
{"context", "CONTEXT", pr_context, sr_context,40, 0, LNX, LEFT},
|
||||
{"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, RIGHT}, /*cpu*/
|
||||
{"cpu", "CPU", pr_nop, sr_nop, 3, 0, BSD, RIGHT}, /* FIXME ... HP-UX wants this as the CPU number for SMP? */
|
||||
{"cputime", "TIME", pr_time, sr_nop, 8, 0, DEC, RIGHT}, /*time*/
|
||||
{"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, RIGHT},
|
||||
{"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, RIGHT},
|
||||
{"cutime", "-", pr_nop, sr_cutime, 1, 0, LNX, RIGHT},
|
||||
{"cwd", "CWD", pr_nop, sr_nop, 3, 0, LNX, LEFT},
|
||||
{"drs", "DRS", pr_drs, sr_drs, 4, MEM, LNX, RIGHT},
|
||||
{"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, RIGHT},
|
||||
{"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, RIGHT},
|
||||
{"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, USER},
|
||||
{"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, RIGHT},
|
||||
{"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, RIGHT},
|
||||
{"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, UNLIMITED},
|
||||
{"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, RIGHT},
|
||||
{"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, RIGHT}, /* was 7 wide */
|
||||
{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, RIGHT},
|
||||
{"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, USER},
|
||||
{"f", "F", pr_flag, sr_nop, 1, 0, XXX, RIGHT}, /*flags*/
|
||||
{"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, RIGHT},
|
||||
{"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, USER},
|
||||
{"flag", "F", pr_flag, sr_flags, 1, 0, DEC, RIGHT},
|
||||
{"flags", "F", pr_flag, sr_flags, 1, 0, BSD, RIGHT}, /*f*/ /* was FLAGS, 8 wide */
|
||||
{"fname", "COMMAND", pr_fname, sr_nop, 8, 0, SUN, LEFT},
|
||||
{"fsgid", "FSGID", pr_fgid, sr_fgid, 5, 0, LNX, RIGHT},
|
||||
{"fsgroup", "FSGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, USER},
|
||||
{"fsuid", "FSUID", pr_fuid, sr_fuid, 5, 0, LNX, RIGHT},
|
||||
{"fsuser", "FSUSER", pr_fuser, sr_fuser, 8, USR, LNX, USER},
|
||||
{"fuid", "FUID", pr_fuid, sr_fuid, 5, 0, LNX, RIGHT},
|
||||
{"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, USER},
|
||||
{"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, RIGHT},
|
||||
{"group", "GROUP", pr_egroup, sr_egroup, 5, GRP, U98, USER}, /* was 8 wide */
|
||||
{"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, SIGNAL}, /*sigignore*/
|
||||
{"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*inblock*/
|
||||
{"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*inblk*/
|
||||
{"intpri", "PRI", pr_opri, sr_priority, 3, 0, HPU, RIGHT},
|
||||
{"jobc", "JOBC", pr_nop, sr_nop, 4, 0, XXX, RIGHT},
|
||||
{"ktrace", "KTRACE", pr_nop, sr_nop, 8, 0, BSD, RIGHT},
|
||||
{"ktracep", "KTRACEP", pr_nop, sr_nop, 8, 0, BSD, RIGHT},
|
||||
{"label", "LABEL", pr_nop, sr_nop, 25, 0, SGI, LEFT},
|
||||
{"lim", "LIM", pr_lim, sr_rss_rlim, 5, 0, BSD, RIGHT},
|
||||
{"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, LEFT}, /*logname*/ /* double check */
|
||||
{"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, LEFT}, /*login*/
|
||||
{"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, LEFT},
|
||||
{"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, RIGHT},
|
||||
{"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, RIGHT}, /* login ID */
|
||||
{"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, USER}, /* login USER */
|
||||
{"lwp", "LWP", pr_thread, sr_tid, 5, 0, SUN, PIDMAX|RIGHT},
|
||||
{"m_drs", "DRS", pr_drs, sr_drs, 5, MEM, LNx, RIGHT},
|
||||
{"m_dt", "DT", pr_nop, sr_dt, 4, MEM, LNx, RIGHT},
|
||||
{"m_lrs", "LRS", pr_nop, sr_lrs, 5, MEM, LNx, RIGHT},
|
||||
{"m_resident", "RES", pr_nop, sr_resident, 5,MEM, LNx, RIGHT},
|
||||
{"m_share", "SHRD", pr_nop, sr_share, 5, MEM, LNx, RIGHT},
|
||||
{"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, RIGHT},
|
||||
{"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, RIGHT},
|
||||
{"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, RIGHT},
|
||||
{"maj_flt", "MAJFL", pr_majflt, sr_maj_flt, 6, 0, LNX, CUMUL|RIGHT},
|
||||
{"majflt", "MAJFLT", pr_majflt, sr_maj_flt, 6, 0, XXX, RIGHT},
|
||||
{"min_flt", "MINFL", pr_minflt, sr_min_flt, 6, 0, LNX, CUMUL|RIGHT},
|
||||
{"minflt", "MINFLT", pr_minflt, sr_min_flt, 6, 0, XXX, RIGHT},
|
||||
{"msgrcv", "MSGRCV", pr_nop, sr_nop, 6, 0, XXX, RIGHT},
|
||||
{"msgsnd", "MSGSND", pr_nop, sr_nop, 6, 0, XXX, RIGHT},
|
||||
{"ni", "NI", pr_nice, sr_nice, 3, 0, BSD, RIGHT}, /*nice*/
|
||||
{"nice", "NI", pr_nice, sr_nice, 3, 0, U98, RIGHT}, /*ni*/
|
||||
{"nivcsw", "IVCSW", pr_nop, sr_nop, 5, 0, XXX, RIGHT},
|
||||
{"nlwp", "NLWP", pr_nlwp, sr_nop, 4, 0, SUN, RIGHT},
|
||||
{"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*nsigs*/
|
||||
{"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*nsignals*/
|
||||
{"nswap", "NSWAP", pr_nop, sr_nswap, 5, 0, XXX, RIGHT},
|
||||
{"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, RIGHT},
|
||||
{"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, RIGHT},
|
||||
{"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, RIGHT},
|
||||
{"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, RIGHT},
|
||||
{"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, RIGHT}, /*oublock*/
|
||||
{"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, RIGHT}, /*oublk*/
|
||||
{"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, RIGHT},
|
||||
{"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, RIGHT},
|
||||
{"pagein", "PAGEIN", pr_majflt, sr_nop, 6, 0, XXX, RIGHT},
|
||||
{"pcpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, U98, RIGHT}, /*%cpu*/
|
||||
{"pending", "PENDING", pr_sig, sr_nop, 9, 0, BSD, SIGNAL}, /*sig*/
|
||||
{"pgid", "PGID", pr_pgid, sr_pgrp, 5, 0, U98, PIDMAX|RIGHT},
|
||||
{"pgrp", "PGRP", pr_pgid, sr_pgrp, 5, 0, LNX, PIDMAX|RIGHT},
|
||||
{"pid", "PID", pr_pid, sr_tgid, 5, 0, U98, PIDMAX|RIGHT},
|
||||
{"pmem", "%MEM", pr_pmem, sr_nop, 4, 0, XXX, RIGHT}, /*%mem*/
|
||||
{"poip", "-", pr_nop, sr_nop, 1, 0, BSD, RIGHT},
|
||||
{"policy", "POL", pr_class, sr_sched, 3, 0, DEC, LEFT},
|
||||
{"ppid", "PPID", pr_ppid, sr_ppid, 5, 0, U98, PIDMAX|RIGHT},
|
||||
{"pri", "PRI", pr_pri, sr_nop, 3, 0, XXX, RIGHT},
|
||||
{"priority", "PRI", pr_priority, sr_priority, 3, 0, LNX, RIGHT}, /*ni,nice*/ /* from Linux sorting names */
|
||||
{"prmgrp", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT},
|
||||
{"prmid", "-", pr_nop, sr_nop, 1, 0, HPU, RIGHT},
|
||||
{"pset", "PSET", pr_nop, sr_nop, 4, 0, DEC, RIGHT},
|
||||
{"psr", "PSR", pr_psr, sr_nop, 3, 0, DEC, RIGHT},
|
||||
{"psxpri", "PPR", pr_nop, sr_nop, 3, 0, DEC, RIGHT},
|
||||
{"re", "RE", pr_nop, sr_nop, 3, 0, BSD, RIGHT},
|
||||
{"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, RIGHT},
|
||||
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, RIGHT},
|
||||
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, USER}, /* was 8 wide */
|
||||
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, RIGHT},
|
||||
{"rss", "RSS", pr_rss, sr_rss, 4, 0, XXX, RIGHT}, /* was 5 wide */
|
||||
{"rssize", "RSS", pr_rss, sr_vm_rss, 4, 0, DEC, RIGHT}, /*rsz*/
|
||||
{"rsz", "RSZ", pr_rss, sr_vm_rss, 4, 0, BSD, RIGHT}, /*rssize*/
|
||||
{"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, RIGHT},
|
||||
{"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, RIGHT},
|
||||
{"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, USER},
|
||||
{"s", "S", pr_s, sr_state, 1, 0, SUN, LEFT}, /*stat,state*/
|
||||
{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, RIGHT},
|
||||
{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, RIGHT}, /* man page misspelling of scount? */
|
||||
{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, RIGHT}, /* scnt==scount, DEC claims both */
|
||||
{"secsid", "SID", pr_secsid, sr_secsid, 6, 0, LNX, RIGHT}, /* Flask Linux */
|
||||
{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PIDMAX|RIGHT},
|
||||
{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PIDMAX|RIGHT},
|
||||
{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, RIGHT}, /* "cpu" number */
|
||||
{"sgi_rss", "RSS", pr_rss, sr_nop, 4, 0, LNX, LEFT}, /* SZ:RSS */
|
||||
{"sgid", "SGID", pr_sgid, sr_sgid, 5, 0, LNX, RIGHT},
|
||||
{"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, USER},
|
||||
{"share", "-", pr_nop, sr_share, 1, MEM, LNX, RIGHT},
|
||||
{"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PIDMAX|RIGHT}, /* Sun & HP */
|
||||
{"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, SIGNAL}, /*pending*/
|
||||
{"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, SIGNAL},
|
||||
{"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, SIGNAL},
|
||||
{"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, SIGNAL},
|
||||
{"sig_pend", "SIGNAL", pr_sig, sr_nop, 9, 0, LNX, SIGNAL},
|
||||
{"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, SIGNAL}, /*caught*/
|
||||
{"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, SIGNAL}, /*ignored*/
|
||||
{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, SIGNAL}, /*blocked*/
|
||||
{"size", "SZ", pr_swapable, sr_swapable, 1, 0, SCO, RIGHT},
|
||||
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, RIGHT},
|
||||
{"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, PIDMAX|RIGHT},
|
||||
{"stackp", "STACKP", pr_stackp, sr_nop, 8, 0, LNX, RIGHT}, /*start_stack*/
|
||||
{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, RIGHT},
|
||||
{"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, RIGHT},
|
||||
{"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, RIGHT}, /*stackp*/
|
||||
{"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, RIGHT},
|
||||
{"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, LEFT}, /*state,s*/
|
||||
{"state", "S", pr_s, sr_state, 1, 0, XXX, LEFT}, /*stat,s*/ /* was STAT */
|
||||
{"status", "STATUS", pr_nop, sr_nop, 6, 0, DEC, RIGHT},
|
||||
{"stime", "STIME", pr_stime, sr_stime, 5, 0, XXX, /* CUMUL| */RIGHT}, /* was 6 wide */
|
||||
{"suid", "SUID", pr_suid, sr_suid, 5, 0, LNx, RIGHT},
|
||||
{"suser", "SUSER", pr_suser, sr_suser, 8, USR, LNx, USER},
|
||||
{"svgid", "SVGID", pr_sgid, sr_sgid, 5, 0, XXX, RIGHT},
|
||||
{"svgroup", "SVGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, USER},
|
||||
{"svuid", "SVUID", pr_suid, sr_suid, 5, 0, XXX, RIGHT},
|
||||
{"svuser", "SVUSER", pr_suser, sr_suser, 8, USR, LNX, USER},
|
||||
{"systime", "SYSTEM", pr_nop, sr_nop, 6, 0, DEC, RIGHT},
|
||||
{"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, RIGHT},
|
||||
{"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, RIGHT},
|
||||
{"thcount", "THCNT", pr_nlwp, sr_nop, 5, 0, AIX, RIGHT},
|
||||
{"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, PIDMAX|RIGHT},
|
||||
{"time", "TIME", pr_time, sr_nop, 8, 0, U98, CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */
|
||||
{"timeout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, RIGHT},
|
||||
{"tmout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, RIGHT},
|
||||
{"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, LEFT},
|
||||
{"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, PIDMAX|RIGHT},
|
||||
{"trs", "TRS", pr_trs, sr_trs, 4, MEM, AIX, RIGHT},
|
||||
{"trss", "TRSS", pr_trs, sr_trs, 4, MEM, BSD, RIGHT}, /* 4.3BSD NET/2 */
|
||||
{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, PIDMAX|RIGHT},
|
||||
{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, PIDMAX|RIGHT},
|
||||
{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, RIGHT},
|
||||
{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, LEFT},
|
||||
{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
|
||||
{"tty4", "TTY", pr_tty4, sr_tty, 4, 0, LNX, LEFT},
|
||||
{"tty8", "TTY", pr_tty8, sr_tty, 8, 0, LNX, LEFT},
|
||||
{"u_procp", "UPROCP", pr_nop, sr_nop, 6, 0, DEC, RIGHT},
|
||||
{"ucmd", "CMD", pr_comm, sr_cmd, 16, COM, DEC, UNLIMITED}, /*ucomm*/
|
||||
{"ucomm", "COMMAND", pr_comm, sr_nop, 16, COM, XXX, UNLIMITED}, /*comm*/
|
||||
{"uid", "UID", pr_euid, sr_euid, 5, 0, XXX, RIGHT},
|
||||
{"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, USER},
|
||||
{"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, RIGHT},
|
||||
{"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, USER}, /* man page misspelling of user? */
|
||||
{"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, RIGHT}, /*usrpri*/
|
||||
{"uprocp", "-", pr_nop, sr_nop, 1, 0, BSD, RIGHT},
|
||||
{"user", "USER", pr_euser, sr_euser, 8, USR, U98, USER}, /* BSD n forces this to UID */
|
||||
{"usertime", "USER", pr_nop, sr_nop, 4, 0, DEC, RIGHT},
|
||||
{"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, RIGHT}, /*upr*/
|
||||
{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, CUMUL|RIGHT},
|
||||
{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, RIGHT},
|
||||
{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, RIGHT},
|
||||
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, RIGHT},
|
||||
{"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, RIGHT},
|
||||
{"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, RIGHT},
|
||||
{"vsize", "VSZ", pr_vsz, sr_vsize, 5, 0, DEC, RIGHT}, /*vsz*/
|
||||
{"vsz", "VSZ", pr_vsz, sr_vm_size, 5, 0, U98, RIGHT}, /*vsize*/
|
||||
{"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
|
||||
{"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, WCHAN}, /* opposite of nwchan */
|
||||
{"xstat", "XSTAT", pr_nop, sr_nop, 5, 0, BSD, RIGHT},
|
||||
{"~", "-", pr_nop, sr_nop, 1, 0, LNX, RIGHT} /* NULL would ruin alphabetical order */
|
||||
{"%cpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, BSD, ET|RIGHT}, /*pcpu*/
|
||||
{"%mem", "%MEM", pr_pmem, sr_nop, 4, 0, BSD, PO|RIGHT}, /*pmem*/
|
||||
{"acflag", "ACFLG", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT}, /*acflg*/
|
||||
{"acflg", "ACFLG", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*acflag*/
|
||||
{"addr", "ADDR", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
|
||||
{"addr_1", "ADDR", pr_nop, sr_nop, 1, 0, LNX, AN|LEFT},
|
||||
{"alarm", "ALARM", pr_alarm, sr_it_real_value,5, 0, LNX, AN|RIGHT},
|
||||
{"argc", "ARGC", pr_nop, sr_nop, 4, 0, LNX, PO|RIGHT},
|
||||
{"args", "COMMAND", pr_args, sr_nop, 16, ARG, U98, PO|UNLIMITED}, /*command*/
|
||||
{"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, TO|SIGNAL}, /*sigmask*/
|
||||
{"bnd", "BND", pr_nop, sr_nop, 1, 0, AIX, TO|RIGHT},
|
||||
{"bsdstart", "START", pr_bsdstart, sr_nop, 6, 0, LNX, AN|RIGHT},
|
||||
{"bsdtime", "TIME", pr_bsdtime, sr_nop, 6, 0, LNX, AN|RIGHT},
|
||||
{"c", "C", pr_c, sr_pcpu, 2, 0, SUN, ET|RIGHT},
|
||||
{"caught", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigcatch*/
|
||||
{"class", "CLS", pr_class, sr_sched, 3, 0, XXX, TO|LEFT},
|
||||
{"cls", "-", pr_nop, sr_nop, 1, 0, HPU, AN|RIGHT},
|
||||
{"cmaj_flt", "-", pr_nop, sr_cmaj_flt, 1, 0, LNX, AN|RIGHT},
|
||||
{"cmd", "CMD", pr_args, sr_cmd, 16, ARG, DEC, PO|UNLIMITED}, /*ucomm*/
|
||||
{"cmin_flt", "-", pr_nop, sr_cmin_flt, 1, 0, LNX, AN|RIGHT},
|
||||
{"cnswap", "-", pr_nop, sr_cnswap, 1, 0, LNX, AN|RIGHT},
|
||||
{"comm", "COMMAND", pr_comm, sr_nop, 16, COM, U98, PO|UNLIMITED}, /*ucomm*/
|
||||
{"command", "COMMAND", pr_args, sr_nop, 16, ARG, XXX, PO|UNLIMITED}, /*args*/
|
||||
{"context", "CONTEXT", pr_context, sr_context,40, 0, LNX, AN|LEFT},
|
||||
{"cp", "CP", pr_cp, sr_pcpu, 3, 0, DEC, ET|RIGHT}, /*cpu*/
|
||||
{"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, ET|RIGHT}, /*time*/
|
||||
{"cstime", "-", pr_nop, sr_cstime, 1, 0, LNX, AN|RIGHT},
|
||||
{"cursig", "CURSIG", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
|
||||
{"cutime", "-", pr_nop, sr_cutime, 1, 0, LNX, AN|RIGHT},
|
||||
{"cwd", "CWD", pr_nop, sr_nop, 3, 0, LNX, AN|LEFT},
|
||||
{"drs", "DRS", pr_drs, sr_drs, 4, MEM, LNX, ET|RIGHT},
|
||||
{"dsiz", "DSIZ", pr_dsiz, sr_nop, 4, 0, LNX, ET|RIGHT},
|
||||
{"egid", "EGID", pr_egid, sr_egid, 5, 0, LNX, ET|RIGHT},
|
||||
{"egroup", "EGROUP", pr_egroup, sr_egroup, 8, GRP, LNX, ET|USER},
|
||||
{"eip", "EIP", pr_eip, sr_kstk_eip, 8, 0, LNX, TO|RIGHT},
|
||||
{"end_code", "E_CODE", pr_nop, sr_end_code, 8, 0, LNx, PO|RIGHT},
|
||||
{"environ","ENVIRONMENT",pr_nop, sr_nop, 11, ENV, LNx, PO|UNLIMITED},
|
||||
{"esp", "ESP", pr_esp, sr_kstk_esp, 8, 0, LNX, PO|RIGHT},
|
||||
{"etime", "ELAPSED", pr_etime, sr_nop, 11, 0, U98, AN|RIGHT}, /* was 7 wide */
|
||||
{"euid", "EUID", pr_euid, sr_euid, 5, 0, LNX, ET|RIGHT},
|
||||
{"euser", "EUSER", pr_euser, sr_euser, 8, USR, LNX, ET|USER},
|
||||
{"f", "F", pr_flag, sr_nop, 1, 0, XXX, ET|RIGHT}, /*flags*/
|
||||
{"fgid", "FGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT},
|
||||
{"fgroup", "FGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER},
|
||||
{"flag", "F", pr_flag, sr_flags, 1, 0, DEC, ET|RIGHT},
|
||||
{"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, PO|LEFT},
|
||||
{"fsgid", "FSGID", pr_fgid, sr_fgid, 5, 0, LNX, ET|RIGHT},
|
||||
{"fsgroup", "FSGROUP", pr_fgroup, sr_fgroup, 8, GRP, LNX, ET|USER},
|
||||
{"fsuid", "FSUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT},
|
||||
{"fsuser", "FSUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER},
|
||||
{"fuid", "FUID", pr_fuid, sr_fuid, 5, 0, LNX, ET|RIGHT},
|
||||
{"fuser", "FUSER", pr_fuser, sr_fuser, 8, USR, LNX, ET|USER},
|
||||
{"gid", "GID", pr_egid, sr_egid, 5, 0, SUN, ET|RIGHT},
|
||||
{"group", "GROUP", pr_egroup, sr_egroup, 5, GRP, U98, ET|USER}, /* was 8 wide */
|
||||
{"ignored", "IGNORED", pr_sigignore,sr_nop, 9, 0, BSD, TO|SIGNAL}, /*sigignore*/
|
||||
{"inblk", "INBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*inblock*/
|
||||
{"inblock", "INBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*inblk*/
|
||||
{"intpri", "PRI", pr_opri, sr_priority, 3, 0, HPU, TO|RIGHT},
|
||||
{"jobc", "JOBC", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
|
||||
{"ktrace", "KTRACE", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
|
||||
{"ktracep", "KTRACEP", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
|
||||
{"label", "LABEL", pr_nop, sr_nop, 25, 0, SGI, AN|LEFT},
|
||||
{"lim", "LIM", pr_lim, sr_rss_rlim, 5, 0, BSD, AN|RIGHT},
|
||||
{"login", "LOGNAME", pr_nop, sr_nop, 8, 0, BSD, AN|LEFT}, /*logname*/ /* double check */
|
||||
{"logname", "LOGNAME", pr_nop, sr_nop, 8, 0, XXX, AN|LEFT}, /*login*/
|
||||
{"longtname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, AN|LEFT},
|
||||
{"lstart", "STARTED", pr_lstart, sr_nop, 24, 0, XXX, AN|RIGHT},
|
||||
{"luid", "LUID", pr_nop, sr_nop, 5, 0, LNX, ET|RIGHT}, /* login ID */
|
||||
{"luser", "LUSER", pr_nop, sr_nop, 8, USR, LNX, ET|USER}, /* login USER */
|
||||
{"lwp", "LWP", pr_thread, sr_tid, 5, 0, SUN, TO|PIDMAX|RIGHT},
|
||||
{"m_drs", "DRS", pr_drs, sr_drs, 5, MEM, LNx, PO|RIGHT},
|
||||
{"m_dt", "DT", pr_nop, sr_dt, 4, MEM, LNx, PO|RIGHT},
|
||||
{"m_lrs", "LRS", pr_nop, sr_lrs, 5, MEM, LNx, PO|RIGHT},
|
||||
{"m_resident", "RES", pr_nop, sr_resident, 5,MEM, LNx, PO|RIGHT},
|
||||
{"m_share", "SHRD", pr_nop, sr_share, 5, MEM, LNx, PO|RIGHT},
|
||||
{"m_size", "SIZE", pr_size, sr_size, 5, MEM, LNX, PO|RIGHT},
|
||||
{"m_swap", "SWAP", pr_nop, sr_nop, 5, 0, LNx, PO|RIGHT},
|
||||
{"m_trs", "TRS", pr_trs, sr_trs, 5, MEM, LNx, PO|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, AN|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, AN|RIGHT},
|
||||
{"msgrcv", "MSGRCV", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT},
|
||||
{"msgsnd", "MSGSND", pr_nop, sr_nop, 6, 0, XXX, AN|RIGHT},
|
||||
{"mwchan", "MWCHAN", pr_nop, sr_nop, 6, WCH, BSD, AN|WCHAN}, /* mutex (FreeBSD) */
|
||||
{"ni", "NI", pr_nice, sr_nice, 3, 0, BSD, TO|RIGHT}, /*nice*/
|
||||
{"nice", "NI", pr_nice, sr_nice, 3, 0, U98, TO|RIGHT}, /*ni*/
|
||||
{"nivcsw", "IVCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
|
||||
{"nlwp", "NLWP", pr_nlwp, sr_nop, 4, 0, SUN, AN|RIGHT},
|
||||
{"nsignals", "NSIGS", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*nsigs*/
|
||||
{"nsigs", "NSIGS", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*nsignals*/
|
||||
{"nswap", "NSWAP", pr_nop, sr_nswap, 5, 0, XXX, AN|RIGHT},
|
||||
{"nvcsw", "VCSW", pr_nop, sr_nop, 5, 0, XXX, AN|RIGHT},
|
||||
{"nwchan", "WCHAN", pr_nwchan, sr_nop, 6, 0, XXX, TO|RIGHT},
|
||||
{"opri", "PRI", pr_opri, sr_priority, 3, 0, SUN, TO|RIGHT},
|
||||
{"osz", "SZ", pr_nop, sr_nop, 2, 0, SUN, PO|RIGHT},
|
||||
{"oublk", "OUBLK", pr_nop, sr_nop, 5, 0, BSD, AN|RIGHT}, /*oublock*/
|
||||
{"oublock", "OUBLK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT}, /*oublk*/
|
||||
{"p_ru", "P_RU", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
|
||||
{"paddr", "PADDR", pr_nop, sr_nop, 6, 0, BSD, AN|RIGHT},
|
||||
{"pagein", "PAGEIN", pr_majflt, sr_nop, 6, 0, XXX, AN|RIGHT},
|
||||
{"pcpu", "%CPU", pr_pcpu, sr_pcpu, 4, 0, U98, TO|RIGHT}, /*%cpu*/
|
||||
{"pending", "PENDING", pr_sig, sr_nop, 9, 0, BSD, ET|SIGNAL}, /*sig*/
|
||||
{"pgid", "PGID", pr_pgid, sr_pgrp, 5, 0, U98, PO|PIDMAX|RIGHT},
|
||||
{"pgrp", "PGRP", pr_pgid, sr_pgrp, 5, 0, LNX, PO|PIDMAX|RIGHT},
|
||||
{"pid", "PID", pr_pid, sr_tgid, 5, 0, U98, PO|PIDMAX|RIGHT},
|
||||
{"pmem", "%MEM", pr_pmem, sr_nop, 4, 0, XXX, PO|RIGHT}, /*%mem*/
|
||||
{"poip", "-", pr_nop, sr_nop, 1, 0, BSD, AN|RIGHT},
|
||||
{"policy", "POL", pr_class, sr_sched, 3, 0, DEC, TO|LEFT},
|
||||
{"ppid", "PPID", pr_ppid, sr_ppid, 5, 0, U98, AN|PIDMAX|RIGHT},
|
||||
{"pri", "PRI", pr_pri, sr_nop, 3, 0, XXX, TO|RIGHT},
|
||||
{"priority", "PRI", pr_priority, sr_priority, 3, 0, LNX, TO|RIGHT}, /*ni,nice*/ /* from Linux sorting names */
|
||||
{"prmgrp", "-", pr_nop, sr_nop, 1, 0, HPU, PO|RIGHT},
|
||||
{"prmid", "-", pr_nop, sr_nop, 1, 0, HPU, PO|RIGHT},
|
||||
{"pset", "PSET", pr_nop, sr_nop, 4, 0, DEC, TO|RIGHT},
|
||||
{"psr", "PSR", pr_psr, sr_nop, 3, 0, DEC, TO|RIGHT},
|
||||
{"psxpri", "PPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT},
|
||||
{"re", "RE", pr_nop, sr_nop, 3, 0, BSD, AN|RIGHT},
|
||||
{"resident", "RES", pr_nop, sr_resident, 5,MEM, LNX, PO|RIGHT},
|
||||
{"rgid", "RGID", pr_rgid, sr_rgid, 5, 0, XXX, ET|RIGHT},
|
||||
{"rgroup", "RGROUP", pr_rgroup, sr_rgroup, 8, GRP, U98, ET|USER}, /* was 8 wide */
|
||||
{"rlink", "RLINK", pr_nop, sr_nop, 8, 0, BSD, AN|RIGHT},
|
||||
{"rss", "RSS", pr_rss, sr_rss, 4, 0, XXX, PO|RIGHT}, /* was 5 wide */
|
||||
{"rssize", "RSS", pr_rss, sr_vm_rss, 4, 0, DEC, PO|RIGHT}, /*rsz*/
|
||||
{"rsz", "RSZ", pr_rss, sr_vm_rss, 4, 0, BSD, PO|RIGHT}, /*rssize*/
|
||||
{"rtprio", "RTPRIO", pr_rtprio, sr_rtprio, 6, 0, BSD, TO|RIGHT},
|
||||
{"ruid", "RUID", pr_ruid, sr_ruid, 5, 0, XXX, ET|RIGHT},
|
||||
{"ruser", "RUSER", pr_ruser, sr_ruser, 8, USR, U98, ET|USER},
|
||||
{"s", "S", pr_s, sr_state, 1, 0, SUN, ET|LEFT}, /*stat,state*/
|
||||
{"sched", "SCH", pr_sched, sr_sched, 3, 0, AIX, TO|RIGHT},
|
||||
{"scnt", "SCNT", pr_nop, sr_nop, 4, 0, DEC, AN|RIGHT}, /* man page misspelling of scount? */
|
||||
{"scount", "SC", pr_nop, sr_nop, 4, 0, AIX, AN|RIGHT}, /* scnt==scount, DEC claims both */
|
||||
{"secsid", "SID", pr_secsid, sr_secsid, 6, 0, LNX, AN|RIGHT}, /* Flask Linux */
|
||||
{"sess", "SESS", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT},
|
||||
{"session", "SESS", pr_sess, sr_session, 5, 0, LNX, PO|PIDMAX|RIGHT},
|
||||
{"sgi_p", "P", pr_sgi_p, sr_nop, 1, 0, LNX, TO|RIGHT}, /* "cpu" number */
|
||||
{"sgi_rss", "RSS", pr_rss, sr_nop, 4, 0, LNX, PO|LEFT}, /* SZ:RSS */
|
||||
{"sgid", "SGID", pr_sgid, sr_sgid, 5, 0, LNX, ET|RIGHT},
|
||||
{"sgroup", "SGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER},
|
||||
{"share", "-", pr_nop, sr_share, 1, MEM, LNX, PO|RIGHT},
|
||||
{"sid", "SID", pr_sess, sr_session, 5, 0, XXX, PO|PIDMAX|RIGHT}, /* Sun & HP */
|
||||
{"sig", "PENDING", pr_sig, sr_nop, 9, 0, XXX, ET|SIGNAL}, /*pending*/
|
||||
{"sig_block", "BLOCKED", pr_sigmask, sr_nop, 9, 0, LNX, TO|SIGNAL},
|
||||
{"sig_catch", "CATCHED", pr_sigcatch, sr_nop, 9, 0, LNX, TO|SIGNAL},
|
||||
{"sig_ignore", "IGNORED",pr_sigignore, sr_nop, 9, 0, LNX, TO|SIGNAL},
|
||||
{"sig_pend", "SIGNAL", pr_sig, sr_nop, 9, 0, LNX, ET|SIGNAL},
|
||||
{"sigcatch", "CAUGHT", pr_sigcatch, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*caught*/
|
||||
{"sigignore", "IGNORED", pr_sigignore,sr_nop, 9, 0, XXX, TO|SIGNAL}, /*ignored*/
|
||||
{"sigmask", "BLOCKED", pr_sigmask, sr_nop, 9, 0, XXX, TO|SIGNAL}, /*blocked*/
|
||||
{"size", "SZ", pr_swapable, sr_swapable, 1, 0, SCO, PO|RIGHT},
|
||||
{"sl", "SL", pr_nop, sr_nop, 3, 0, XXX, AN|RIGHT},
|
||||
{"spid", "SPID", pr_thread, sr_tid, 5, 0, SGI, TO|PIDMAX|RIGHT},
|
||||
{"stackp", "STACKP", pr_stackp, sr_nop, 8, 0, LNX, AN|RIGHT}, /*start_stack*/
|
||||
{"start", "STARTED", pr_start, sr_nop, 8, 0, XXX, AN|RIGHT},
|
||||
{"start_code", "S_CODE", pr_nop, sr_start_code, 8, 0, LNx, PO|RIGHT},
|
||||
{"start_stack", "STACKP", pr_stackp, sr_start_stack, 8, 0, LNX, PO|RIGHT}, /*stackp*/
|
||||
{"start_time", "START", pr_stime, sr_start_time, 5, 0, LNx, AN|RIGHT},
|
||||
{"stat", "STAT", pr_stat, sr_state, 4, 0, BSD, TO|LEFT}, /*state,s*/
|
||||
{"state", "S", pr_s, sr_state, 1, 0, XXX, TO|LEFT}, /*stat,s*/ /* was STAT */
|
||||
{"status", "STATUS", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
|
||||
{"stime", "STIME", pr_stime, sr_stime, 5, 0, XXX, AN|/* CUMUL| */RIGHT}, /* was 6 wide */
|
||||
{"suid", "SUID", pr_suid, sr_suid, 5, 0, LNx, ET|RIGHT},
|
||||
{"suser", "SUSER", pr_suser, sr_suser, 8, USR, LNx, ET|USER},
|
||||
{"svgid", "SVGID", pr_sgid, sr_sgid, 5, 0, XXX, ET|RIGHT},
|
||||
{"svgroup", "SVGROUP", pr_sgroup, sr_sgroup, 8, GRP, LNX, ET|USER},
|
||||
{"svuid", "SVUID", pr_suid, sr_suid, 5, 0, XXX, ET|RIGHT},
|
||||
{"svuser", "SVUSER", pr_suser, sr_suser, 8, USR, LNX, ET|USER},
|
||||
{"systime", "SYSTEM", pr_nop, sr_nop, 6, 0, DEC, ET|RIGHT},
|
||||
{"sz", "SZ", pr_sz, sr_nop, 5, 0, HPU, PO|RIGHT},
|
||||
{"tdev", "TDEV", pr_nop, sr_nop, 4, 0, XXX, AN|RIGHT},
|
||||
{"thcount", "THCNT", pr_nlwp, sr_nop, 5, 0, AIX, AN|RIGHT},
|
||||
{"tid", "TID", pr_thread, sr_tid, 5, 0, AIX, TO|PIDMAX|RIGHT},
|
||||
{"time", "TIME", pr_time, sr_nop, 8, 0, U98, ET|CUMUL|RIGHT}, /*cputime*/ /* was 6 wide */
|
||||
{"timeout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, AN|RIGHT},
|
||||
{"tmout", "TMOUT", pr_timeout, sr_timeout, 5, 0, LNX, AN|RIGHT},
|
||||
{"tname", "TTY", pr_tty8, sr_tty, 8, 0, DEC, AN|LEFT},
|
||||
{"tpgid", "TPGID", pr_tpgid, sr_tpgid, 5, 0, XXX, AN|PIDMAX|RIGHT},
|
||||
{"trs", "TRS", pr_trs, sr_trs, 4, MEM, AIX, PO|RIGHT},
|
||||
{"trss", "TRSS", pr_trs, sr_trs, 4, MEM, BSD, PO|RIGHT}, /* 4.3BSD NET/2 */
|
||||
{"tsess", "TSESS", pr_nop, sr_nop, 5, 0, BSD, AN|PIDMAX|RIGHT},
|
||||
{"tsession", "TSESS", pr_nop, sr_nop, 5, 0, DEC, AN|PIDMAX|RIGHT},
|
||||
{"tsiz", "TSIZ", pr_tsiz, sr_nop, 4, 0, BSD, AN|RIGHT},
|
||||
{"tt", "TT", pr_tty8, sr_tty, 8, 0, BSD, AN|LEFT},
|
||||
{"tty", "TT", pr_tty8, sr_tty, 8, 0, U98, AN|LEFT}, /* Unix98 requires "TT" but has "TTY" too. :-( */ /* was 3 wide */
|
||||
{"tty4", "TTY", pr_tty4, sr_tty, 4, 0, LNX, AN|LEFT},
|
||||
{"tty8", "TTY", pr_tty8, sr_tty, 8, 0, LNX, AN|LEFT},
|
||||
{"u_procp", "UPROCP", pr_nop, sr_nop, 6, 0, DEC, AN|RIGHT},
|
||||
{"ucmd", "CMD", pr_comm, sr_cmd, 16, COM, DEC, PO|UNLIMITED}, /*ucomm*/
|
||||
{"ucomm", "COMMAND", pr_comm, sr_nop, 16, COM, XXX, PO|UNLIMITED}, /*comm*/
|
||||
{"uid", "UID", pr_euid, sr_euid, 5, 0, XXX, ET|RIGHT},
|
||||
{"uid_hack", "UID", pr_euser, sr_nop, 8, USR, XXX, ET|USER},
|
||||
{"umask", "UMASK", pr_nop, sr_nop, 5, 0, DEC, AN|RIGHT},
|
||||
{"uname", "USER", pr_euser, sr_euser, 8, USR, DEC, AN|USER}, /* man page misspelling of user? */
|
||||
{"upr", "UPR", pr_nop, sr_nop, 3, 0, BSD, TO|RIGHT}, /*usrpri*/
|
||||
{"uprocp", "-", pr_nop, sr_nop, 1, 0, BSD, AN|RIGHT},
|
||||
{"user", "USER", pr_euser, sr_euser, 8, USR, U98, ET|USER}, /* BSD n forces this to UID */
|
||||
{"usertime", "USER", pr_nop, sr_nop, 4, 0, DEC, ET|RIGHT},
|
||||
{"usrpri", "UPR", pr_nop, sr_nop, 3, 0, DEC, TO|RIGHT}, /*upr*/
|
||||
{"utime", "UTIME", pr_nop, sr_utime, 6, 0, LNx, ET|CUMUL|RIGHT},
|
||||
{"vm_data", "DATA", pr_nop, sr_vm_data, 5, 0, LNx, PO|RIGHT},
|
||||
{"vm_exe", "EXE", pr_nop, sr_vm_exe, 5, 0, LNx, PO|RIGHT},
|
||||
{"vm_lib", "LIB", pr_nop, sr_vm_lib, 5, 0, LNx, PO|RIGHT},
|
||||
{"vm_lock", "LCK", pr_nop, sr_vm_lock, 3, 0, LNx, PO|RIGHT},
|
||||
{"vm_stack", "STACK", pr_nop, sr_vm_stack, 5, 0, LNx, PO|RIGHT},
|
||||
{"vsize", "VSZ", pr_vsz, sr_vsize, 5, 0, DEC, PO|RIGHT}, /*vsz*/
|
||||
{"vsz", "VSZ", pr_vsz, sr_vm_size, 5, 0, U98, PO|RIGHT}, /*vsize*/
|
||||
{"wchan", "WCHAN", pr_wchan, sr_wchan, 6, WCH, XXX, TO|WCHAN}, /* BSD n forces this to nwchan */ /* was 10 wide */
|
||||
{"wname", "WCHAN", pr_wname, sr_nop, 6, WCH, SGI, TO|WCHAN}, /* opposite of nwchan */
|
||||
{"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);
|
||||
|
||||
|
||||
|
@ -315,10 +315,12 @@ static const char *parse_sysv_option(void){
|
||||
exclusive("-V");
|
||||
display_version();
|
||||
exit(0);
|
||||
#if 0
|
||||
case 'Z': /* full Mandatory Access Control level info */
|
||||
trace("-Z shows full MAC info\n");
|
||||
return "Don't understand MAC on Linux.";
|
||||
break;
|
||||
#endif
|
||||
case 'a':
|
||||
trace("-a select all with a tty, but omit session leaders.\n");
|
||||
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");
|
||||
format_modifiers |= FM_y;
|
||||
break;
|
||||
#if 0
|
||||
case 'z': /* alias of Mandatory Access Control level info */
|
||||
trace("-z shows aliased MAC info\n");
|
||||
return "Don't understand MAC on Linux.";
|
||||
break;
|
||||
#endif
|
||||
case '-':
|
||||
return "Embedded '-' among SysV options makes no sense.";
|
||||
break;
|
||||
@ -595,11 +599,13 @@ static const char *parse_bsd_option(void){
|
||||
trace("j job control format\n");
|
||||
format_flags |= FF_Bj;
|
||||
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");
|
||||
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
|
||||
break;
|
||||
#endif
|
||||
case 'l':
|
||||
trace("l Display long format\n");
|
||||
format_flags |= FF_Bl;
|
||||
|
14
ps/select.c
14
ps/select.c
@ -17,13 +17,13 @@
|
||||
#include "../proc/readproc.h"
|
||||
#include "../proc/procps.h"
|
||||
|
||||
#define session_leader(p) ((p)->session == (p)->tgid)
|
||||
#define process_group_leader(p) ((p)->pgid == (p)->tgid)
|
||||
#define without_a_tty(p) ((unsigned short)((p)->tty) == (unsigned short)0)
|
||||
#define some_other_user(p) ((p)->euid != cached_euid)
|
||||
//#define process_group_leader(p) ((p)->pgid == (p)->tgid)
|
||||
//#define some_other_user(p) ((p)->euid != cached_euid)
|
||||
#define has_our_euid(p) ((unsigned)(p)->euid == (unsigned)cached_euid)
|
||||
#define on_our_tty(p) ((unsigned)(p)->tty == (unsigned)cached_tty)
|
||||
#define running(p) (((p)->state=='R')||((p)->state=='D'))
|
||||
#define has_our_euid(p) ((unsigned short)((p)->euid) == (unsigned short)cached_euid)
|
||||
#define on_our_tty(p) ((unsigned short)((p)->tty) == (unsigned short)cached_tty)
|
||||
#define session_leader(p) ((p)->session == (p)->tgid)
|
||||
#define without_a_tty(p) (!(p)->tty)
|
||||
|
||||
static unsigned long select_bits = 0;
|
||||
|
||||
@ -87,7 +87,7 @@ static int proc_was_listed(proc_t *buf){
|
||||
|
||||
#define return_if_match(foo,bar) \
|
||||
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
|
||||
|
||||
break; case SEL_RUID: return_if_match(ruid,uid);
|
||||
|
Loading…
Reference in New Issue
Block a user