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