Start development on BSD 4
[unix-history] / .ref-5cb41021d721f4e0ac572d592613f963e495d1ff / .ref-BSD-3 / usr / src / sys / h / proc.h
CommitLineData
e78f0c8d
BJ
1/* proc.h 2.1 1/5/80 */
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 */
11struct proc
12{
13 char p_stat;
14 char p_slptime; /* time since last block */
15 short p_flag;
16 short p_cpu; /* cpu usage for scheduling */
17 short p_time; /* resident time for scheduling */
18 char p_pri; /* priority, negative is high */
19 char p_nice; /* nice for cpu usage */
20 short p_sig; /* signals pending to this process */
21 short p_uid; /* user id, used to direct tty signals */
22 short p_pgrp; /* name of process group leader */
23 short p_pid; /* unique process id */
24 short p_ppid; /* process id of parent */
25 short p_addr[UPAGES]; /* page table entries of u-area */
26 short p_poip; /* count of page outs in progress */
27 short p_szpt; /* copy of page table size */
28 size_t p_tsize; /* size of text (clicks) */
29 size_t p_dsize; /* size of data space (clicks) */
30 size_t p_ssize; /* copy of stack size (clicks) */
31 size_t p_rssize; /* current resident set size in clicks */
32 size_t p_swrss; /* resident set size before last swap */
33 swblk_t p_swaddr; /* disk address of u area when swapped */
34 caddr_t p_wchan; /* event process is awaiting */
35 struct text *p_textp; /* pointer to text structure */
36 struct proc *p_link; /* linked list of running processes */
37 int p_clktim; /* time to alarm clock signal */
38 struct pte *p_p0br; /* page table base P0BR */
39 struct proc *p_xlink; /* linked list of procs sharing same text */
40 short p_faults; /* faults in last second */
41 short p_aveflt; /* average of p_faults into past */
42 short p_ndx; /* proc index for memall (because of vfork) */
43};
44
45#ifdef KERNEL
46extern struct proc proc[]; /* the proc table itself */
47
48struct proc *runq; /* pointer to linked list of running processes */
49#endif
50
51/* stat codes */
52#define SSLEEP 1 /* awaiting an event */
53#define SWAIT 2 /* (abandoned state) */
54#define SRUN 3 /* running */
55#define SIDL 4 /* intermediate state in process creation */
56#define SZOMB 5 /* intermediate state in process termination */
57#define SSTOP 6 /* process being traced */
58
59/* flag codes */
60#define SLOAD 0x0001 /* in core */
61#define SSYS 0x0002 /* swapper or pager process */
62#define SLOCK 0x0004 /* process being swapped out */
63#define SSWAP 0x0008 /* save area flag */
64#define STRC 0x0010 /* process is being traced */
65#define SWTED 0x0020 /* another tracing flag */
66#define SULOCK 0x0040 /* user settable lock in core */
67#define SPAGE 0x0080 /* process in page wait state */
68#define SKEEP 0x0100 /* another flag to prevent swap out */
69#define SDLYU 0x0200 /* delayed unlock of pages */
70#define SWEXIT 0x0400 /* working on exiting */
71#define SUNUSED 0x0800 /* used to be page out in progress */
72#define SVFORK 0x1000 /* process resulted from vfork() */
73#define SVFDONE 0x2000 /* another vfork flag */
74#define SNOVM 0x4000 /* no vm, parent in a vfork() */
75#define SPAGI 0x8000 /* init data space on demand, from inode */
76
77/*
78 * parallel proc structure
79 * to replace part with times
80 * to be passed to parent process
81 * in ZOMBIE state.
82 */
83struct xproc
84{
85 char xp_stat;
86 char xp_slptime;
87 short xp_flag;
88 short xp_cpu; /* cpu usage for scheduling */
89 short xp_time; /* resident time for scheduling */
90 char xp_pri; /* priority, negative is high */
91 char xp_nice; /* nice for cpu usage */
92 short xp_sig; /* signals pending to this process */
93 short xp_uid; /* user id, used to direct tty signals */
94 short xp_pgrp; /* name of process group leader */
95 short xp_pid; /* unique process id */
96 short xp_ppid; /* process id of parent */
97 short xp_xstat; /* Exit status for wait */
98 time_t xp_utime; /* user time, this proc */
99 time_t xp_stime; /* system time, this proc */
100};