|
|
1.1 root 1: /*
2: * Define useful symbols for use in the ps program.
3: */
4: #ifndef PS_H /* Rest of file. */
5: #define PS_H
6:
7: #include <sys/proc.h>
8: #include <sys/uproc.h>
9:
10: /*
11: * These flags, ar_proc_flags, indicate which processes should be printed.
12: */
13: #define ALL_PROC 0x0001 /* All processes */
14: #define DRIVER 0x0002 /* Print drivers */
15: #define SPECIAL 0x0004 /* Get special processes */
16: #define USER 0x0008 /* All processes for a given user */
17: #define ATTY 0x0010 /* All processes for a given tty */
18:
19: /*
20: * These flags indicate which fields should be printed. There are
21: * two kinds of these--flags that indicate a format and flags that
22: * indicate specific fields. They are the ar_field_flags.
23: */
24: #define ALL_FIELDS 0x0001 /* Print out all fields */
25: #define LONG_FMT 0x0002 /* Long format */
26: #define WIDE_FMT 0x0004 /* Wide format */
27: #define PID_ONLY 0x0008 /* Print only PIDs */
28:
29: #define GROUPS 0x0100 /* Print out process groups */
30: #define SCHED 0x0200 /* Print scheduling values */
31: #define TIMES 0x0400 /* Print times */
32:
33: /*
34: * These are miscellaneous flags, ar_msc_flags.
35: */
36: #define REAL_SIZES 0x0001 /* Print out real sizes */
37: #define NO_HEAD 0x0002 /* No header */
38: #define DEBUG 0x0004 /* Debug flag */
39: #define IGN_PRESENT 0x0008 /* UNDOCUMENTED: ignore present bit. */
40:
41:
42: /*
43: * Here we define some assorted handy values.
44: */
45: typedef int boolean;
46: #define TRUE (1==1)
47: #define FALSE (1==2)
48: #ifndef NULL
49: #define NULL ((char *) 0)
50: #endif /* NULL */
51:
52: /*
53: * This structure contains pointers to all structures which might
54: * describe part of a process.
55: *
56: * We keep these critters in an array which we build on demand.
57: */
58: typedef struct {
59: PROC *pr_proc; /* Insert the process table entry here. */
60: UPROC *pr_u; /* Insert the u area here. */
61: char *pr_argv[]; /* Insert the argument vector here. */
62: char pr_argc; /* Insert the number of args here. */
63: } PROC_DATA;
64:
65: /*
66: * This structure contains a predigested version of the arguments to ps.
67: */
68: typedef struct {
69: unsigned ar_proc_flags; /* Which processes should be printed? */
70: unsigned ar_field_flags; /* Which fields should be printed? */
71: unsigned ar_msc_flags; /* This is other useful info. */
72:
73: } PROC_ARGS;
74:
75: void main();
76: void cvt_args(); /* Digest the command line. */
77: PROC *create_proc_table(); /* Read in the process table. */
78: PROC_DATA *create_proc_data(); /* Fill in data about each process. */
79: void print_headers(); /* Print column headings. */
80: boolean wanted_process(); /* Do we want to print this process? */
81: void print_process(); /* Print information about this process. */
82: void print_tty(); /* Print a text name for a tty. */
83: char *user_name(); /* Convert uid to a user name. */
84: char *kumap(); /* Map some kernel memory into user space. */
85: char state(); /* Is the process asleep, running, or zombie? */
86: void print_time(); /* Print a HZ time. */
87: void print_command(); /* Print the command for this process. */
88: void print_event(); /* Print out the reason for a sleep. */
89: #endif /* PS_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.