Commit | Line | Data |
---|---|---|
8761ac34 | 1 | /* proc.h 3.2 %H% */ |
5cb51551 BJ |
2 | |
3 | /* | |
4 | * One structure allocated per active | |
5 | * process. It contains all data needed | |
6 | * about the process while the | |
7 | * process may be swapped out. | |
8 | * Other per process data (user.h) | |
9 | * is swapped with the process. | |
10 | * | |
11 | * NB: OFFSETS HERE ARE ALSO DEFINED IN proc.m | |
12 | */ | |
13 | struct proc | |
14 | { | |
15 | struct proc *p_link; /* linked list of running processes */ | |
16 | struct proc *p_rlink; | |
17 | struct pte *p_addr; /* u-area kernel map address */ | |
18 | char p_usrpri; /* user-priority based on p_cpu and p_nice */ | |
19 | char p_pri; /* priority, negative is high */ | |
20 | char p_cpu; /* cpu usage for scheduling */ | |
21 | char p_stat; | |
22 | char p_time; /* resident time for scheduling */ | |
23 | char p_nice; /* nice for cpu usage */ | |
24 | char p_slptime; /* time since last block */ | |
25 | int p_flag; | |
26 | int p_sig; /* signals pending to this process */ | |
27 | int p_ignsig; /* ignored signals */ | |
28 | short p_uid; /* user id, used to direct tty signals */ | |
29 | short p_pgrp; /* name of process group leader */ | |
30 | short p_pid; /* unique process id */ | |
31 | short p_ppid; /* process id of parent */ | |
32 | short p_poip; /* count of page outs in progress */ | |
33 | short p_szpt; /* copy of page table size */ | |
34 | size_t p_tsize; /* size of text (clicks) */ | |
35 | size_t p_dsize; /* size of data space (clicks) */ | |
36 | size_t p_ssize; /* copy of stack size (clicks) */ | |
37 | size_t p_rssize; /* current resident set size in clicks */ | |
38 | size_t p_swrss; /* resident set size before last swap */ | |
39 | swblk_t p_swaddr; /* disk address of u area when swapped */ | |
40 | caddr_t p_wchan; /* event process is awaiting */ | |
41 | struct text *p_textp; /* pointer to text structure */ | |
42 | int p_clktim; /* time to alarm clock signal */ | |
43 | struct pte *p_p0br; /* page table base P0BR */ | |
44 | struct proc *p_xlink; /* linked list of procs sharing same text */ | |
45 | short p_faults; /* faults in last second */ | |
46 | short p_aveflt; /* average of p_faults into past */ | |
47 | short p_ndx; /* proc index for memall (because of vfork) */ | |
48 | short p_idhash; /* hashed based on p_pid for kill+exit+... */ | |
49 | }; | |
50 | ||
51 | #define PIDHSZ 63 | |
52 | #define PIDHASH(pid) ((pid) % PIDHSZ) | |
53 | ||
54 | #ifdef KERNEL | |
55 | short pidhash[PIDHSZ]; | |
56 | ||
57 | struct proc *pfind(); | |
58 | #endif | |
59 | ||
60 | #ifdef KERNEL | |
61 | extern struct proc proc[]; /* the proc table itself */ | |
62 | ||
63 | #ifdef FASTVAX | |
64 | #define NQS 32 /* 32 run queues */ | |
65 | struct prochd { | |
66 | struct proc *ph_link; /* linked list of running processes */ | |
67 | struct proc *ph_rlink; | |
68 | } qs[NQS]; | |
69 | int whichqs; /* bit mask summarizing non-empty qs's */ | |
70 | #else | |
71 | struct proc *runq; | |
72 | #endif | |
73 | #endif | |
74 | ||
75 | /* stat codes */ | |
76 | #define SSLEEP 1 /* awaiting an event */ | |
77 | #define SWAIT 2 /* (abandoned state) */ | |
78 | #define SRUN 3 /* running */ | |
79 | #define SIDL 4 /* intermediate state in process creation */ | |
80 | #define SZOMB 5 /* intermediate state in process termination */ | |
81 | #define SSTOP 6 /* process being traced */ | |
82 | ||
83 | /* flag codes */ | |
84 | #define SLOAD 0x00001 /* in core */ | |
85 | #define SSYS 0x00002 /* swapper or pager process */ | |
86 | #define SLOCK 0x00004 /* process being swapped out */ | |
87 | #define SSWAP 0x00008 /* save area flag */ | |
88 | #define STRC 0x00010 /* process is being traced */ | |
89 | #define SWTED 0x00020 /* another tracing flag */ | |
90 | #define SULOCK 0x00040 /* user settable lock in core */ | |
91 | #define SPAGE 0x00080 /* process in page wait state */ | |
92 | #define SKEEP 0x00100 /* another flag to prevent swap out */ | |
93 | #define SDLYU 0x00200 /* delayed unlock of pages */ | |
94 | #define SWEXIT 0x00400 /* working on exiting */ | |
95 | #define SPHYSIO 0x00800 /* doing physical i/o (bio.c) */ | |
96 | #define SVFORK 0x01000 /* process resulted from vfork() */ | |
97 | #define SVFDONE 0x02000 /* another vfork flag */ | |
98 | #define SNOVM 0x04000 /* no vm, parent in a vfork() */ | |
99 | #define SPAGI 0x08000 /* init data space on demand, from inode */ | |
100 | #define SANOM 0x10000 /* system detected anomalous vm behavior */ | |
101 | #define SUANOM 0x20000 /* user warned of anomalous vm behavior */ | |
8761ac34 | 102 | #define STIMO 0x40000 /* timing out during sleep */ |
5cb51551 BJ |
103 | |
104 | /* | |
105 | * parallel proc structure | |
106 | * to replace part with times | |
107 | * to be passed to parent process | |
108 | * in ZOMBIE state. | |
109 | * | |
110 | * THIS SHOULD BE DONE WITH A union() CONSTRUCTION | |
111 | */ | |
112 | struct xproc | |
113 | { | |
114 | struct proc *xp_link; | |
115 | struct proc *xp_rlink; | |
116 | struct pte *xp_addr; | |
117 | char xp_usrpri; | |
118 | char xp_pri; /* priority, negative is high */ | |
119 | char xp_cpu; /* cpu usage for scheduling */ | |
120 | char xp_stat; | |
121 | char xp_time; /* resident time for scheduling */ | |
122 | char xp_nice; /* nice for cpu usage */ | |
123 | char xp_slptime; | |
124 | int xp_flag; | |
125 | int xp_sig; /* signals pending to this process */ | |
126 | int xp_ignsig; | |
127 | short xp_uid; /* user id, used to direct tty signals */ | |
128 | short xp_pgrp; /* name of process group leader */ | |
129 | short xp_pid; /* unique process id */ | |
130 | short xp_ppid; /* process id of parent */ | |
131 | short xp_xstat; /* Exit status for wait */ | |
132 | struct vtimes xp_vm; | |
133 | }; |