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