Proc-ProcessTable
view release on metacpan or search on metacpan
os/Cygwin.h view on Meta::CPAN
* I wanted init_static_vars to be at the way top close to the global vars */
static char *read_file(const char *path, const char *extra_path, off_t *len,
struct obstack *mem_pool);
struct procstat
{
/* user/group id of the user running it */
int uid;
int gid;
/* values scraped from /proc/{$pid}/stat */
pid_t pid;
char comm[NAME_MAX];
char state_c;
int ppid;
int pgrp;
int sid;
int tty;
unsigned flags;
unsigned long minflt, cminflt, majflt, cmajflt;
unsigned long long utime, stime;
long long cutime, cstime;
long priority;
unsigned long long start_time;
unsigned long vsize;
long rss;
/* these are derived from above time values */
unsigned long long time, ctime;
/* from above state_c but fixed up elsewhere */
const char *state;
/* values scraped from /proc/{$pid}/status */
int euid, suid, fuid;
int egid, sgid, fgid;
/* cwd, cmdline & exec files; values allocated at the end of obstacks */
char *cwd;
char *cmndline;
char *cmdline;
int cmdline_len;
char *environ;
int environ_len;
char *exec;
/* other values */
char pctcpu[LENGTH_PCTCPU]; /* percent cpu, without '%' char */
char pctmem[sizeof("100.00")]; /* percent memory, without '%' char */
/* extra Windows stuff */
char *winexename;
int winpid;
};
enum state
{
SLEEP,
RUN,
DEFUNCT,
STOP,
UWAIT,
};
/* strings, to make sure they get placed in read only memory,
* ditto for pointers to them and so we avoid relocations */
static const char strings[] =
{
/* process state */
"sleep\0"
"run\0"
"defunct\0"
"stop\0"
"uwait\0"
/* error messages */
"/proc unavailable\0"
"initialization failed\0"
/* fields */
"uid\0"
"gid\0"
"pid\0"
"fname\0"
"ppid\0"
"pgrp\0"
"sess\0"
"ttynum\0"
"flags\0"
"minflt\0"
"cminflt\0"
"majflt\0"
"cmajflt\0"
"utime\0"
"stime\0"
"cutime\0"
"cstime\0"
"priority\0"
"start\0"
"size\0"
"rss\0"
"time\0"
"ctime\0"
"state\0"
"euid\0"
"suid\0"
"fuid\0"
"egid\0"
"sgid\0"
"fgid\0"
"pctcpu\0"
"pctmem\0"
"cmndline\0"
"exec\0"
"cwd\0"
"cmdline\0"
"environ\0"
"winexename\0"
"winpid\0"
/* format string */
"IIISIIIILLLLLJJJJIJPLJJSIIIIIISSSSSAASI\0"
};
static const size_t strings_index[] =
{
/* process status strings */
0, /* 6 sleep */
6, /* 4 run */
( run in 0.460 second using v1.01-cache-2.11-cpan-71847e10f99 )