|
|
1.1 root 1: /* (-lgl
2: * COHERENT Version 3.0
3: * Copyright (c) 1982, 1990 by Mark Williams Company.
4: * All rights reserved. May not be copied without permission.
5: -lgl) */
6: /*
7: * Process information.
8: */
9: #ifndef PROC_H
10: #define PROC_H PROC_H
11:
12: #include <sys/types.h>
13: #include <sys/timeout.h>
14: #include <sys/poll.h>
15:
16: /*
17: * Number of user segments.
18: */
19: #define NUSEG 6
20:
21: /*
22: * In core information about a process.
23: * The `p_lforw' and `p_lback' entries must not move as they must be
24: * in the same place as in the `plink' structure.
25: */
26: typedef struct proc {
27: struct proc *p_lforw; /* Working forward pointer */
28: struct proc *p_lback; /* Working backward pointer */
29: struct proc *p_nforw; /* Next forward pointer */
30: struct proc *p_nback; /* Next backward pointer */
31: struct seg *p_segp[NUSEG+1]; /* Segments */
32: unsigned p_pid; /* Process id */
33: unsigned p_ppid; /* Process id of parent */
34: unsigned p_uid; /* Effective uid */
35: unsigned p_ruid; /* Real uid */
36: unsigned p_rgid; /* Real gid */
37: unsigned p_state; /* Scheduling state */
38: unsigned p_flags; /* Flags */
39: sig_t p_ssig; /* Signals which have been set */
40: sig_t p_isig; /* Signals which are being ignored */
41: char *p_event; /* Wakeup event channel */
42: unsigned p_alarm; /* Timer for alarms */
43: unsigned p_group; /* Process group */
44: dev_t p_ttdev; /* Controlling terminal */
45: unsigned p_nice; /* Nice value */
46: unsigned p_cval; /* Cpu schedule value */
47: unsigned p_sval; /* Swap schedule value */
48: int p_ival; /* Importance value */
49: unsigned p_rval; /* Response value */
50: unsigned p_lctim; /* Last time cval was updated */
51: long p_utime; /* User time (HZ) */
52: long p_stime; /* System time */
53: long p_cutime; /* Sum of childs user time */
54: long p_cstime; /* Sum of childs system time */
55: int p_exit; /* Exit status */
56: event_t *p_polls; /* Enabled polls */
57: TIM p_polltim; /* Poll timer */
58: TIM p_alrmtim; /* Alarm timer */
59: } PROC;
60:
61: /*
62: * Segment indices.
63: */
64: #define SIUSERP 0 /* User area segment */
65: #define SISTACK 1 /* Stack segment */
66: #define SISTEXT 2 /* Shared text segment */
67: #define SIPTEXT 3 /* Private text segment */
68: #define SISDATA 4 /* Shared data segment */
69: #define SIPDATA 5 /* Private data segment */
70: #define SIAUXIL 6 /* Auxiliary segment */
71:
72: /*
73: * Status of process (p_state).
74: */
75: #define PSSLEEP 1 /* Sleeping */
76: #define PSRUN 2 /* Running */
77: #define PSDEAD 3 /* Process is exiting */
78:
79: /*
80: * Flags (p_flags).
81: */
82: #define PFCORE 00001 /* Process is in core */
83: #define PFLOCK 00002 /* Process is locked in core */
84: #define PFSWIO 00004 /* Swap I/O in progress */
85: #define PFSWAP 00010 /* Process is swapped out */
86: #define PFWAIT 00020 /* Process is stopped (not waited) */
87: #define PFSTOP 00040 /* Process is stopped (waited on) */
88: #define PFTRAC 00100 /* Process is being traced */
89: #define PFKERN 00200 /* Kernel process */
90: #define PFAUXM 00400 /* Auxiliary segments in memory */
91: #define PFDISP 01000 /* Dispatch at earliest convenience */
92: #define PFNDMP 02000 /* Command mode forbids dump */
93: #ifdef QWAKEUP
94: #define PFWAKE 04000 /* Wakeup requested */
95: #endif
96:
97: /*
98: * Values of nice.
99: */
100: #define MINNICE 0 /* Minimum value of nice */
101: #define DEFNICE 20 /* Default nice value */
102: #define MAXNICE 40 /* Maximum nice value */
103:
104: #ifdef KERNEL
105: /*
106: * For easy referencing.
107: */
108: #define p_u p_segp[SIUSERP]
109: #define SELF cprocp
110:
111: #endif
112:
113: #ifdef KERNEL
114: /*
115: * Determine if a gate is locked.
116: */
117: #define locked(g) ((g)[0])
118:
119: #endif
120:
121: #ifdef KERNEL
122: /*
123: * Functions.
124: */
125: extern int idle();
126: extern PROC *process();
127: extern int wakeup();
128: #ifdef QWAKEUP
129: extern int wakeup2();
130: #endif
131:
132: #endif
133:
134: #ifdef KERNEL
135: /*
136: * Global variables.
137: */
138: extern int quantum; /* Current quantum */
139: extern int disflag; /* Dispatch soon as possible */
140: extern int intflag; /* We are in an interrupt */
141: #ifndef NOMONITOR
142: extern int swmflag; /* Monitor swapper */
143: #endif
144: extern int cpid; /* Current process id */
145: #ifdef QWAKEUP
146: extern int ntowake; /* Wakeup pending */
147: #endif
148: extern GATE pnxgate; /* Gate for p_next */
149: extern PROC procq; /* Process queue */
150: extern PROC *iprocp; /* Idle process struct */
151: extern PROC *eprocp; /* Init process struct */
152: extern PROC *cprocp; /* Current process */
153:
154: #endif
155:
156: /*
157: * Number of entries in sleep/wakeup queue.
158: */
159: #define NHPLINK 32
160:
161: /*
162: * Sleep/wakeup queues.
163: */
164: typedef struct plink {
165: struct proc *p_lforw; /* Working forward pointer */
166: struct proc *p_lback; /* Working backward pointer */
167: } PLINK;
168:
169: #ifdef KERNEL
170: /*
171: * Function to hash a wakeup channel.
172: * Most channels are even.
173: */
174: #define hash(e) ((((unsigned)(e))>>1)%NHPLINK)
175:
176: #endif
177:
178: #ifdef KERNEL
179: /*
180: * Global variables.
181: */
182: extern PLINK linkq[NHPLINK]; /* Sleep/wakeup hash queue */
183:
184: #endif
185:
186: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.