/*
* Structure definition for accessing "stat" files in the
* /proc filesystem. This was taken directly from the
* Linux proc(5) man page.
*
* This file is part of PerfSuite.
*/
#define MAXCOMMSIZ 256
typedef struct {
int pid; /* Process ID */
char comm[MAXCOMMSIZ]; /* The filename of the executable, in
* parentheses. This is visible
* whether or not the executable is
* swapped out.
*/
char state; /* One character from the string
* "RSDZT" where R is running, S is
* sleeping in an interruptible wait, D
* is sleeping in an uninterruptible
* wait or swapping, Z is zombie, and T
* is traced or stopped (on a signal).
*/
int ppid; /* The PID of the parent. */
int pgrp; /* The process group ID of the process. */
int session; /* The session ID of the process. */
int tty; /* The tty the process uses. */
int tpgid; /* The process group ID of the process
* which currently owns the tty that
* the process is connected to.
*/
unsigned flags; /* The flags of the process.
* Currently, every flag has the math
* bit set, because crt0.s checks for
* math emulation, so this is not
* included in the output. This is
* probably a bug, as not every process
* is a compiled C program. The math
* bit should be a decimal 4, and the
* traced bit is a decimal 10.
*/
unsigned minflt; /* The number of minor faults the
* process has made, those which have
* not required loading a memory page
* from disk.
*/
unsigned cminflt; /* The number of minor faults that the
* process and its children have made.
*/
unsigned majflt; /* The number of major faults the
* process has made, those which have
* required loading a memory page from
* disk.
*/
unsigned cmajflt; /* The number of major faults that the
* process and its children have made.
*/
int utime; /* The number of jiffies that this
* process has been scheduled in user
* mode.
*/
int stime; /* The number of jiffies that this
* process has been scheduled in kernel
* mode.
*/
int cutime; /* The number of jiffies that this
* process and its children have been
* scheduled in kernel mode.
*/
int cstime; /* The number of jiffies that this
* process and its children have been
* scheduled in kernel mode.
*/
int counter; /* The current maximum size in jiffies
* of the process' next timeslice, or
* what is currently left of its
* current timeslice, if it is the
* currently running process.
*/
int priority; /* The standard nice value, plus
* fifteen. The value is never
* negative in the kernel.
*/
unsigned timeout; /* The time in jiffies of the process'
* next timeout.
*/
unsigned itrealvalue; /* The time (in jiffies) before the
* next SIGALRM is sent to the process
* due to an interval timer.
*/
int starttime; /* Time the process started in jiffies
* after system boot.
*/
unsigned vsize; /* Virtual memory size */
unsigned rss; /* Resident Set Size: number of pages
* the process has in real memory,
* minus 3 for administrative purposes.
* This is just the pages which count
* towards text, data, or stack space.
* This does not include pages which
* have not been demand-loaded in, or
* which are swapped out.
*/
unsigned rlim; /* Current limit in bytes on the rss of
* the process (usually 2,147,483,647).
*/
unsigned startcode; /* The address above which program text
* can run.
*/
unsigned endcode; /* The address below which program text
* can run.
*/
unsigned startstack; /* The address of the start of the
* stack.
*/
unsigned kstkesp; /* The current value of esp (32-bit
* stack pointer), as found in the
* kernel stack page for the process.
*/
unsigned kstkeip; /* The current EIP (32-bit instruction
* pointer).
*/
int signal; /* The bitmap of pending signals
* (usually 0).
*/
int blocked; /* The bitmap of blocked signals
* (usually 0, 2 for shells).
*/
int sigignore; /* The bitmap of ignored signals. */
int sigcatch; /* The bitmap of catched signals. */
unsigned wchan; /* This is the "channel" in which the
* process is waiting. This is the
* address of a system call, and can be
* looked up in a namelist if you need
* a textual name. (If you have an up-
* to-date /etc/psdatabase, then try ps -l
* to see the WCHAN field in action)
*/
} ps_procstat_t;