|
|
1.1 root 1: /* proc.h - isbadpid */
2:
3: /* process table declarations and defined constants */
4:
5: #ifndef NPROC /* set the number of processes */
6: #define NPROC 100 /* allowed if not already done */
7: #endif
8:
9: /* process state constants */
10:
11: #define PRCURR '\001' /* process is currently running */
12: #define PRFREE '\002' /* process slot is free */
13: #define PRREADY '\003' /* process is on ready queue */
14: #define PRRECV '\004' /* process waiting for message */
15: #define PRSLEEP '\005' /* process is sleeping */
16: #define PRSUSP '\006' /* process is suspended */
17: #define PRWAIT '\007' /* process is on semaphore queue*/
18: #define PRTRECV '\010' /* process is timing a receive */
19:
20: /* miscellaneous process definitions */
21:
22: #define PNREGS 24 /* size of saved register area */
23: #define PNRETPOP 4 /* number of registers RET pops,*/
24: /* other than PC */
25: #define PNMLEN 8 /* length of process "name" */
26: #define NULLPROC 0 /* id of the null process; it */
27: /* is always eligible to run */
28: #define BADPID -1 /* used when invalid pid needed */
29:
30: #define isbadpid(x) (x<=0 || x>=NPROC)
31:
32: /* process table entry */
33:
34: struct pentry {
35: int pregs[PNREGS]; /* process save area corresponding
36: to VAX Process Control Block, e.g.:
37: pregs[?] register function
38: ----------- --------------------
39: 0 kernel stack pointer
40: 1 executive stack ptr
41: 2 supervisor stack ptr
42: 3 user stack pointer
43: 4 general register R0
44: 5-14 general regs R1-R10
45: 15 general register R11
46: 16 argument pointer (R12)
47: 17 frame pointer (R13)
48: 18 program counter (R15)
49: 19 processor status lword
50: 20 P0BR
51: 21 P0LR
52: 22 P1BR
53: 23 P1LR */
54: char pstate; /* process state: PRCURR, etc. */
55: short pprio; /* process priority */
56: int psem; /* semaphore if process waiting */
57: int pmsg; /* message sent to this process */
58: Bool phasmsg; /* True iff pmsg is valid */
59: int pbase; /* base of run time stack */
60: int pstklen; /* stack length in bytes */
61: int plimit; /* lowest extent of stack */
62: char pname[PNMLEN]; /* process name */
63: short pargs; /* initial number of arguments */
64: int paddr; /* initial code address */
65: short pnxtkin; /* next-of-kin notified of death*/
66: short pdevs[2]; /* devices to close upon exit */
67: };
68:
69: extern struct pentry proctab[];
70: extern int numproc; /* currently active processes */
71: extern int nextproc; /* search point for free slot */
72: extern int currpid; /* currently executing process */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.