2 * Copyright (c) 1982, 1986, 1989, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)user.h 8.2 (Berkeley) 9/23/93
40 #include <machine/pcb.h>
42 /* stuff that *used* to be included by user.h, or is now needed */
43 #include <sys/errno.h>
45 #include <sys/resource.h>
46 #include <sys/ucred.h>
48 #include <sys/_mutex.h>
49 #include <sys/_lock.h>
51 #include <vm/vm.h> /* XXX */
52 #include <vm/vm_param.h> /* XXX */
53 #include <vm/pmap.h> /* XXX */
54 #include <vm/vm_map.h> /* XXX */
56 #ifndef _SYS_RESOURCEVAR_H_
57 #include <sys/resourcevar.h>
59 #ifndef _SYS_SIGNALVAR_H_
60 #include <sys/signalvar.h>
64 * KERN_PROC subtype ops return arrays of selected proc structure entries:
66 * When adding new fields to this structure, ALWAYS add them at the end
67 * and decrease the size of the spare field by the amount of space that
68 * you are adding. Byte aligned data should be added to the ki_sparestring
69 * space; other entries should be added to the ki_spare space. Always
70 * verify that sizeof(struct kinfo_proc) == KINFO_PROC_SIZE when you are
71 * done. If you change the size of this structure, many programs will stop
72 * working! Once you have added the new field, you will need to add code
73 * to initialize it in two places: kern/kern_proc.c in the function
74 * fill_kinfo_proc and in lib/libkvm/kvm_proc.c in the function kvm_proclist.
77 #define KINFO_PROC_SIZE 912 /* the correct size for kinfo_proc */
80 #define KINFO_PROC_SIZE 888
83 #define KINFO_PROC_SIZE 648 /* the correct size for kinfo_proc */
85 #ifndef KINFO_PROC_SIZE
86 #error "Unknown architecture"
88 #define WMESGLEN 8 /* size of returned wchan message */
89 #define MTXNAMELEN 8 /* size of returned mutex name */
92 int ki_structsize; /* size of this structure */
93 int ki_layout; /* reserved: layout identifier */
94 struct pargs *ki_args; /* address of command arguments */
95 struct proc *ki_paddr; /* address of proc */
96 struct user *ki_addr; /* kernel virtual addr of u-area */
97 struct vnode *ki_tracep; /* pointer to trace file */
98 struct vnode *ki_textvp; /* pointer to executable file */
99 struct filedesc *ki_fd; /* pointer to open file info */
100 struct vmspace *ki_vmspace; /* pointer to kernel vmspace struct */
101 void *ki_wchan; /* sleep address */
102 pid_t ki_pid; /* Process identifier */
103 pid_t ki_ppid; /* parent process id */
104 pid_t ki_pgid; /* process group id */
105 pid_t ki_tpgid; /* tty process group id */
106 pid_t ki_sid; /* Process session ID */
107 pid_t ki_tsid; /* Terminal session ID */
108 short ki_jobc; /* job control counter */
109 udev_t ki_tdev; /* controlling tty dev */
110 sigset_t ki_siglist; /* Signals arrived but not delivered */
111 sigset_t ki_sigmask; /* Current signal mask */
112 sigset_t ki_sigignore; /* Signals being ignored */
113 sigset_t ki_sigcatch; /* Signals being caught by user */
114 uid_t ki_uid; /* effective user id */
115 uid_t ki_ruid; /* Real user id */
116 uid_t ki_svuid; /* Saved effective user id */
117 gid_t ki_rgid; /* Real group id */
118 gid_t ki_svgid; /* Saved effective group id */
119 short ki_ngroups; /* number of groups */
120 gid_t ki_groups[NGROUPS]; /* groups */
121 vm_size_t ki_size; /* virtual size */
122 segsz_t ki_rssize; /* current resident set size in pages */
123 segsz_t ki_swrss; /* resident set size before last swap */
124 segsz_t ki_tsize; /* text size (pages) XXX */
125 segsz_t ki_dsize; /* data size (pages) XXX */
126 segsz_t ki_ssize; /* stack size (pages) */
127 u_short ki_xstat; /* Exit status for wait & stop signal */
128 u_short ki_acflag; /* Accounting flags */
129 fixpt_t ki_pctcpu; /* %cpu for process during ki_swtime */
130 u_int ki_estcpu; /* Time averaged value of ki_cpticks */
131 u_int ki_slptime; /* Time since last blocked */
132 u_int ki_swtime; /* Time swapped in or out */
133 u_int64_t ki_runtime; /* Real time in microsec */
134 struct timeval ki_start; /* starting time */
135 struct timeval ki_childtime; /* time used by process children */
136 long ki_flag; /* P_* flags */
137 long ki_kiflag; /* KI_* flags (below) */
138 int ki_traceflag; /* Kernel trace points */
139 char ki_stat; /* S* process status */
140 char ki_nice; /* Process "nice" value */
141 char ki_lock; /* Process lock (prevent swap) count */
142 char ki_rqindex; /* Run queue index */
143 u_char ki_oncpu; /* Which cpu we are on */
144 u_char ki_lastcpu; /* Last cpu we were on */
145 char ki_comm[MAXCOMLEN+1]; /* command name */
146 char ki_wmesg[WMESGLEN+1]; /* wchan message */
147 char ki_login[MAXLOGNAME+1]; /* setlogin name */
148 char ki_mtxname[MTXNAMELEN+1]; /* mutex name */
149 char ki_sparestrings[102]; /* spare string space */
150 struct rusage ki_rusage; /* process rusage statistics */
151 long ki_sflag; /* PS_* flags */
152 struct priority ki_pri; /* process priority */
153 long ki_spare[25]; /* spare constants */
155 void fill_kinfo_proc __P((struct proc *, struct kinfo_proc *));
157 /* ki_sessflag values */
158 #define KI_CTTY 0x00000001 /* controlling tty vnode active */
159 #define KI_SLEADER 0x00000002 /* session leader */
160 #define KI_MTXBLOCK 0x00000004 /* proc blocked on mutex ki_mtxname */
163 * Per process structure containing data that isn't needed in core
164 * when the process isn't running (esp. when swapped out).
165 * This structure may or may not be at the same kernel address
171 struct sigacts u_sigacts; /* p_sigacts points here (use it!) */
172 struct pstats u_stats; /* p_stats points here (use it!) */
174 * Remaining fields only for core dump and/or ptrace--
175 * not valid at other times!
177 struct kinfo_proc u_kproc; /* proc + eproc */
178 struct md_coredump u_md; /* machine dependent glop */