summaryrefslogtreecommitdiff
path: root/usr/src/man/man1/proc.1
blob: cd20e215e3edee374acae91cd7e4753d3960e42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved
.\" Portions Copyright 2008 Chad Mynhier
.\" Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PROC 1 "Oct 23, 2012"
.SH NAME
proc, pflags, pcred, pldd, psig, pstack, pfiles, pwdx, pstop, prun, pwait,
ptime \- proc tools
.SH SYNOPSIS
.LP
.nf
\fB/usr/bin/pflags\fR [\fB-r\fR] \fIpid\fR | \fIcore\fR [/\fIlwp\fR] ...
.fi

.LP
.nf
\fB/usr/bin/pcred\fR [\fIpid\fR | \fIcore\fR]...
.fi

.LP
.nf
\fB/usr/bin/pcred\fR [\fB-u\fR \fIuser/uid\fR] [\fB-g\fR \fIgroup/gid\fR] [\fB-G\fR \fIgrouplist\fR] pid...
.fi

.LP
.nf
\fB/usr/bin/pcred\fR \fB-l\fR \fIlogin\fR \fIpid\fR...
.fi

.LP
.nf
\fB/usr/bin/pldd\fR [\fB-Fl\fR] [\fIpid\fR | \fIcore\fR]...
.fi

.LP
.nf
\fB/usr/bin/psig\fR [\fB-n\fR] \fIpid\fR...
.fi

.LP
.nf
\fB/usr/bin/pstack\fR [\fB-F\fR] \fIpid\fR | \fIcore\fR [/\fIlwp\fR] ...
.fi

.LP
.nf
\fB/usr/bin/pfiles\fR [\fB-Fn\fR] \fIpid\fR | \fIcore\fR...
.fi

.LP
.nf
\fB/usr/bin/pwdx\fR \fIpid\fR...
.fi

.LP
.nf
\fB/usr/bin/pstop\fR \fIpid\fR[/\fIlwp\fR] ...
.fi

.LP
.nf
\fB/usr/bin/prun\fR \fIpid\fR[/\fIlwp\fR] ...
.fi

.LP
.nf
\fB/usr/bin/pwait\fR [\fB-v\fR] \fIpid\fR...
.fi

.LP
.nf
\fB/usr/bin/ptime\fR [\fB-Fm\fR] [\fB-p\fR] \fIpid\fR...
.fi

.LP
.nf
\fB/usr/bin/ptime\fR [\fB-m\fR]\fIcommand\fR [\fIarg\fR]...
.fi

