9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29 * Copyright (c) 2012 Joyent, Inc. All rights reserved.
30 */
31
32
33 #ifndef _SYS_USER_H
34 #define _SYS_USER_H
35
36 #include <sys/types.h>
37 #include <sys/signal.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * struct exdata is visible in and out of the kernel. This is because it
45 * is referenced in <sys/core.h> which doesn't have this kind of magic.
46 */
47 struct exdata {
48 struct vnode *vp;
49 size_t ux_tsize; /* text size */
168
169 #define UF_EXIT(ufp) mutex_exit(&ufp->uf_lock)
170
171 #define PSARGSZ 80 /* Space for exec arguments (used by ps(1)) */
172 #define MAXCOMLEN 16 /* <= MAXNAMLEN, >= sizeof (ac_comm) */
173
174 typedef struct { /* kernel syscall set type */
175 uint_t word[9]; /* space for syscall numbers [1..288] */
176 } k_sysset_t;
177
178 /*
179 * __KERN_NAUXV_IMPL is defined as a convenience sizing mechanism
180 * for the portions of the kernel that care about aux vectors.
181 *
182 * Applications that need to know how many aux vectors the kernel
183 * supplies should use the proc(4) interface to read /proc/PID/auxv.
184 *
185 * This value should not be changed in a patch.
186 */
187 #if defined(__sparc)
188 #define __KERN_NAUXV_IMPL 20
189 #elif defined(__i386) || defined(__amd64)
190 #define __KERN_NAUXV_IMPL 22
191 #endif
192
193 struct execsw;
194
195 /*
196 * The user structure; one allocated per process. Contains all the
197 * per-process data that doesn't need to be referenced while the
198 * process is swapped.
199 */
200 typedef struct user {
201 /*
202 * These fields are initialized at process creation time and never
203 * modified. They can be accessed without acquiring locks.
204 */
205 struct execsw *u_execsw; /* pointer to exec switch entry */
206 auxv_t u_auxv[__KERN_NAUXV_IMPL]; /* aux vector from exec */
207 timestruc_t u_start; /* hrestime at process start */
208 clock_t u_ticks; /* lbolt at process start */
209 char u_comm[MAXCOMLEN + 1]; /* executable file name from exec */
210 char u_psargs[PSARGSZ]; /* arguments from exec */
211 int u_argc; /* value of argc passed to main() */
212 uintptr_t u_argv; /* value of argv passed to main() */
213 uintptr_t u_envp; /* value of envp passed to main() */
214
215 /*
216 * These fields are protected by p_lock:
217 */
218 struct vnode *u_cdir; /* current directory */
219 struct vnode *u_rdir; /* root directory */
220 uint64_t u_mem; /* accumulated memory usage */
221 size_t u_mem_max; /* peak RSS (K) */
222 mode_t u_cmask; /* mask for file creation */
223 char u_acflag; /* accounting flag */
224 char u_systrap; /* /proc: any syscall mask bits set? */
225 refstr_t *u_cwd; /* cached string for cwd */
226
227 k_sysset_t u_entrymask; /* /proc syscall stop-on-entry mask */
228 k_sysset_t u_exitmask; /* /proc syscall stop-on-exit mask */
229 k_sigset_t u_signodefer; /* signals defered when caught */
230 k_sigset_t u_sigonstack; /* signals taken on alternate stack */
231 k_sigset_t u_sigresethand; /* signals reset when caught */
232 k_sigset_t u_sigrestart; /* signals that restart system calls */
233 k_sigset_t u_sigmask[MAXSIG]; /* signals held while in catcher */
|
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
28 /*
29 * Copyright 2016 Joyent, Inc.
30 */
31
32
33 #ifndef _SYS_USER_H
34 #define _SYS_USER_H
35
36 #include <sys/types.h>
37 #include <sys/signal.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /*
44 * struct exdata is visible in and out of the kernel. This is because it
45 * is referenced in <sys/core.h> which doesn't have this kind of magic.
46 */
47 struct exdata {
48 struct vnode *vp;
49 size_t ux_tsize; /* text size */
168
169 #define UF_EXIT(ufp) mutex_exit(&ufp->uf_lock)
170
171 #define PSARGSZ 80 /* Space for exec arguments (used by ps(1)) */
172 #define MAXCOMLEN 16 /* <= MAXNAMLEN, >= sizeof (ac_comm) */
173
174 typedef struct { /* kernel syscall set type */
175 uint_t word[9]; /* space for syscall numbers [1..288] */
176 } k_sysset_t;
177
178 /*
179 * __KERN_NAUXV_IMPL is defined as a convenience sizing mechanism
180 * for the portions of the kernel that care about aux vectors.
181 *
182 * Applications that need to know how many aux vectors the kernel
183 * supplies should use the proc(4) interface to read /proc/PID/auxv.
184 *
185 * This value should not be changed in a patch.
186 */
187 #if defined(__sparc)
188 #define __KERN_NAUXV_IMPL 24
189 #elif defined(__i386) || defined(__amd64)
190 #define __KERN_NAUXV_IMPL 26
191 #endif
192
193 struct execsw;
194
195 /*
196 * The user structure; one allocated per process. Contains all the
197 * per-process data that doesn't need to be referenced while the
198 * process is swapped.
199 */
200 typedef struct user {
201 /*
202 * These fields are initialized at process creation time and never
203 * modified. They can be accessed without acquiring locks.
204 */
205 struct execsw *u_execsw; /* pointer to exec switch entry */
206 auxv_t u_auxv[__KERN_NAUXV_IMPL]; /* aux vector from exec */
207 timestruc_t u_start; /* hrestime at process start */
208 clock_t u_ticks; /* lbolt at process start */
209 char u_comm[MAXCOMLEN + 1]; /* executable file name from exec */
210 char u_psargs[PSARGSZ]; /* arguments from exec */
211 int u_argc; /* value of argc passed to main() */
212 uintptr_t u_argv; /* value of argv passed to main() */
213 uintptr_t u_envp; /* value of envp passed to main() */
214 uintptr_t u_commpagep; /* address of mapped comm page */
215
216 /*
217 * These fields are protected by p_lock:
218 */
219 struct vnode *u_cdir; /* current directory */
220 struct vnode *u_rdir; /* root directory */
221 uint64_t u_mem; /* accumulated memory usage */
222 size_t u_mem_max; /* peak RSS (K) */
223 mode_t u_cmask; /* mask for file creation */
224 char u_acflag; /* accounting flag */
225 char u_systrap; /* /proc: any syscall mask bits set? */
226 refstr_t *u_cwd; /* cached string for cwd */
227
228 k_sysset_t u_entrymask; /* /proc syscall stop-on-entry mask */
229 k_sysset_t u_exitmask; /* /proc syscall stop-on-exit mask */
230 k_sigset_t u_signodefer; /* signals defered when caught */
231 k_sigset_t u_sigonstack; /* signals taken on alternate stack */
232 k_sigset_t u_sigresethand; /* signals reset when caught */
233 k_sigset_t u_sigrestart; /* signals that restart system calls */
234 k_sigset_t u_sigmask[MAXSIG]; /* signals held while in catcher */
|