|
|
1.1 root 1: #ifdef KERNEL
2: #include "../h/pcb.h"
3: #include "../h/dmap.h"
4: #include "../h/vtimes.h"
5: #else
6: #include <sys/pcb.h>
7: #include <sys/dmap.h>
8: #include <sys/vtimes.h>
9: #endif
10: /*
11: * The user structure.
12: * One allocated per process.
13: * Contains all per process data
14: * that doesn't need to be referenced
15: * while the process is swapped.
16: * The user block is UPAGES*NBPG bytes
17: * long; resides at virtual user
18: * loc 0x80000000-UPAGES*NBPG; contains the system
19: * stack per user; is cross referenced
20: * with the proc structure for the
21: * same process.
22: */
23:
24: #define SHSIZE 32
25:
26: struct user
27: {
28: struct pcb u_pcb;
29: int u_arg[5]; /* arguments to current system call */
30: label_t u_qsav; /* for non-local gotos on interrupts */
31: char u_segflg; /* 0:user D; 1:system; 2:user I */
32: char u_error; /* return error code */
33: short u_uid; /* effective user id */
34: short u_gid; /* effective group id */
35: short u_ruid; /* real user id */
36: short u_rgid; /* real group id */
37: struct proc *u_procp; /* pointer to proc structure */
38: int *u_ap; /* pointer to arglist */
39: union { /* syscall return values */
40: struct {
41: int R_val1;
42: int R_val2;
43: } u_rv;
44: #define r_val1 u_rv.R_val1
45: #define r_val2 u_rv.R_val2
46: off_t r_off;
47: time_t r_time;
48: } u_r;
49: caddr_t u_base; /* base address for IO */
50: unsigned int u_count; /* bytes remaining for IO */
51: off_t u_offset; /* offset in file for IO */
52: struct inode *u_cdir; /* pointer to inode of current directory */
53: struct inode *u_rdir; /* root directory of current process */
54: char u_dbuf[DIRSIZ]; /* current pathname component */
55: caddr_t u_dirp; /* pathname pointer */
56: struct direct u_dent; /* current directory entry */
57: struct inode *u_pdir; /* inode of parent directory of dirp */
58: struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */
59: char u_pofile[NOFILE]; /* per-process flags of open files */
60: #define EXCLOSE 01 /* auto-close on exec */
61: #define POALOCK 02 /* advisory lock set */
62: label_t u_ssav; /* label variable for swapping */
63: int (*u_signal[NSIG])(); /* disposition of signals */
64: int u_code; /* ``code'' to trap */
65: /* on SIGILL code passes compatibility mode fault address */
66: /* on SIGFPE code passes more specific kind of floating point fault */
67: int *u_ar0; /* address of users saved R0 */
68: struct uprof { /* profile arguments */
69: short *pr_base; /* buffer base */
70: unsigned pr_size; /* buffer size */
71: unsigned pr_off; /* pc offset */
72: unsigned pr_scale; /* pc scaling */
73: } u_prof;
74: char u_eosys; /* special action on end of syscall */
75: char u_sep; /* flag for I and D separation */
76: dev_t u_ttydev; /* dev,ino of controlling tty */
77: ino_t u_ttyino;
78: union {
79: struct { /* header of executable file */
80: int Ux_mag; /* magic number */
81: unsigned Ux_tsize; /* text size */
82: unsigned Ux_dsize; /* data size */
83: unsigned Ux_bsize; /* bss size */
84: unsigned Ux_ssize; /* symbol table size */
85: unsigned Ux_entloc; /* entry location */
86: unsigned Ux_unused;
87: unsigned Ux_relflg;
88: } Ux_A;
89: char ux_shell[SHSIZE]; /* #! and name of interpreter */
90: } u_exdata;
91: #define ux_mag Ux_A.Ux_mag
92: #define ux_tsize Ux_A.Ux_tsize
93: #define ux_dsize Ux_A.Ux_dsize
94: #define ux_bsize Ux_A.Ux_bsize
95: #define ux_ssize Ux_A.Ux_ssize
96: #define ux_entloc Ux_A.Ux_entloc
97: #define ux_unused Ux_A.Ux_unused
98: #define ux_relflg Ux_A.Ux_relflg
99:
100: char u_comm[DIRSIZ];
101: time_t u_start;
102: char u_acflag;
103: short u_fpflag; /* unused now, will be later */
104: short u_cmask; /* mask for file creation */
105: size_t u_tsize; /* text size (clicks) */
106: size_t u_dsize; /* data size (clicks) */
107: size_t u_ssize; /* stack size (clicks) */
108: struct vtimes u_vm; /* stats for this proc */
109: struct vtimes u_cvm; /* sum of stats for reaped children */
110: struct dmap u_dmap; /* disk map for data segment */
111: struct dmap u_smap; /* disk map for stack segment */
112: struct dmap u_cdmap, u_csmap; /* shadows of u_dmap, u_smap, for
113: use of parent during fork */
114: time_t u_outime; /* user time at last sample */
115: size_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */
116: int u_limit[8]; /* see <sys/limit.h> */
117: int u_nbadio; /* # IO operations on hungup streams */
118: int u_stack[1];
119:
120: /*
121: * kernel stack per user
122: * extends from u + UPAGES*512
123: * backward not to reach here
124: */
125: /* SHOULD INSTEAD GROW STACK BACKWARDS ABOVE u. TOWARDS A VIRTUAL HOLE */
126: };
127:
128: /* u_eosys values */
129: #define JUSTRETURN 0
130: #define RESTARTSYS 1
131: #define SIMULATERTI 2
132:
133: /* u_error codes */
134: #include <errno.h>
135:
136: #ifdef KERNEL
137: extern struct user u;
138: extern struct user swaputl;
139: extern struct user forkutl;
140: extern struct user xswaputl;
141: extern struct user xswap2utl;
142: extern struct user pushutl;
143: extern struct user vfutl;
144: extern struct user prusrutl;
145: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.