Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
5921d41a KM |
2 | * Copyright (c) 1982, 1986, 1989 Regents of the University of California. |
3 | * All rights reserved. | |
da7c5cc6 | 4 | * |
1c15e888 C |
5 | * Redistribution is only permitted until one year after the first shipment |
6 | * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and | |
7 | * binary forms are permitted provided that: (1) source distributions retain | |
8 | * this entire copyright notice and comment, and (2) distributions including | |
9 | * binaries display the following acknowledgement: This product includes | |
10 | * software developed by the University of California, Berkeley and its | |
11 | * contributors'' in the documentation or other materials provided with the | |
12 | * distribution and in all advertising materials mentioning features or use | |
13 | * of this software. Neither the name of the University nor the names of | |
14 | * its contributors may be used to endorse or promote products derived from | |
15 | * this software without specific prior written permission. | |
16 | * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED | |
17 | * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF | |
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
5921d41a | 19 | * |
1c15e888 | 20 | * @(#)user.h 7.13 (Berkeley) 6/28/90 |
da7c5cc6 | 21 | */ |
b209f66c | 22 | |
961945a8 | 23 | #ifdef KERNEL |
1c15e888 | 24 | #include "machine/pcb.h" |
88fc1c0a JB |
25 | #include "dmap.h" |
26 | #include "time.h" | |
27 | #include "resource.h" | |
28 | #include "namei.h" | |
1c15e888 | 29 | #include "ucred.h" |
961945a8 SL |
30 | #else |
31 | #include <machine/pcb.h> | |
b209f66c | 32 | #include <sys/dmap.h> |
a7fc5dcd BJ |
33 | #include <sys/time.h> |
34 | #include <sys/resource.h> | |
24596b53 | 35 | #include <sys/namei.h> |
5921d41a | 36 | #include <sys/ucred.h> |
457aa395 SL |
37 | #endif |
38 | ||
b209f66c | 39 | /* |
600bdf12 BJ |
40 | * Per process structure containing data that |
41 | * isn't needed in core when the process is swapped out. | |
b209f66c BJ |
42 | */ |
43 | ||
600bdf12 | 44 | struct user { |
b209f66c | 45 | struct pcb u_pcb; |
9f63da1e BJ |
46 | struct proc *u_procp; /* pointer to proc structure */ |
47 | int *u_ar0; /* address of users saved R0 */ | |
9f63da1e BJ |
48 | |
49 | /* 1.1 - processes and protection */ | |
5921d41a KM |
50 | #define u_cred u_nd.ni_cred |
51 | #define u_uid u_cred->cr_uid /* effective user id */ | |
52 | #define u_gid u_cred->cr_gid /* effective group id */ | |
9f63da1e BJ |
53 | |
54 | /* 1.2 - memory management */ | |
f56a0ff7 KM |
55 | segsz_t u_tsize; /* text size (clicks) */ |
56 | segsz_t u_dsize; /* data size (clicks) */ | |
57 | segsz_t u_ssize; /* stack size (clicks) */ | |
9f63da1e BJ |
58 | struct dmap u_dmap; /* disk map for data segment */ |
59 | struct dmap u_smap; /* disk map for stack segment */ | |
1c15e888 C |
60 | struct dmap u_cdmap; /* temp data segment disk map */ |
61 | struct dmap u_csmap; /* temp stack segment disk map */ | |
fac8aa71 | 62 | label_t u_ssave; /* label variable for swapping */ |
1c15e888 | 63 | segsz_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */ |
9f63da1e | 64 | time_t u_outime; /* user time at last sample */ |
1c15e888 | 65 | struct mapmem *u_mmap; /* list of mapped memory regions */ |
9f63da1e BJ |
66 | |
67 | /* 1.3 - signal management */ | |
356c43e5 | 68 | sig_t u_signal[NSIG]; /* disposition of signals */ |
40dc6933 | 69 | int u_sigmask[NSIG]; /* signals to be blocked */ |
457aa395 | 70 | int u_sigonstack; /* signals to take on sigstack */ |
39530628 | 71 | int u_sigintr; /* signals that interrupt syscalls */ |
40dc6933 | 72 | int u_oldmask; /* saved mask from before sigpause */ |
457aa395 SL |
73 | struct sigstack u_sigstack; /* sp & on stack state variable */ |
74 | #define u_onstack u_sigstack.ss_onstack | |
75 | #define u_sigsp u_sigstack.ss_sp | |
a3d819ad KM |
76 | int u_sig; /* for core dump/debugger XXX */ |
77 | int u_code; /* for core dump/debugger XXX */ | |
9f63da1e BJ |
78 | |
79 | /* 1.4 - descriptor management */ | |
80 | struct file *u_ofile[NOFILE]; /* file structures for open files */ | |
81 | char u_pofile[NOFILE]; /* per-process flags of open files */ | |
39530628 | 82 | int u_lastfile; /* high-water mark of u_ofile */ |
82b91e72 | 83 | #define UF_EXCLOSE 0x1 /* auto-close on exec */ |
41ac9a63 | 84 | #define UF_MAPPED 0x2 /* mapped from device */ |
5921d41a KM |
85 | #define u_cdir u_nd.ni_cdir /* current directory */ |
86 | #define u_rdir u_nd.ni_rdir /* root directory of current process */ | |
9f63da1e BJ |
87 | short u_cmask; /* mask for file creation */ |
88 | ||
89 | /* 1.5 - timing and statistics */ | |
90 | struct rusage u_ru; /* stats for this proc */ | |
91 | struct rusage u_cru; /* sum of stats for reaped children */ | |
92 | struct itimerval u_timer[3]; | |
4ce49281 | 93 | struct timeval u_start; |
9f63da1e BJ |
94 | short u_acflag; |
95 | ||
24596b53 KM |
96 | struct uprof { /* profile arguments */ |
97 | short *pr_base; /* buffer base */ | |
98 | unsigned pr_size; /* buffer size */ | |
99 | unsigned pr_off; /* pc offset */ | |
100 | unsigned pr_scale; /* pc scaling */ | |
101 | } u_prof; | |
102 | ||
9f63da1e | 103 | /* 1.6 - resource controls */ |
6a12f671 | 104 | struct rlimit u_rlimit[RLIM_NLIMITS]; |
9f63da1e | 105 | |
24596b53 | 106 | /* namei & co. */ |
24596b53 KM |
107 | struct nameidata u_nd; |
108 | ||
0d48aa14 | 109 | long u_spare[8]; |
6a12f671 | 110 | int u_stack[1]; |
b209f66c BJ |
111 | }; |
112 | ||
113 | /* u_error codes */ | |
88fc1c0a JB |
114 | #ifdef KERNEL |
115 | #include "errno.h" | |
116 | #else | |
36c28aee | 117 | #include <errno.h> |
88fc1c0a | 118 | #endif |
b209f66c BJ |
119 | |
120 | #ifdef KERNEL | |
121 | extern struct user u; | |
122 | extern struct user swaputl; | |
123 | extern struct user forkutl; | |
124 | extern struct user xswaputl; | |
125 | extern struct user xswap2utl; | |
126 | extern struct user pushutl; | |
127 | extern struct user vfutl; | |
128 | #endif |