|
|
1.1 root 1: #ifdef KERNEL
2: #include "../machine/pcb.h"
3: #include "../machine/reg.h"
4: #include "../h/dmap.h"
5: #include "../h/vtimes.h"
6: #else
7: #include <machine/reg.h>
8: #include <machine/pcb.h>
9: #include <sys/dmap.h>
10: #include <sys/vtimes.h>
11: #endif
12: /*
13: * The user structure.
14: * One allocated per process.
15: * Contains all per process data
16: * that doesn't need to be referenced
17: * while the process is swapped.
18: * The user block is UPAGES*NBPG bytes
19: * long; resides at virtual user
20: * loc 0x80000000-UPAGES*NBPG; contains the system
21: * stack per user; is cross referenced
22: * with the proc structure for the
23: * same process.
24: */
25:
26: #define SHSIZE 32
27: #define NOGROUP (short)-1 /* end of group marker */
28:
29: struct user
30: {
31: char u_stack[KERNSTACK]; /* the kernel stack */
32: struct pcb u_pcb;
33: int u_arg[5]; /* arguments to current system call */
34: label_t u_qsav; /* for non-local gotos on interrupts */
35: char u_segflg; /* 0:user D; 1:system; 2:user I */
36: char u_error; /* return error code */
37: short u_uid; /* effective user id */
38: short u_gid; /* effective group id */
39: short u_ruid; /* real user id */
40: short u_rgid; /* real group id */
41: short u_groups[NGROUPS]; /* access group id array */
42: struct proc *u_procp; /* pointer to proc structure */
43: int *u_ap; /* pointer to arglist */
44: union { /* syscall return values */
45: struct {
46: int R_val1;
47: int R_val2;
48: } u_rv;
49: #define r_val1 u_rv.R_val1
50: #define r_val2 u_rv.R_val2
51: off_t r_off;
52: time_t r_time;
53: } u_r;
54: caddr_t u_base; /* base address for IO */
55: unsigned int u_count; /* bytes remaining for IO */
56: off_t u_offset; /* offset in file for IO */
57: struct inode *u_cdir; /* pointer to inode of current directory */
58: struct inode *u_rdir; /* root directory of current process */
59: char u_dbuf[DIRSIZ]; /* current pathname component */
60: caddr_t u_dirp; /* pathname pointer */
61: struct direct u_dent; /* current directory entry */
62: /* struct inode *u_pdir; /* inode of parent directory of dirp */
63: struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */
64: char u_pofile[NOFILE]; /* per-process flags of open files */
65: #define EXCLOSE 01 /* auto-close on exec */
1.1.1.2 ! root 66: #define MMAPPED 02 /* fd used to mmap memory */
1.1 root 67: label_t u_ssav; /* label variable for swapping */
68: int (*u_signal[NSIG])(); /* disposition of signals */
69: int u_code; /* ``code'' to trap */
70: /* on SIGILL code passes compatibility mode fault address */
71: /* on SIGFPE code passes more specific kind of floating point fault */
72: int *u_ar0; /* address of users saved R0 */
73: struct uprof { /* profile arguments */
74: short *pr_base; /* buffer base */
75: unsigned pr_size; /* buffer size */
76: unsigned pr_off; /* pc offset */
77: unsigned pr_scale; /* pc scaling */
78: } u_prof;
79: char u_eosys; /* special action on end of syscall */
80: char u_sep; /* flag for I and D separation */
81: dev_t u_ttydev; /* dev,ino of controlling tty */
82: ino_t u_ttyino;
83: union {
84: struct { /* header of executable file */
85: #ifdef sun
86: unsigned short Ux_mach; /* machine type */
87: unsigned short Ux_mag; /* magic number */
88: #else
89: unsigned Ux_mag; /* magic number */
90: #endif
91: unsigned Ux_tsize; /* text size */
92: unsigned Ux_dsize; /* data size */
93: unsigned Ux_bsize; /* bss size */
94: unsigned Ux_ssize; /* symbol table size */
95: unsigned Ux_entloc; /* entry location */
96: unsigned Ux_unused;
97: unsigned Ux_relflg;
98: } Ux_A;
99: char ux_shell[SHSIZE]; /* #! and name of interpreter */
100: } u_exdata;
101: #ifdef sun
102: #define ux_mach Ux_A.Ux_mach
103: #define M_OLDSUN2 0 /* old sun-2 executable files */
104: #define M_68010 1 /* runs on either 68010 or 68020 */
105: #define M_68020 2 /* runs only on 68020 */
106:
107: #define OMAGIC 0407 /* old impure format */
108: #define NMAGIC 0410 /* read-only text */
109: #define ZMAGIC 0413 /* demand load format */
110: #endif
111: #define ux_mag Ux_A.Ux_mag
112: #define ux_tsize Ux_A.Ux_tsize
113: #define ux_dsize Ux_A.Ux_dsize
114: #define ux_bsize Ux_A.Ux_bsize
115: #define ux_ssize Ux_A.Ux_ssize
116: #define ux_entloc Ux_A.Ux_entloc
117: #define ux_unused Ux_A.Ux_unused
118: #define ux_relflg Ux_A.Ux_relflg
119:
120: char u_comm[DIRSIZ];
121: time_t u_start;
122: char u_acflag;
123: short u_fpflag; /* unused now, will be later */
124: short u_cmask; /* mask for file creation */
125: size_t u_tsize; /* text size (clicks) */
126: size_t u_dsize; /* data size (clicks) */
127: size_t u_ssize; /* stack size (clicks) */
128: struct vtimes u_vm; /* stats for this proc */
129: struct vtimes u_cvm; /* sum of stats for reaped children */
130: struct dmap u_dmap; /* disk map for data segment */
131: struct dmap u_smap; /* disk map for stack segment */
132: struct dmap u_cdmap, u_csmap; /* shadows of u_dmap, u_smap, for
133: use of parent during fork */
134: time_t u_outime; /* user time at last sample */
135: size_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */
136: int u_limit[8]; /* see <sys/vlimit.h> */
137: int u_nbadio; /* # IO operations on hungup streams */
138: char u_logname[8]; /* login name */
139: #ifdef sun
140: int u_lofault; /* catch faults in locore.s */
141: struct hole { /* a data space hole (no swap space) */
142: int uh_first; /* first data page in hole */
143: int uh_last; /* last data page in hole */
144: } u_hole;
145: /* sun2 only */
146: int u_memropc[12]; /* state of ropc */
147: struct skyctx {
148: u_int usc_regs[8]; /* the Sky registers */
149: short usc_cmd; /* current command */
150: short usc_used; /* user is using Sky */
151: } u_skyctx;
152: /* end sun2 only */
153: /* 68020/68881 only */
154: struct fp_status u_fp_status; /* user visible fpp state */
155: struct fp_istate u_fp_istate; /* internal fpp state */
156: /* end 68020/68881 only */
157: /* 68020/fpa only */
158: struct fpa_istate u_fpa_istate; /* supervisor privilege regs */
159: struct fpa_status u_fpa_status; /* user privilege regs */
160: /* end 68020/fpa only */
161: #endif sun
162: };
163:
164: /* u_eosys values */
165: #define JUSTRETURN 0
166: #define RESTARTSYS 1
167: #define SIMULATERTI 2
168: #define REALLYRETURN 3
169:
170: /* u_error codes */
171: #ifdef KERNEL
172: #include "../h/errno.h"
173: #else
174: #include <errno.h>
175: #endif
176:
177: #ifdef KERNEL
178: #ifdef sun
179: #define u (*(struct user *)UADDR)
180: #else sun
181: extern struct user u;
182: #endif sun
183: extern struct user swaputl;
184: extern struct user forkutl;
185: extern struct user xswaputl;
186: extern struct user xswap2utl;
187: extern struct user pushutl;
188: extern struct user vfutl;
189: extern struct user prusrutl;
190: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.