.SH DESCRIPTION
.sp
.LP
The proc tools are utilities that exercise features of \fB/proc\fR (see
\fBproc\fR(4)). Most of them take a list of process-ids (\fIpid\fR). The tools
that do take process-ids also accept \fB/proc/\fR\fInnn\fR as a process-id, so
the shell expansion \fB/proc/*\fR can be used to specify all processes in the
system.
.sp
.LP
Some of the proc tools can also be applied to core files (see \fBcore\fR(4)).
The tools that apply to core files accept a list of either process \fBID\fRs or
names of core files or both.
.sp
.LP
Some of the \fBproc\fR tools can operate on individual threads. Users can
examine only selected threads by appending \fI/thread-id\fR to the process-id
or core. Multiple threads can be selected using the \fB-\fR and \fB,\fR
delimiters. For example \fB/1,2,7-9\fR examines threads \fB1\fR, \fB2\fR,
\fB7\fR, \fB8\fR, and \fB9\fR.
.sp
.LP
See \fBWARNINGS\fR.
.sp
.ne 2
.na
\fB\fBpflags\fR\fR
.ad
.RS 10n
Print the \fB/proc\fR tracing flags, the pending and held signals, and other
\fB/proc\fR status information for each process or specified lwps in each
process.
.RE

.sp
.ne 2
.na
\fB\fBpcred\fR\fR
.ad
.RS 10n
Print or set the credentials (effective, real, saved \fBUID\fRs and \fBGID\fRs)
of each process.
.RE

.sp
.ne 2
.na
\fB\fBpldd\fR\fR
.ad
.RS 10n
List the dynamic libraries linked into each process, including shared objects
explicitly attached using \fBdlopen\fR(3C). See also \fBldd\fR(1).
.RE

.sp
.ne 2
.na
\fB\fBpsig\fR\fR
.ad
.RS 10n
List the signal actions and handlers of each process. See
\fBsignal.h\fR(3HEAD).
.RE

.sp
.ne 2
.na
\fB\fBpstack\fR\fR
.ad
.RS 10n
Print a hex+symbolic stack trace for each process or specified lwps in each
process.
.RE

.sp
.ne 2
.na
\fB\fBpfiles\fR\fR
.ad
.RS 10n
Report \fBfstat\fR(2) and \fBfcntl\fR(2) information for all open files in each
process. For network endpoints, the local (and peer if connected) address
information is also provided. For sockets, the socket type, socket options and
send and receive buffer sizes are also provided. In addition, a path to the
file is reported if the information is available from \fB/proc/pid/path\fR.
This is not necessarily the same name used to open the file. See \fBproc\fR(4)
for more information.
.RE

.sp
.ne 2
.na
\fB\fBpwdx\fR\fR
.ad
.RS 10n
Print the current working directory of each process.
.RE

.sp
.ne 2
.na
\fB\fBpstop\fR\fR
.ad
.RS 10n
Stop each process or the specified lwps (\fBPR_REQUESTED\fR stop).
.RE

.sp
.ne 2
.na
\fB\fBprun\fR\fR
.ad
.RS 10n
Set running each process or the specified lwps (the inverse of \fBpstop\fR).
.RE

.sp
.ne 2
.na
\fB\fBpwait\fR\fR
.ad
.RS 10n
Wait for all of the specified processes to terminate.
.RE

.sp
.ne 2
.na
\fB\fBptime\fR\fR
.ad
.RS 10n
Time the \fIcommand\fR, like \fBtime\fR(1), but using microstate accounting for
reproducible precision. Unlike \fBtime\fR(1), children of the command are not
timed.
.sp
If the \fB-p\fR \fIpid\fR version is used, display a snapshot of timing
statistics for the specified \fIpid\fR.
.RE

.SH OPTIONS
.sp
.LP
The following general options are supported:
.sp
.ne 2
.na
\fB\fB-F\fR\fR
.ad
.RS 6n
Force. Grabs the target process even if another process has control.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR\fR
.ad
.RS 6n
(\fBpsig\fR and \fBpfiles\fR only) Sets non-verbose mode. \fBpsig\fR displays
signal handler addresses rather than names. \fBpfiles\fR does not display
verbose information for each file descriptor. Instead, \fBpfiles\fR limits its
output to the information that would be retrieved if the process applied
\fBfstat\fR(2) to each of its file descriptors.
.RE

.sp
.ne 2
.na
\fB\fB-r\fR\fR
.ad
.RS 6n
(\fBpflags\fR only) If the process is stopped, displays its machine registers.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 6n
(\fBpwait\fR only) Verbose. Reports terminations to standard output.
.RE

.sp
.LP
In addition to the general options, \fBpcred\fR supports the following options:
.sp
.ne 2
.na
\fB\fB-g\fR \fIgroup/gid\fR\fR
.ad
.RS 16n
Sets the real, effective, and saved group ids (\fBGID\fRs) of the target
processes to the specified value.
.RE

.sp
.ne 2
.na
\fB\fB-G\fR \fIgrouplist\fR\fR
.ad
.RS 16n
Sets the supplementary \fBGID\fRs of the target process to the specified list
of groups. The supplementary groups should be specified as a comma-separated
list of group names ids. An empty list clears the supplementary group list of
the target processes.
.RE

.sp
.ne 2
.na
\fB\fB-l\fR \fIlogin\fR\fR
.ad
.RS 16n
Sets the real, effective, and saved \fBUID\fRs of the target processes to the
\fBUID\fR of the specified login. Sets the real, effective, and saved
\fBGID\fRs of the target processes to the \fBGID\fR of the specified login.
Sets the supplementary group list to the supplementary groups list of the
specified login.
.RE

.sp
.ne 2
.na
\fB\fB-u\fR \fIuser/uid\fR\fR
.ad
.RS 16n
Sets the real, effective, and saved user ids (\fBUID\fRs) of the target
processes to the specified value.
.RE

.sp
.LP
In addition to the general options, \fBpldd\fR supports the following option:
.sp
.ne 2
.na
\fB\fB-l\fR\fR
.ad
.RS 6n
Shows unresolved dynamic linker map names.
.RE

.sp
.LP
In addition to the general options, \fBptime\fR supports the following options:
.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 10n
Display the full set of microstate accounting statistics.
.sp
The displayed fields are as follows:
.sp
.ne 2
.na
\fB\fBreal\fR\fR
.ad
.RS 8n
Wall clock time.
.RE

.sp
.ne 2
.na
\fB\fBuser\fR\fR
.ad
.RS 8n
User level CPU time.
.RE

.sp
.ne 2
.na
\fB\fBsys\fR\fR
.ad
.RS 8n
System call CPU time.
.RE

.sp
.ne 2
.na
\fB\fBtrap\fR\fR
.ad
.RS 8n
Other system trap CPU time.
.RE

.sp
.ne 2
.na
\fB\fBtflt\fR\fR
.ad
.RS 8n
Text page fault sleep time.
.RE

.sp
.ne 2
.na
\fB\fBdflt\fR\fR
.ad
.RS 8n
Data page fault sleep time.
.RE

.sp
.ne 2
.na
\fB\fBkflt\fR\fR
.ad
.RS 8n
Kernel page fault sleep time.
.RE

.sp
.ne 2
.na
\fB\fBlock\fR\fR
.ad
.RS 8n
User lock wait sleep time.
.RE

.sp
.ne 2
.na
\fB\fBslp\fR\fR
.ad
.RS 8n
All other sleep time.
.RE

.sp
.ne 2
.na
\fB\fBlat\fR\fR
.ad
.RS 8n
CPU latency (wait) time.
.RE

.sp
.ne 2
.na
\fB\fBstop\fR\fR
.ad
.RS 8n
Stopped time.
.RE

.RE

.sp
.ne 2
.na
\fB\fB-p\fR \fIpid\fR\fR
.ad
.RS 10n
Displays a snapshot of timing statistics for the specified \fIpid\fR.
.RE

.sp
.LP
To set the credentials of another process, a process must have sufficient
privilege to change its user and group ids to those specified according to the
rules laid out in \fBsetuid\fR(2) and it must have sufficient privilege to
control the target process.
.SH USAGE
.sp
.LP
These proc tools stop their target processes while inspecting them and
reporting the results: \fBpfiles\fR, \fBpldd\fR, and \fBpstack\fR. A process
can do nothing while it is stopped. Thus, for example, if the X server is
inspected by one of these proc tools running in a window under the X server's
control, the whole window system can become deadlocked because the proc tool
would be attempting to print its results to a window that cannot be refreshed.
Logging in from from another system using \fBrlogin\fR(1) and killing the
offending proc tool would clear up the deadlock in this case.
.sp
.LP
See \fBWARNINGS\fR.
.sp
.LP
Caution should be exercised when using the \fB-F\fR flag. Imposing two
controlling processes on one victim process can lead to chaos. Safety is
assured only if the primary controlling process, typically a debugger, has
stopped the victim process and the primary controlling process is doing nothing
at the moment of application of the \fBproc\fR tool in question.
.sp
.LP
Some of the proc tools can also be applied to core files, as shown by the
synopsis above. A core file is a snapshot of a process's state and is produced
by the kernel prior to terminating a process with a signal or by the
\fBgcore\fR(1) utility. Some of the proc tools can need to derive the name of
the executable corresponding to the process which dumped core or the names of
shared libraries associated with the process. These files are needed, for
example, to provide symbol table information for \fBpstack\fR(1). If the proc
tool in question is unable to locate the needed executable or shared library,
some symbol information is unavailable for display. Similarly, if a core file
from one operating system release is examined on a different operating system
release, the run-time link-editor debugging interface (\fBlibrtld_db\fR) cannot
be able to initialize. In this case, symbol information for shared libraries is
not available.
.SH EXIT STATUS
.sp
.LP
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 12n
Successful operation.
.RE

.sp
.ne 2
.na
\fBnon-zero\fR
.ad
.RS 12n
An error has occurred.
.RE

.SH FILES
.sp
.ne 2
.na
\fB\fB/proc/*\fR\fR
.ad
.RS 11n
process files
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	See below.
.TE

.sp
.LP
The human readable output is Uncommitted. The options are Committed.
.SH SEE ALSO
.sp
.LP
\fBgcore\fR(1), \fBldd\fR(1), \fBpargs\fR(1), \fBpgrep\fR(1), \fBpkill\fR(1),
\fBplimit\fR(1), \fBpmap\fR(1), \fBpreap\fR(1), \fBps\fR(1), \fBptree\fR(1),
\fBppgsz\fR(1), \fBpwd\fR(1), \fBrlogin\fR(1), \fBtime\fR(1), \fBtruss\fR(1),
\fBwait\fR(1), \fBfcntl\fR(2), \fBfstat\fR(2), \fBsetuid\fR(2),
\fBdlopen\fR(3C), \fBsignal.h\fR(3HEAD), \fBcore\fR(4), \fBproc\fR(4),
\fBprocess\fR(4), \fBattributes\fR(5), \fBzones\fR(5)
.SH WARNINGS
.sp
.LP
The following \fBproc\fR tools stop their target processes while inspecting
them and reporting the results: \fBpfiles\fR, \fBpldd\fR, and \fBpstack\fR.
However, even if \fBpstack\fR operates on an individual thread, it stops the
whole process.
.sp
.LP
A process or thread can do nothing while it is stopped. Stopping a heavily used
process or thread in a production environment, even for a short amount of time,
can cause severe bottlenecks and even hangs of these processes or threads,
causing them to be unavailable to users. Some databases could also terminate
abnormally. Thus, for example, a database server under heavy load could hang
when one of the database processes or threads is traced using the above
mentioned \fBproc\fR tools. Because of this, stopping a UNIX process or thread
in a production environment should be avoided.
.sp
.LP
A process or thread being stopped by these tools can be identified by issuing
\fB/usr/bin/ps\fR \fB-eflL\fR and looking for "\fBT\fR" in the first column.
Notice that certain processes, for example "\fBsched\fR", can show the
"\fBT\fR" status by default most of the time.
.sp
.LP
The process ID returned for locked files on network file systems might not be
meaningful.