1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)user.h 1.6 (2.11BSD) 1999/9/13
7: */
8:
9: #ifdef KERNEL
10: #include "../machine/fperr.h"
11: #include "dir.h"
12: #include "exec.h"
13: #include "time.h"
14: #include "resource.h"
15: #else
16: #include <machine/fperr.h>
17: #include <sys/dir.h>
18: #include <sys/exec.h>
19: #include <sys/time.h>
20: #include <sys/resource.h>
21: #endif
22:
23: /*
24: * data that doesn't need to be referenced while the process is swapped.
25: * The user block is USIZE*64 bytes long; resides at virtual kernel loc
26: * 0140000; contains the system stack (and possibly network stack) per
27: * user; is cross referenced with the proc structure for the same process.
28: */
29: #define MAXCOMLEN MAXNAMLEN /* <= MAXNAMLEN, >= sizeof(ac_comm) */
30:
31: struct pcb { /* fake pcb structure */
32: int (*pcb_sigc)(); /* pointer to trampoline code in user space */
33: };
34:
35: struct fps {
36: short u_fpsr; /* FP status register */
37: double u_fpregs[6]; /* FP registers */
38: };
39:
40: struct user {
41: struct pcb u_pcb;
42: struct fps u_fps;
43: short u_fpsaved; /* FP regs saved for this proc */
44: struct fperr u_fperr; /* floating point error save */
45: struct proc *u_procp; /* pointer to proc structure */
46: int *u_ar0; /* address of users saved R0 */
47: char u_comm[MAXCOMLEN + 1];
48:
49: /* syscall parameters, results and catches */
50: int u_arg[6]; /* arguments to current system call */
51: int *u_ap; /* pointer to arglist */
52: label_t u_qsave; /* for non-local gotos on interrupts */
53: union { /* syscall return values */
54: struct {
55: int R_val1;
56: int R_val2;
57: } u_rv;
58: #define r_val1 u_rv.R_val1
59: #define r_val2 u_rv.R_val2
60: long r_long;
61: off_t r_off;
62: time_t r_time;
63: } u_r;
64: char u_error; /* return error code */
65: char u_dummy0;
66:
67: /* 1.1 - processes and protection */
68: uid_t u_uid; /* effective user id */
69: uid_t u_svuid; /* saved user id */
70: uid_t u_ruid; /* real user id */
71: gid_t u_svgid; /* saved group id */
72: gid_t u_rgid; /* real group id */
73: gid_t u_groups[NGROUPS]; /* groups, 0 terminated */
74:
75: /* 1.2 - memory management */
76: size_t u_tsize; /* text size (clicks) */
77: size_t u_dsize; /* data size (clicks) */
78: size_t u_ssize; /* stack size (clicks) */
79: label_t u_ssave; /* label variable for swapping */
80: label_t u_rsave; /* save info when exchanging stacks */
81: short u_uisa[16]; /* segmentation address prototypes */
82: short u_uisd[16]; /* segmentation descriptor prototypes */
83: char u_sep; /* flag for I and D separation */
84: char dummy1; /* room for another char */
85: /* overlay information */
86: struct u_ovd { /* automatic overlay data */
87: short uo_curov; /* current overlay */
88: short uo_ovbase; /* base of overlay area, seg. */
89: u_short uo_dbase; /* start of data, clicks */
90: u_short uo_ov_offst[NOVL+1]; /* overlay offsets in text */
91: short uo_nseg; /* number of overlay seg. regs. */
92: } u_ovdata;
93:
94: /* 1.3 - signal management */
95: int (*u_signal[NSIG])(); /* disposition of signals */
96: long u_sigmask[NSIG]; /* signals to be blocked */
97: long u_sigonstack; /* signals to take on sigstack */
98: long u_sigintr; /* signals that interrupt syscalls */
99: long u_oldmask; /* saved mask from before sigpause */
100: int u_code; /* ``code'' to trap */
101: char dummy2; /* Room for another flags byte */
102: char u_psflags; /* Process Signal flags */
103: struct sigaltstack u_sigstk; /* signal stack info */
104:
105: /* 1.4 - descriptor management */
106: struct file *u_ofile[NOFILE]; /* file structures for open files */
107: char u_pofile[NOFILE]; /* per-process flags of open files */
108: int u_lastfile; /* high-water mark of u_ofile */
109: #define UF_EXCLOSE 0x1 /* auto-close on exec */
110: #define UF_MAPPED 0x2 /* mapped from device */
111: struct inode *u_cdir; /* current directory */
112: struct inode *u_rdir; /* root directory of current process */
113: struct tty *u_ttyp; /* controlling tty pointer */
114: dev_t u_ttyd; /* controlling tty dev */
115: short u_cmask; /* mask for file creation */
116:
117: /* 1.5 - timing and statistics */
118: struct k_rusage u_ru; /* stats for this proc */
119: struct k_rusage u_cru; /* sum of stats for reaped children */
120: struct k_itimerval u_timer[2]; /* profile/virtual timers */
121: long u_start;
122: char u_acflag;
123: char u_dupfd; /* XXX - see kern_descrip.c/fdopen */
124:
125: struct uprof { /* profile arguments */
126: short *pr_base; /* buffer base */
127: unsigned pr_size; /* buffer size */
128: unsigned pr_off; /* pc offset */
129: unsigned pr_scale; /* pc scaling */
130: } u_prof;
131:
132: /* 1.6 - resource controls */
133: struct rlimit u_rlimit[RLIM_NLIMITS];
134: struct quota *u_quota; /* user's quota structure */
135:
136: /* namei & co. */
137: struct nameicache { /* last successful directory search */
138: off_t nc_prevoffset; /* offset at which last entry found */
139: ino_t nc_inumber; /* inum of cached directory */
140: dev_t nc_dev; /* dev of cached directory */
141: } u_ncache;
142: short u_xxxx[2]; /* spare */
143: char u_login[MAXLOGNAME]; /* setlogin/getlogin */
144: short u_stack[1]; /* kernel stack per user
145: * extends from u + USIZE*64
146: * backward not to reach here
147: */
148: };
149:
150: #include <sys/errno.h>
151:
152: #ifdef KERNEL
153: extern struct user u;
154: #endif
Defined struct's
fps
defined in line
35; used 8 times
pcb
defined in line
31; used 2 times
u_ovd
defined in line
86; used 2 times
user
defined in line
40; used 66 times
- in line 153(2)
- in /usr/src/bin/adb/defs.h line
78(2)
- in /usr/src/bin/adb/runpcs.c line
280(2),
291-293(4)
- in /usr/src/bin/ps.c line
49(2),
407(2)
- in /usr/src/libexec/identd/src/kernel/2.11bsd.c line
193(2),
200(2)
- in /usr/src/libexec/identd/src/kvm.c line
250(2),
256(2),
269(2),
290(2)
- in /usr/src/new/OLD/buildcore.c line
24(2)
- in /usr/src/new/crash/crash.c line
91-92(4)
- in /usr/src/sys/pdp/genassym.c line
46(2)
- in /usr/src/sys/sys/kern_sysctl.c line
978(2),
990-992(6),
1014(2)
- in /usr/src/ucb/PORT/systat/fetch.c line
61(2),
98(2)
- in /usr/src/ucb/PORT/systat/swap.c line
48(2)
- in /usr/src/ucb/w.c line
71(2)
- in /usr/src/usr.bin/fstat/fstat.c line
103(2),
239-240(4),
258(2),
278-279(4)
- in /usr/src/usr.sbin/pstat/pstat.c line
521(2)
Defined macros
r_val1
defined in line
58; used 47 times
- in /usr/src/sys/pdp/kern_pdp.c line
67,
103,
115
- in /usr/src/sys/pdp/trap.c line
349,
363
- in /usr/src/sys/sys/kern_descrip.c line
34,
66,
121,
129,
144,
278
- in /usr/src/sys/sys/kern_exit.c line
175
- in /usr/src/sys/sys/kern_fork.c line
74,
85
- in /usr/src/sys/sys/kern_prot.c line
24,
31,
48,
54,
61,
67,
74,
101
- in /usr/src/sys/sys/kern_resource.c line
69
- in /usr/src/sys/sys/kern_sysctl.c line
171
- in /usr/src/sys/sys/sys_generic.c line
170,
391-392(2)
- in /usr/src/sys/sys/sys_inode.c line
355
- in /usr/src/sys/sys/sys_net.c line
252
- in /usr/src/sys/sys/sys_pipe.c line
70,
78-79(2)
- in /usr/src/sys/sys/sys_process.c line
72
- in /usr/src/sys/sys/ufs_syscalls.c line
139,
162,
481
- in /usr/src/sys/sys/ufs_syscalls2.c line
114-116(2),
204
- in /usr/src/sys/sys/uipc_syscalls.c line
71,
161,
260,
270,
282,
430,
555
- in /usr/src/usr.sbin/pstat/pstat.c line
543
r_val2
defined in line
59; used 10 times
Usage of this include