view usr/src/man/man1/proc.1 @ 13875:f128a109e6d2

3294 pfiles postmortem support Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Eric Schrock <eric.schrock@delphix.com>
author Garrett D'Amore <garrett@damore.org>
date Fri, 02 Nov 2012 09:48:42 -0700
parents 5b2854ecc12d
children
line wrap: on
line source

'\" 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.