Print this page
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/procfs.h
+++ new/usr/src/uts/common/sys/procfs.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 24 * Use is subject to license terms.
25 25 */
26 26 /*
27 27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 28 * Copyright 2015, Joyent, Inc.
29 29 */
30 30
31 31 #ifndef _SYS_PROCFS_H
32 32 #define _SYS_PROCFS_H
33 33
34 34 #ifdef __cplusplus
35 35 extern "C" {
36 36 #endif
37 37
38 38 /*
39 39 * This definition is temporary. Structured proc is the preferred API,
40 40 * and the older ioctl-based interface will be removed in a future version
41 41 * of Solaris. Until then, by default, including <sys/procfs.h> will
42 42 * provide the older ioctl-based /proc definitions. To get the structured
43 43 * /proc definitions, either include <procfs.h> or define _STRUCTURED_PROC
44 44 * to be 1 before including <sys/procfs.h>.
45 45 */
46 46 #ifndef _STRUCTURED_PROC
47 47 #define _STRUCTURED_PROC 0
48 48 #endif
49 49
50 50 #if !defined(_KERNEL) && _STRUCTURED_PROC == 0
51 51
52 52 #include <sys/old_procfs.h>
53 53
54 54 #else /* !defined(_KERNEL) && _STRUCTURED_PROC == 0 */
55 55
56 56 #include <sys/feature_tests.h>
57 57 #include <sys/types.h>
58 58 #include <sys/time_impl.h>
59 59 #include <sys/signal.h>
60 60 #include <sys/siginfo.h>
61 61 #include <sys/fault.h>
62 62 #include <sys/syscall.h>
63 63 #include <sys/pset.h>
64 64 #include <sys/procfs_isa.h>
65 65 #include <sys/priv.h>
66 66 #include <sys/stat.h>
67 67 #include <sys/param.h>
68 68
69 69 /*
70 70 * System call interfaces for /proc.
71 71 */
72 72
73 73 /*
74 74 * Control codes (long values) for messages written to ctl and lwpctl files.
75 75 */
76 76 #define PCNULL 0L /* null request, advance to next message */
77 77 #define PCSTOP 1L /* direct process or lwp to stop and wait for stop */
78 78 #define PCDSTOP 2L /* direct process or lwp to stop */
79 79 #define PCWSTOP 3L /* wait for process or lwp to stop, no timeout */
80 80 #define PCTWSTOP 4L /* wait for stop, with long millisecond timeout arg */
81 81 #define PCRUN 5L /* make process/lwp runnable, w/ long flags argument */
82 82 #define PCCSIG 6L /* clear current signal from lwp */
83 83 #define PCCFAULT 7L /* clear current fault from lwp */
84 84 #define PCSSIG 8L /* set current signal from siginfo_t argument */
85 85 #define PCKILL 9L /* post a signal to process/lwp, long argument */
86 86 #define PCUNKILL 10L /* delete a pending signal from process/lwp, long arg */
87 87 #define PCSHOLD 11L /* set lwp signal mask from sigset_t argument */
88 88 #define PCSTRACE 12L /* set traced signal set from sigset_t argument */
89 89 #define PCSFAULT 13L /* set traced fault set from fltset_t argument */
90 90 #define PCSENTRY 14L /* set traced syscall entry set from sysset_t arg */
91 91 #define PCSEXIT 15L /* set traced syscall exit set from sysset_t arg */
92 92 #define PCSET 16L /* set modes from long argument */
93 93 #define PCUNSET 17L /* unset modes from long argument */
94 94 #define PCSREG 18L /* set lwp general registers from prgregset_t arg */
95 95 #define PCSFPREG 19L /* set lwp floating-point registers from prfpregset_t */
96 96 #define PCSXREG 20L /* set lwp extra registers from prxregset_t arg */
97 97 #define PCNICE 21L /* set nice priority from long argument */
98 98 #define PCSVADDR 22L /* set %pc virtual address from long argument */
99 99 #define PCWATCH 23L /* set/unset watched memory area from prwatch_t arg */
100 100 #define PCAGENT 24L /* create agent lwp with regs from prgregset_t arg */
101 101 #define PCREAD 25L /* read from the address space via priovec_t arg */
102 102 #define PCWRITE 26L /* write to the address space via priovec_t arg */
103 103 #define PCSCRED 27L /* set process credentials from prcred_t argument */
104 104 #define PCSASRS 28L /* set ancillary state registers from asrset_t arg */
105 105 #define PCSPRIV 29L /* set process privileges from prpriv_t argument */
106 106 #define PCSZONE 30L /* set zoneid from zoneid_t argument */
107 107 #define PCSCREDX 31L /* as PCSCRED but with supplemental groups */
108 108 /*
109 109 * PCRUN long operand flags.
110 110 */
111 111 #define PRCSIG 0x01 /* clear current signal, if any */
112 112 #define PRCFAULT 0x02 /* clear current fault, if any */
113 113 #define PRSTEP 0x04 /* direct the lwp to single-step */
114 114 #define PRSABORT 0x08 /* abort syscall, if in syscall */
115 115 #define PRSTOP 0x10 /* set directed stop request */
116 116
117 117 /*
118 118 * lwp status file. /proc/<pid>/lwp/<lwpid>/lwpstatus
119 119 */
120 120 #define PRCLSZ 8 /* maximum size of scheduling class name */
121 121 #define PRSYSARGS 8 /* maximum number of syscall arguments */
122 122 typedef struct lwpstatus {
123 123 int pr_flags; /* flags (see below) */
124 124 id_t pr_lwpid; /* specific lwp identifier */
125 125 short pr_why; /* reason for lwp stop, if stopped */
126 126 short pr_what; /* more detailed reason */
127 127 short pr_cursig; /* current signal, if any */
128 128 short pr_pad1;
129 129 siginfo_t pr_info; /* info associated with signal or fault */
130 130 sigset_t pr_lwppend; /* set of signals pending to the lwp */
131 131 sigset_t pr_lwphold; /* set of signals blocked by the lwp */
132 132 struct sigaction pr_action; /* signal action for current signal */
133 133 stack_t pr_altstack; /* alternate signal stack info */
134 134 uintptr_t pr_oldcontext; /* address of previous ucontext */
135 135 short pr_syscall; /* system call number (if in syscall) */
136 136 short pr_nsysarg; /* number of arguments to this syscall */
137 137 int pr_errno; /* errno for failed syscall, 0 if successful */
138 138 long pr_sysarg[PRSYSARGS]; /* arguments to this syscall */
139 139 long pr_rval1; /* primary syscall return value */
140 140 long pr_rval2; /* second syscall return value, if any */
141 141 char pr_clname[PRCLSZ]; /* scheduling class name */
142 142 timestruc_t pr_tstamp; /* real-time time stamp of stop */
143 143 timestruc_t pr_utime; /* lwp user cpu time */
144 144 timestruc_t pr_stime; /* lwp system cpu time */
145 145 int pr_filler[11 - 2 * sizeof (timestruc_t) / sizeof (int)];
146 146 int pr_errpriv; /* missing privilege */
147 147 uintptr_t pr_ustack; /* address of stack boundary data (stack_t) */
148 148 ulong_t pr_instr; /* current instruction */
149 149 prgregset_t pr_reg; /* general registers */
150 150 prfpregset_t pr_fpreg; /* floating-point registers */
151 151 } lwpstatus_t;
152 152
153 153 /*
154 154 * process status file. /proc/<pid>/status
155 155 */
156 156 typedef struct pstatus {
157 157 int pr_flags; /* flags (see below) */
158 158 int pr_nlwp; /* number of active lwps in the process */
159 159 pid_t pr_pid; /* process id */
160 160 pid_t pr_ppid; /* parent process id */
161 161 pid_t pr_pgid; /* process group id */
162 162 pid_t pr_sid; /* session id */
163 163 id_t pr_aslwpid; /* historical; now always zero */
164 164 id_t pr_agentid; /* lwp id of the /proc agent lwp, if any */
165 165 sigset_t pr_sigpend; /* set of process pending signals */
166 166 uintptr_t pr_brkbase; /* address of the process heap */
167 167 size_t pr_brksize; /* size of the process heap, in bytes */
168 168 uintptr_t pr_stkbase; /* address of the process stack */
169 169 size_t pr_stksize; /* size of the process stack, in bytes */
170 170 timestruc_t pr_utime; /* process user cpu time */
171 171 timestruc_t pr_stime; /* process system cpu time */
172 172 timestruc_t pr_cutime; /* sum of children's user times */
173 173 timestruc_t pr_cstime; /* sum of children's system times */
174 174 sigset_t pr_sigtrace; /* set of traced signals */
175 175 fltset_t pr_flttrace; /* set of traced faults */
176 176 sysset_t pr_sysentry; /* set of system calls traced on entry */
177 177 sysset_t pr_sysexit; /* set of system calls traced on exit */
178 178 char pr_dmodel; /* data model of the process (see below) */
179 179 char pr_pad[3];
180 180 taskid_t pr_taskid; /* task id */
181 181 projid_t pr_projid; /* project id */
182 182 int pr_nzomb; /* number of zombie lwps in the process */
183 183 zoneid_t pr_zoneid; /* zone id */
184 184 int pr_filler[15]; /* reserved for future use */
185 185 lwpstatus_t pr_lwp; /* status of the representative lwp */
186 186 } pstatus_t;
187 187
188 188 /*
189 189 * pr_flags (same values appear in both pstatus_t and lwpstatus_t pr_flags).
190 190 *
191 191 * These flags do *not* apply to psinfo_t.pr_flag or lwpsinfo_t.pr_flag
192 192 * (which are both deprecated).
193 193 */
194 194 /* The following flags apply to the specific or representative lwp */
195 195 #define PR_STOPPED 0x00000001 /* lwp is stopped */
196 196 #define PR_ISTOP 0x00000002 /* lwp is stopped on an event of interest */
197 197 #define PR_DSTOP 0x00000004 /* lwp has a stop directive in effect */
198 198 #define PR_STEP 0x00000008 /* lwp has a single-step directive in effect */
199 199 #define PR_ASLEEP 0x00000010 /* lwp is sleeping in a system call */
200 200 #define PR_PCINVAL 0x00000020 /* contents of pr_instr undefined */
201 201 #define PR_ASLWP 0x00000040 /* obsolete flag; never set */
202 202 #define PR_AGENT 0x00000080 /* this lwp is the /proc agent lwp */
203 203 #define PR_DETACH 0x00000100 /* this is a detached lwp */
204 204 #define PR_DAEMON 0x00000200 /* this is a daemon lwp */
205 205 #define PR_IDLE 0x00000400 /* lwp is a cpu's idle thread */
206 206 /* The following flags apply to the process, not to an individual lwp */
207 207 #define PR_ISSYS 0x00001000 /* this is a system process */
208 208 #define PR_VFORKP 0x00002000 /* process is the parent of a vfork()d child */
209 209 #define PR_ORPHAN 0x00004000 /* process's process group is orphaned */
210 210 #define PR_NOSIGCHLD 0x00008000 /* process will not generate SIGCHLD on exit */
211 211 #define PR_WAITPID 0x00010000 /* only waitid(P_PID, pid) can reap the child */
212 212 /* The following process flags are modes settable by PCSET/PCUNSET */
213 213 #define PR_FORK 0x00100000 /* inherit-on-fork is in effect */
214 214 #define PR_RLC 0x00200000 /* run-on-last-close is in effect */
215 215 #define PR_KLC 0x00400000 /* kill-on-last-close is in effect */
216 216 #define PR_ASYNC 0x00800000 /* asynchronous-stop is in effect */
217 217 #define PR_MSACCT 0x01000000 /* micro-state usage accounting is in effect */
218 218 #define PR_BPTADJ 0x02000000 /* breakpoint trap pc adjustment is in effect */
219 219 #define PR_PTRACE 0x04000000 /* ptrace-compatibility mode is in effect */
220 220 #define PR_MSFORK 0x08000000 /* micro-state accounting inherited on fork */
221 221
222 222 /*
223 223 * See <sys/procfs_isa.h> for possible values of pr_dmodel.
224 224 */
225 225
226 226 /*
227 227 * Reasons for stopping (pr_why).
228 228 */
229 229 #define PR_REQUESTED 1
230 230 #define PR_SIGNALLED 2
231 231 #define PR_SYSENTRY 3
232 232 #define PR_SYSEXIT 4
233 233 #define PR_JOBCONTROL 5
234 234 #define PR_FAULTED 6
235 235 #define PR_SUSPENDED 7
236 236 #define PR_CHECKPOINT 8
237 237 #define PR_BRAND 9
238 238
239 239 /*
240 240 * lwp ps(1) information file. /proc/<pid>/lwp/<lwpid>/lwpsinfo
241 241 */
242 242 #define PRFNSZ 16 /* Maximum size of execed filename */
243 243 typedef struct lwpsinfo {
244 244 int pr_flag; /* lwp flags (DEPRECATED; do not use) */
245 245 id_t pr_lwpid; /* lwp id */
246 246 uintptr_t pr_addr; /* internal address of lwp */
247 247 uintptr_t pr_wchan; /* wait addr for sleeping lwp */
248 248 char pr_stype; /* synchronization event type */
249 249 char pr_state; /* numeric lwp state */
250 250 char pr_sname; /* printable character for pr_state */
251 251 char pr_nice; /* nice for cpu usage */
252 252 short pr_syscall; /* system call number (if in syscall) */
253 253 char pr_oldpri; /* pre-SVR4, low value is high priority */
254 254 char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
255 255 int pr_pri; /* priority, high value is high priority */
256 256 /* The following percent number is a 16-bit binary */
257 257 /* fraction [0 .. 1] with the binary point to the */
258 258 /* right of the high-order bit (1.0 == 0x8000) */
259 259 ushort_t pr_pctcpu; /* % of recent cpu time used by this lwp */
260 260 ushort_t pr_pad;
261 261 timestruc_t pr_start; /* lwp start time, from the epoch */
262 262 timestruc_t pr_time; /* usr+sys cpu time for this lwp */
263 263 char pr_clname[PRCLSZ]; /* scheduling class name */
264 264 char pr_name[PRFNSZ]; /* name of system lwp */
265 265 processorid_t pr_onpro; /* processor which last ran this lwp */
266 266 processorid_t pr_bindpro; /* processor to which lwp is bound */
267 267 psetid_t pr_bindpset; /* processor set to which lwp is bound */
268 268 int pr_lgrp; /* lwp home lgroup */
269 269 int pr_filler[4]; /* reserved for future use */
270 270 } lwpsinfo_t;
271 271
272 272 /*
273 273 * process ps(1) information file. /proc/<pid>/psinfo
274 274 */
275 275 #define PRARGSZ 80 /* number of chars of arguments */
276 276 typedef struct psinfo {
277 277 int pr_flag; /* process flags (DEPRECATED; do not use) */
278 278 int pr_nlwp; /* number of active lwps in the process */
279 279 pid_t pr_pid; /* unique process id */
280 280 pid_t pr_ppid; /* process id of parent */
281 281 pid_t pr_pgid; /* pid of process group leader */
282 282 pid_t pr_sid; /* session id */
283 283 uid_t pr_uid; /* real user id */
284 284 uid_t pr_euid; /* effective user id */
285 285 gid_t pr_gid; /* real group id */
286 286 gid_t pr_egid; /* effective group id */
287 287 uintptr_t pr_addr; /* address of process */
288 288 size_t pr_size; /* size of process image in Kbytes */
289 289 size_t pr_rssize; /* resident set size in Kbytes */
290 290 size_t pr_pad1;
291 291 dev_t pr_ttydev; /* controlling tty device (or PRNODEV) */
292 292 /* The following percent numbers are 16-bit binary */
293 293 /* fractions [0 .. 1] with the binary point to the */
294 294 /* right of the high-order bit (1.0 == 0x8000) */
295 295 ushort_t pr_pctcpu; /* % of recent cpu time used by all lwps */
296 296 ushort_t pr_pctmem; /* % of system memory used by process */
297 297 timestruc_t pr_start; /* process start time, from the epoch */
298 298 timestruc_t pr_time; /* usr+sys cpu time for this process */
299 299 timestruc_t pr_ctime; /* usr+sys cpu time for reaped children */
300 300 char pr_fname[PRFNSZ]; /* name of execed file */
301 301 char pr_psargs[PRARGSZ]; /* initial characters of arg list */
302 302 int pr_wstat; /* if zombie, the wait() status */
303 303 int pr_argc; /* initial argument count */
304 304 uintptr_t pr_argv; /* address of initial argument vector */
305 305 uintptr_t pr_envp; /* address of initial environment vector */
306 306 char pr_dmodel; /* data model of the process */
307 307 char pr_pad2[3];
308 308 taskid_t pr_taskid; /* task id */
309 309 projid_t pr_projid; /* project id */
310 310 int pr_nzomb; /* number of zombie lwps in the process */
311 311 poolid_t pr_poolid; /* pool id */
312 312 zoneid_t pr_zoneid; /* zone id */
313 313 id_t pr_contract; /* process contract */
314 314 int pr_filler[1]; /* reserved for future use */
315 315 lwpsinfo_t pr_lwp; /* information for representative lwp */
316 316 } psinfo_t;
317 317
318 318 #define PRNODEV (dev_t)(-1) /* non-existent device */
319 319
320 320 /*
321 321 * Memory-map interface. /proc/<pid>/map /proc/<pid>/rmap
322 322 */
323 323 #define PRMAPSZ 64
324 324 typedef struct prmap {
325 325 uintptr_t pr_vaddr; /* virtual address of mapping */
326 326 size_t pr_size; /* size of mapping in bytes */
327 327 char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */
328 328 offset_t pr_offset; /* offset into mapped object, if any */
329 329 int pr_mflags; /* protection and attribute flags (see below) */
330 330 int pr_pagesize; /* pagesize (bytes) for this mapping */
331 331 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
332 332 int pr_filler[1]; /* filler for future expansion */
333 333 } prmap_t;
334 334
335 335 /*
336 336 * HAT memory-map interface. /proc/<pid>/xmap
337 337 */
338 338 typedef struct prxmap {
339 339 uintptr_t pr_vaddr; /* virtual address of mapping */
340 340 size_t pr_size; /* size of mapping in bytes */
341 341 char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */
342 342 offset_t pr_offset; /* offset into mapped object, if any */
343 343 int pr_mflags; /* protection and attribute flags (see below) */
344 344 int pr_pagesize; /* pagesize (bytes) for this mapping */
345 345 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
346 346 dev_t pr_dev; /* st_dev from stat64() of mapped object, or PRNODEV */
347 347 uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
348 348 size_t pr_rss; /* pages of resident memory */
349 349 size_t pr_anon; /* pages of resident anonymous memory */
350 350 size_t pr_locked; /* pages of locked memory */
351 351 size_t pr_pad; /* currently unused */
352 352 uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
353 353 #ifdef _ILP32
354 354 ulong_t pr_filler[6]; /* filler for future expansion */
355 355 #else
356 356 ulong_t pr_filler[7]; /* filler for future expansion */
357 357 #endif
358 358 } prxmap_t;
359 359
360 360
361 361 /* Protection and attribute flags */
362 362 #define MA_READ 0x04 /* readable by the traced process */
363 363 #define MA_WRITE 0x02 /* writable by the traced process */
364 364 #define MA_EXEC 0x01 /* executable by the traced process */
365 365 #define MA_SHARED 0x08 /* changes are shared by mapped object */
366 366 #define MA_ANON 0x40 /* anonymous memory (e.g. /dev/zero) */
367 367 #define MA_ISM 0x80 /* intimate shared mem (shared MMU resources) */
368 368 #define MA_NORESERVE 0x100 /* mapped with MAP_NORESERVE */
369 369 #define MA_SHM 0x200 /* System V shared memory */
370 370 #define MA_RESERVED1 0x400 /* reserved for future use */
371 371
372 372 /*
373 373 * These are obsolete and unreliable.
374 374 * They are included here only for historical compatibility.
375 375 */
376 376 #define MA_BREAK 0x10 /* grown by brk(2) */
377 377 #define MA_STACK 0x20 /* grown automatically on stack faults */
378 378
379 379 /*
380 380 * Process credentials. PCSCRED and /proc/<pid>/cred
381 381 */
382 382 typedef struct prcred {
383 383 uid_t pr_euid; /* effective user id */
384 384 uid_t pr_ruid; /* real user id */
385 385 uid_t pr_suid; /* saved user id (from exec) */
386 386 gid_t pr_egid; /* effective group id */
387 387 gid_t pr_rgid; /* real group id */
388 388 gid_t pr_sgid; /* saved group id (from exec) */
389 389 int pr_ngroups; /* number of supplementary groups */
390 390 gid_t pr_groups[1]; /* array of supplementary groups */
391 391 } prcred_t;
392 392
393 393 /*
394 394 * Process privileges. PCSPRIV and /proc/<pid>/priv
395 395 */
396 396 typedef struct prpriv {
397 397 uint32_t pr_nsets; /* number of privilege set */
398 398 uint32_t pr_setsize; /* size of privilege set */
399 399 uint32_t pr_infosize; /* size of supplementary data */
400 400 priv_chunk_t pr_sets[1]; /* array of sets */
401 401 } prpriv_t;
402 402
403 403 /*
404 404 * Watchpoint interface. PCWATCH and /proc/<pid>/watch
405 405 */
406 406 typedef struct prwatch {
407 407 uintptr_t pr_vaddr; /* virtual address of watched area */
408 408 size_t pr_size; /* size of watched area in bytes */
409 409 int pr_wflags; /* watch type flags */
410 410 int pr_pad;
411 411 } prwatch_t;
412 412
413 413 /* pr_wflags */
414 414 #define WA_READ 0x04 /* trap on read access */
415 415 #define WA_WRITE 0x02 /* trap on write access */
416 416 #define WA_EXEC 0x01 /* trap on execute access */
417 417 #define WA_TRAPAFTER 0x08 /* trap after instruction completes */
418 418
419 419 /*
420 420 * PCREAD/PCWRITE I/O interface.
421 421 */
422 422 typedef struct priovec {
423 423 void *pio_base; /* buffer in controlling process */
424 424 size_t pio_len; /* size of read/write request */
425 425 off_t pio_offset; /* virtual address in target process */
426 426 } priovec_t;
427 427
428 428 /*
429 429 * Resource usage. /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
430 430 */
431 431 typedef struct prusage {
432 432 id_t pr_lwpid; /* lwp id. 0: process or defunct */
433 433 int pr_count; /* number of contributing lwps */
434 434 timestruc_t pr_tstamp; /* current time stamp */
435 435 timestruc_t pr_create; /* process/lwp creation time stamp */
436 436 timestruc_t pr_term; /* process/lwp termination time stamp */
437 437 timestruc_t pr_rtime; /* total lwp real (elapsed) time */
438 438 timestruc_t pr_utime; /* user level cpu time */
439 439 timestruc_t pr_stime; /* system call cpu time */
440 440 timestruc_t pr_ttime; /* other system trap cpu time */
441 441 timestruc_t pr_tftime; /* text page fault sleep time */
442 442 timestruc_t pr_dftime; /* data page fault sleep time */
443 443 timestruc_t pr_kftime; /* kernel page fault sleep time */
444 444 timestruc_t pr_ltime; /* user lock wait sleep time */
445 445 timestruc_t pr_slptime; /* all other sleep time */
446 446 timestruc_t pr_wtime; /* wait-cpu (latency) time */
447 447 timestruc_t pr_stoptime; /* stopped time */
448 448 timestruc_t filltime[6]; /* filler for future expansion */
449 449 ulong_t pr_minf; /* minor page faults */
450 450 ulong_t pr_majf; /* major page faults */
451 451 ulong_t pr_nswap; /* swaps */
452 452 ulong_t pr_inblk; /* input blocks */
453 453 ulong_t pr_oublk; /* output blocks */
454 454 ulong_t pr_msnd; /* messages sent */
455 455 ulong_t pr_mrcv; /* messages received */
456 456 ulong_t pr_sigs; /* signals received */
457 457 ulong_t pr_vctx; /* voluntary context switches */
458 458 ulong_t pr_ictx; /* involuntary context switches */
459 459 ulong_t pr_sysc; /* system calls */
460 460 ulong_t pr_ioch; /* chars read and written */
461 461 ulong_t filler[10]; /* filler for future expansion */
462 462 } prusage_t;
463 463
464 464 /*
465 465 * Page data file. /proc/<pid>/pagedata
466 466 */
467 467
468 468 /* page data file header */
469 469 typedef struct prpageheader {
470 470 timestruc_t pr_tstamp; /* real time stamp */
471 471 long pr_nmap; /* number of address space mappings */
472 472 long pr_npage; /* total number of pages */
473 473 } prpageheader_t;
474 474
475 475 /* page data mapping header */
476 476 typedef struct prasmap {
477 477 uintptr_t pr_vaddr; /* virtual address of mapping */
478 478 size_t pr_npage; /* number of pages in mapping */
479 479 char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */
480 480 offset_t pr_offset; /* offset into mapped object, if any */
481 481 int pr_mflags; /* protection and attribute flags */
482 482 int pr_pagesize; /* pagesize (bytes) for this mapping */
483 483 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
484 484 int pr_filler[1]; /* filler for future expansion */
485 485 } prasmap_t;
486 486
487 487 /*
488 488 * pr_npage bytes (plus 0-7 null bytes to round up to an 8-byte boundary)
489 489 * follow each mapping header, each containing zero or more of these flags.
490 490 */
491 491 #define PG_REFERENCED 0x02 /* page referenced since last read */
492 492 #define PG_MODIFIED 0x01 /* page modified since last read */
493 493 #define PG_HWMAPPED 0x04 /* page is present and mapped */
494 494
495 495 /*
496 496 * Open files. Only in core files (for now). Note that we'd like to use
497 497 * the stat or stat64 structure, but both of these structures are unfortunately
498 498 * not consistent between 32 and 64 bit modes. To keep our lives simpler, we
499 499 * just define our own structure with types that are not sensitive to this
500 500 * difference. Also, it turns out that pfiles omits a lot of info from the
501 501 * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
502 502 * here.
503 503 */
504 504 typedef struct prfdinfo {
505 505 int pr_fd;
506 506 mode_t pr_mode;
507 507
508 508 uid_t pr_uid;
509 509 gid_t pr_gid;
510 510
511 511 major_t pr_major; /* think stat.st_dev */
512 512 minor_t pr_minor;
513 513
514 514 major_t pr_rmajor; /* think stat.st_rdev */
515 515 minor_t pr_rminor;
516 516
517 517 ino64_t pr_ino;
518 518 off64_t pr_offset;
519 519 off64_t pr_size;
520 520
521 521 int pr_fileflags; /* fcntl(F_GETXFL), etc */
522 522 int pr_fdflags; /* fcntl(F_GETFD), etc. */
523 523
524 524 char pr_path[MAXPATHLEN];
525 525 } prfdinfo_t;
526 526
527 527 /*
528 528 * Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
529 529 */
530 530 typedef struct prheader {
531 531 long pr_nent; /* number of entries */
532 532 long pr_entsize; /* size of each entry, in bytes */
533 533 } prheader_t;
534 534
535 535 /*
536 536 * Macros for manipulating sets of flags.
537 537 * sp must be a pointer to one of sigset_t, fltset_t, or sysset_t.
538 538 * flag must be a member of the enumeration corresponding to *sp.
539 539 */
540 540
541 541 /* turn on all flags in set */
542 542 #define prfillset(sp) \
543 543 { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
544 544 while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0xFFFFFFFF; }
545 545
546 546 /* turn off all flags in set */
547 547 #define premptyset(sp) \
548 548 { register int _i_ = sizeof (*(sp))/sizeof (uint32_t); \
549 549 while (_i_) ((uint32_t *)(sp))[--_i_] = (uint32_t)0; }
550 550
551 551 /* turn on specified flag in set */
552 552 #define praddset(sp, flag) \
553 553 ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
554 554 (((uint32_t *)(sp))[((flag)-1)/32] |= (1U<<(((flag)-1)%32))) : 0))
555 555
556 556 /* turn off specified flag in set */
557 557 #define prdelset(sp, flag) \
558 558 ((void)(((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) ? \
559 559 (((uint32_t *)(sp))[((flag)-1)/32] &= ~(1U<<(((flag)-1)%32))) : 0))
560 560
561 561 /* query: != 0 iff flag is turned on in set */
562 562 #define prismember(sp, flag) \
563 563 (((unsigned)((flag)-1) < 32*sizeof (*(sp))/sizeof (uint32_t)) && \
564 564 (((uint32_t *)(sp))[((flag)-1)/32] & (1U<<(((flag)-1)%32))))
565 565
566 566 #if defined(_SYSCALL32)
567 567
568 568 /*
569 569 * dev32_t version of PRNODEV
570 570 */
571 571 #define PRNODEV32 (dev32_t)(-1)
572 572
573 573 /*
574 574 * Kernel view of /proc structures for _ILP32 programs.
575 575 */
576 576
577 577 /*
578 578 * _ILP32 lwp status file. /proc/<pid>/lwp/<lwpid>/lwpstatus
579 579 */
580 580 typedef struct lwpstatus32 {
581 581 int pr_flags; /* flags */
582 582 id32_t pr_lwpid; /* specific lwp identifier */
583 583 short pr_why; /* reason for lwp stop, if stopped */
584 584 short pr_what; /* more detailed reason */
585 585 short pr_cursig; /* current signal, if any */
586 586 short pr_pad1;
587 587 siginfo32_t pr_info; /* info associated with signal or fault */
588 588 sigset_t pr_lwppend; /* set of signals pending to the lwp */
589 589 sigset_t pr_lwphold; /* set of signals blocked by the lwp */
590 590 struct sigaction32 pr_action; /* signal action for current signal */
591 591 stack32_t pr_altstack; /* alternate signal stack info */
592 592 caddr32_t pr_oldcontext; /* address of previous ucontext */
593 593 short pr_syscall; /* system call number (if in syscall) */
594 594 short pr_nsysarg; /* number of arguments to this syscall */
595 595 int pr_errno; /* errno for failed syscall, 0 if successful */
596 596 int32_t pr_sysarg[PRSYSARGS]; /* arguments to this syscall */
597 597 int32_t pr_rval1; /* primary syscall return value */
598 598 int32_t pr_rval2; /* second syscall return value, if any */
599 599 char pr_clname[PRCLSZ]; /* scheduling class name */
600 600 timestruc32_t pr_tstamp; /* real-time time stamp of stop */
601 601 timestruc32_t pr_utime; /* lwp user cpu time */
602 602 timestruc32_t pr_stime; /* lwp system cpu time */
603 603 int pr_filler[11 - 2 * sizeof (timestruc32_t) / sizeof (int)];
604 604 int pr_errpriv; /* missing privilege */
605 605 caddr32_t pr_ustack; /* address of stack boundary data (stack32_t) */
606 606 uint32_t pr_instr; /* current instruction */
607 607 prgregset32_t pr_reg; /* general registers */
608 608 prfpregset32_t pr_fpreg; /* floating-point registers */
609 609 } lwpstatus32_t;
610 610
611 611 /*
612 612 * _ILP32 process status file. /proc/<pid>/status
613 613 */
614 614 typedef struct pstatus32 {
615 615 int pr_flags; /* flags */
616 616 int pr_nlwp; /* number of active lwps in the process */
617 617 pid32_t pr_pid; /* process id */
618 618 pid32_t pr_ppid; /* parent process id */
619 619 pid32_t pr_pgid; /* process group id */
620 620 pid32_t pr_sid; /* session id */
621 621 id32_t pr_aslwpid; /* historical; now always zero */
622 622 id32_t pr_agentid; /* lwp id of the /proc agent lwp, if any */
623 623 sigset_t pr_sigpend; /* set of process pending signals */
624 624 caddr32_t pr_brkbase; /* address of the process heap */
625 625 size32_t pr_brksize; /* size of the process heap, in bytes */
626 626 caddr32_t pr_stkbase; /* address of the process stack */
627 627 size32_t pr_stksize; /* size of the process stack, in bytes */
628 628 timestruc32_t pr_utime; /* process user cpu time */
629 629 timestruc32_t pr_stime; /* process system cpu time */
630 630 timestruc32_t pr_cutime; /* sum of children's user times */
631 631 timestruc32_t pr_cstime; /* sum of children's system times */
632 632 sigset_t pr_sigtrace; /* set of traced signals */
633 633 fltset_t pr_flttrace; /* set of traced faults */
634 634 sysset_t pr_sysentry; /* set of system calls traced on entry */
635 635 sysset_t pr_sysexit; /* set of system calls traced on exit */
636 636 char pr_dmodel; /* data model of the process */
637 637 char pr_pad[3];
638 638 id32_t pr_taskid; /* task id */
639 639 id32_t pr_projid; /* project id */
640 640 int pr_nzomb; /* number of zombie lwps in the process */
641 641 id32_t pr_zoneid; /* zone id */
642 642 int pr_filler[15]; /* reserved for future use */
643 643 lwpstatus32_t pr_lwp; /* status of the representative lwp */
644 644 } pstatus32_t;
645 645
646 646 /*
647 647 * _ILP32 lwp ps(1) information file. /proc/<pid>/lwp/<lwpid>/lwpsinfo
648 648 */
649 649 typedef struct lwpsinfo32 {
650 650 int pr_flag; /* lwp flags */
651 651 id32_t pr_lwpid; /* lwp id */
652 652 caddr32_t pr_addr; /* internal address of lwp */
653 653 caddr32_t pr_wchan; /* wait addr for sleeping lwp */
654 654 char pr_stype; /* synchronization event type */
655 655 char pr_state; /* numeric lwp state */
656 656 char pr_sname; /* printable character for pr_state */
657 657 char pr_nice; /* nice for cpu usage */
658 658 short pr_syscall; /* system call number (if in syscall) */
659 659 char pr_oldpri; /* pre-SVR4, low value is high priority */
660 660 char pr_cpu; /* pre-SVR4, cpu usage for scheduling */
661 661 int pr_pri; /* priority, high value is high priority */
662 662 /* The following percent number is a 16-bit binary */
663 663 /* fraction [0 .. 1] with the binary point to the */
664 664 /* right of the high-order bit (1.0 == 0x8000) */
665 665 ushort_t pr_pctcpu; /* % of recent cpu time used by this lwp */
666 666 ushort_t pr_pad;
667 667 timestruc32_t pr_start; /* lwp start time, from the epoch */
668 668 timestruc32_t pr_time; /* usr+sys cpu time for this lwp */
669 669 char pr_clname[PRCLSZ]; /* scheduling class name */
670 670 char pr_name[PRFNSZ]; /* name of system lwp */
671 671 processorid_t pr_onpro; /* processor which last ran this lwp */
672 672 processorid_t pr_bindpro; /* processor to which lwp is bound */
673 673 psetid_t pr_bindpset; /* processor set to which lwp is bound */
674 674 int pr_lgrp; /* lwp home lgroup */
675 675 int pr_filler[4]; /* reserved for future use */
676 676 } lwpsinfo32_t;
677 677
678 678 /*
679 679 * _ILP32 process ps(1) information file. /proc/<pid>/psinfo
680 680 */
681 681 typedef struct psinfo32 {
682 682 int pr_flag; /* process flags */
683 683 int pr_nlwp; /* number of active lwps in the process */
684 684 pid32_t pr_pid; /* unique process id */
685 685 pid32_t pr_ppid; /* process id of parent */
686 686 pid32_t pr_pgid; /* pid of process group leader */
687 687 pid32_t pr_sid; /* session id */
688 688 uid32_t pr_uid; /* real user id */
689 689 uid32_t pr_euid; /* effective user id */
690 690 gid32_t pr_gid; /* real group id */
691 691 gid32_t pr_egid; /* effective group id */
692 692 caddr32_t pr_addr; /* address of process */
693 693 size32_t pr_size; /* size of process image in Kbytes */
694 694 size32_t pr_rssize; /* resident set size in Kbytes */
695 695 size32_t pr_pad1;
696 696 dev32_t pr_ttydev; /* controlling tty device (or PRNODEV) */
697 697 ushort_t pr_pctcpu; /* % of recent cpu time used by all lwps */
698 698 ushort_t pr_pctmem; /* % of system memory used by process */
699 699 timestruc32_t pr_start; /* process start time, from the epoch */
700 700 timestruc32_t pr_time; /* usr+sys cpu time for this process */
701 701 timestruc32_t pr_ctime; /* usr+sys cpu time for reaped children */
702 702 char pr_fname[PRFNSZ]; /* name of execed file */
703 703 char pr_psargs[PRARGSZ]; /* initial characters of arg list */
704 704 int pr_wstat; /* if zombie, the wait() status */
705 705 int pr_argc; /* initial argument count */
706 706 caddr32_t pr_argv; /* address of initial argument vector */
707 707 caddr32_t pr_envp; /* address of initial environment vector */
708 708 char pr_dmodel; /* data model of the process */
709 709 char pr_pad2[3];
710 710 id32_t pr_taskid; /* task id */
711 711 id32_t pr_projid; /* project id */
712 712 int pr_nzomb; /* number of zombie lwps in the process */
713 713 id32_t pr_poolid; /* pool id */
714 714 id32_t pr_zoneid; /* zone id */
715 715 id32_t pr_contract; /* process contract */
716 716 int pr_filler[1]; /* reserved for future use */
717 717 lwpsinfo32_t pr_lwp; /* information for representative lwp */
718 718 } psinfo32_t;
719 719
720 720 /*
721 721 * _ILP32 Memory-management interface. /proc/<pid>/map /proc/<pid>/rmap
722 722 */
723 723 typedef struct prmap32 {
724 724 caddr32_t pr_vaddr; /* virtual address of mapping */
725 725 size32_t pr_size; /* size of mapping in bytes */
726 726 char pr_mapname[64]; /* name in /proc/<pid>/object */
727 727 offset_t pr_offset; /* offset into mapped object, if any */
728 728 int pr_mflags; /* protection and attribute flags */
729 729 int pr_pagesize; /* pagesize (bytes) for this mapping */
730 730 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
731 731 int pr_filler[1]; /* filler for future expansion */
732 732 } prmap32_t;
733 733
734 734 /*
735 735 * _ILP32 HAT memory-map interface. /proc/<pid>/xmap
736 736 */
737 737 typedef struct prxmap32 {
738 738 caddr32_t pr_vaddr; /* virtual address of mapping */
739 739 size32_t pr_size; /* size of mapping in bytes */
740 740 char pr_mapname[PRMAPSZ]; /* name in /proc/<pid>/object */
741 741 offset_t pr_offset; /* offset into mapped object, if any */
742 742 int pr_mflags; /* protection and attribute flags (see below) */
743 743 int pr_pagesize; /* pagesize (bytes) for this mapping */
744 744 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
745 745 dev32_t pr_dev; /* st_dev from stat64() of mapped object, or PRNODEV */
746 746 uint64_t pr_ino; /* st_ino from stat64() of mapped object, if any */
747 747 uint32_t pr_rss; /* pages of resident memory */
748 748 uint32_t pr_anon; /* pages of resident anonymous memory */
749 749 uint32_t pr_locked; /* pages of locked memory */
750 750 uint32_t pr_pad; /* currently unused */
751 751 uint64_t pr_hatpagesize; /* pagesize of the hat mapping */
752 752 uint32_t pr_filler[6]; /* filler for future expansion */
753 753 } prxmap32_t;
754 754
755 755 /*
756 756 * _ILP32 Process credentials. PCSCRED and /proc/<pid>/cred
757 757 */
758 758 typedef struct prcred32 {
759 759 uid32_t pr_euid; /* effective user id */
760 760 uid32_t pr_ruid; /* real user id */
761 761 uid32_t pr_suid; /* saved user id (from exec) */
762 762 gid32_t pr_egid; /* effective group id */
763 763 gid32_t pr_rgid; /* real group id */
764 764 gid32_t pr_sgid; /* saved group id (from exec) */
765 765 int pr_ngroups; /* number of supplementary groups */
766 766 gid32_t pr_groups[1]; /* array of supplementary groups */
767 767 } prcred32_t;
768 768
769 769 /*
770 770 * _ILP32 Watchpoint interface. PCWATCH and /proc/<pid>/watch
771 771 */
772 772 typedef struct prwatch32 {
773 773 caddr32_t pr_vaddr; /* virtual address of watched area */
774 774 size32_t pr_size; /* size of watched area in bytes */
775 775 int pr_wflags; /* watch type flags */
776 776 int pr_pad;
777 777 } prwatch32_t;
778 778
779 779 /*
780 780 * _ILP32 PCREAD/PCWRITE I/O interface.
781 781 */
782 782 typedef struct priovec32 {
783 783 caddr32_t pio_base; /* buffer in controlling process */
784 784 size32_t pio_len; /* size of read/write request */
785 785 off32_t pio_offset; /* virtual address in target process */
786 786 } priovec32_t;
787 787
788 788 /*
789 789 * _ILP32 Resource usage. /proc/<pid>/usage /proc/<pid>/lwp/<lwpid>/lwpusage
790 790 */
791 791 typedef struct prusage32 {
792 792 id32_t pr_lwpid; /* lwp id. 0: process or defunct */
793 793 int32_t pr_count; /* number of contributing lwps */
794 794 timestruc32_t pr_tstamp; /* current time stamp */
795 795 timestruc32_t pr_create; /* process/lwp creation time stamp */
796 796 timestruc32_t pr_term; /* process/lwp termination time stamp */
797 797 timestruc32_t pr_rtime; /* total lwp real (elapsed) time */
798 798 timestruc32_t pr_utime; /* user level cpu time */
799 799 timestruc32_t pr_stime; /* system call cpu time */
800 800 timestruc32_t pr_ttime; /* other system trap cpu time */
801 801 timestruc32_t pr_tftime; /* text page fault sleep time */
802 802 timestruc32_t pr_dftime; /* data page fault sleep time */
803 803 timestruc32_t pr_kftime; /* kernel page fault sleep time */
804 804 timestruc32_t pr_ltime; /* user lock wait sleep time */
805 805 timestruc32_t pr_slptime; /* all other sleep time */
806 806 timestruc32_t pr_wtime; /* wait-cpu (latency) time */
807 807 timestruc32_t pr_stoptime; /* stopped time */
808 808 timestruc32_t filltime[6]; /* filler for future expansion */
809 809 uint32_t pr_minf; /* minor page faults */
810 810 uint32_t pr_majf; /* major page faults */
811 811 uint32_t pr_nswap; /* swaps */
812 812 uint32_t pr_inblk; /* input blocks */
813 813 uint32_t pr_oublk; /* output blocks */
814 814 uint32_t pr_msnd; /* messages sent */
815 815 uint32_t pr_mrcv; /* messages received */
816 816 uint32_t pr_sigs; /* signals received */
817 817 uint32_t pr_vctx; /* voluntary context switches */
818 818 uint32_t pr_ictx; /* involuntary context switches */
819 819 uint32_t pr_sysc; /* system calls */
820 820 uint32_t pr_ioch; /* chars read and written */
821 821 uint32_t filler[10]; /* filler for future expansion */
822 822 } prusage32_t;
823 823
824 824 /*
825 825 * _ILP32 Page data file. /proc/<pid>/pagedata
826 826 */
827 827
828 828 /* _ILP32 page data file header */
829 829 typedef struct prpageheader32 {
830 830 timestruc32_t pr_tstamp; /* real time stamp */
831 831 int32_t pr_nmap; /* number of address space mappings */
832 832 int32_t pr_npage; /* total number of pages */
833 833 } prpageheader32_t;
834 834
835 835 /* _ILP32 page data mapping header */
836 836 typedef struct prasmap32 {
837 837 caddr32_t pr_vaddr; /* virtual address of mapping */
838 838 size32_t pr_npage; /* number of pages in mapping */
839 839 char pr_mapname[64]; /* name in /proc/<pid>/object */
840 840 offset_t pr_offset; /* offset into mapped object, if any */
841 841 int pr_mflags; /* protection and attribute flags */
842 842 int pr_pagesize; /* pagesize (bytes) for this mapping */
843 843 int pr_shmid; /* SysV shmid, -1 if not SysV shared memory */
844 844 int pr_filler[1]; /* filler for future expansion */
845 845 } prasmap32_t;
846 846
847 847 /*
848 848 * _ILP32 Header for /proc/<pid>/lstatus /proc/<pid>/lpsinfo /proc/<pid>/lusage
849 849 */
850 850 typedef struct prheader32 {
851 851 int32_t pr_nent; /* number of entries */
852 852 int32_t pr_entsize; /* size of each entry, in bytes */
853 853 } prheader32_t;
854 854
855 855 #endif /* _SYSCALL32 */
856 856
857 857 #endif /* !_KERNEL && _STRUCTURED_PROC == 0 */
858 858
859 859 #ifdef __cplusplus
860 860 }
861 861 #endif
862 862
863 863 #endif /* _SYS_PROCFS_H */
|
↓ open down ↓ |
863 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX