Research V7 development
[unix-history] / usr / sys / h / user.h
CommitLineData
f09a3c06
KT
1/*
2 * The user structure.
3 * One allocated per process.
4 * Contains all per process data
5 * that doesn't need to be referenced
6 * while the process is swapped.
7 * The user block is USIZE*64 bytes
8 * long; resides at virtual kernel
9 * loc 140000; contains the system
10 * stack per user; is cross referenced
11 * with the proc structure for the
12 * same process.
13 */
14
15#define EXCLOSE 01
16
17struct user
18{
19 label_t u_rsav; /* save info when exchanging stacks */
20 int u_fper; /* FP error register */
21 int u_fpsaved; /* FP regs saved for this proc */
22 struct {
23 int u_fpsr; /* FP status register */
24 double u_fpregs[6]; /* FP registers */
25 } u_fps;
26 char u_segflg; /* IO flag: 0:user D; 1:system; 2:user I */
27 char u_error; /* return error code */
28 short u_uid; /* effective user id */
29 short u_gid; /* effective group id */
30 short u_ruid; /* real user id */
31 short u_rgid; /* real group id */
32 struct proc *u_procp; /* pointer to proc structure */
33 int *u_ap; /* pointer to arglist */
34 union { /* syscall return values */
35 struct {
36 int r_val1;
37 int r_val2;
38 };
39 off_t r_off;
40 time_t r_time;
41 } u_r;
42 caddr_t u_base; /* base address for IO */
43 unsigned int u_count; /* bytes remaining for IO */
44 off_t u_offset; /* offset in file for IO */
45 struct inode *u_cdir; /* pointer to inode of current directory */
46 struct inode *u_rdir; /* root directory of current process */
47 char u_dbuf[DIRSIZ]; /* current pathname component */
48 caddr_t u_dirp; /* pathname pointer */
49 struct direct u_dent; /* current directory entry */
50 struct inode *u_pdir; /* inode of parent directory of dirp */
51 int u_uisa[16]; /* prototype of segmentation addresses */
52 int u_uisd[16]; /* prototype of segmentation descriptors */
53 struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */
54 char u_pofile[NOFILE]; /* per-process flags of open files */
55 int u_arg[5]; /* arguments to current system call */
56 unsigned u_tsize; /* text size (clicks) */
57 unsigned u_dsize; /* data size (clicks) */
58 unsigned u_ssize; /* stack size (clicks) */
59 label_t u_qsav; /* label variable for quits and interrupts */
60 label_t u_ssav; /* label variable for swapping */
61 int u_signal[NSIG]; /* disposition of signals */
62 time_t u_utime; /* this process user time */
63 time_t u_stime; /* this process system time */
64 time_t u_cutime; /* sum of childs' utimes */
65 time_t u_cstime; /* sum of childs' stimes */
66 int *u_ar0; /* address of users saved R0 */
67 struct { /* profile arguments */
68 short *pr_base; /* buffer base */
69 unsigned pr_size; /* buffer size */
70 unsigned pr_off; /* pc offset */
71 unsigned pr_scale; /* pc scaling */
72 } u_prof;
73 char u_intflg; /* catch intr from sys */
74 char u_sep; /* flag for I and D separation */
75 struct tty *u_ttyp; /* controlling tty pointer */
76 dev_t u_ttyd; /* controlling tty dev */
77 struct { /* header of executable file */
78 int ux_mag; /* magic number */
79 unsigned ux_tsize; /* text size */
80 unsigned ux_dsize; /* data size */
81 unsigned ux_bsize; /* bss size */
82 unsigned ux_ssize; /* symbol table size */
83 unsigned ux_entloc; /* entry location */
84 unsigned ux_unused;
85 unsigned ux_relflg;
86 } u_exdata;
87 char u_comm[DIRSIZ];
88 time_t u_start;
89 char u_acflag;
90 short u_fpflag; /* unused now, will be later */
91 short u_cmask; /* mask for file creation */
92 int u_stack[1];
93 /* kernel stack per user
94 * extends from u + USIZE*64
95 * backward not to reach here
96 */
97};
98
99extern struct user u;
100
101/* u_error codes */
102#define EPERM 1
103#define ENOENT 2
104#define ESRCH 3
105#define EINTR 4
106#define EIO 5
107#define ENXIO 6
108#define E2BIG 7
109#define ENOEXEC 8
110#define EBADF 9
111#define ECHILD 10
112#define EAGAIN 11
113#define ENOMEM 12
114#define EACCES 13
115#define EFAULT 14
116#define ENOTBLK 15
117#define EBUSY 16
118#define EEXIST 17
119#define EXDEV 18
120#define ENODEV 19
121#define ENOTDIR 20
122#define EISDIR 21
123#define EINVAL 22
124#define ENFILE 23
125#define EMFILE 24
126#define ENOTTY 25
127#define ETXTBSY 26
128#define EFBIG 27
129#define ENOSPC 28
130#define ESPIPE 29
131#define EROFS 30
132#define EMLINK 31
133#define EPIPE 32
134#define EDOM 33
135#define ERANGE 34