Skip to content

Commit

Permalink
Add pargs, penv, pwdx commands and aliases to procstat(1).
Browse files Browse the repository at this point in the history
Intent is to mimic Solaris commands with the same names.

Submitted by:	Juraj Lutter <[email protected]>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26310
  • Loading branch information
kostikbel committed Sep 18, 2020
1 parent d99cb98 commit 085e049
Show file tree
Hide file tree
Showing 7 changed files with 360 additions and 97 deletions.
10 changes: 10 additions & 0 deletions usr.bin/procstat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@ SRCS= procstat.c \
procstat_cs.c \
procstat_files.c \
procstat_kstack.c \
procstat_penv.c \
procstat_ptlwpinfo.c \
procstat_pwdx.c \
procstat_rlimit.c \
procstat_rusage.c \
procstat_sigs.c \
procstat_threads.c \
procstat_vm.c

MLINKS+= procstat.1 pargs.1
MLINKS+= procstat.1 penv.1
MLINKS+= procstat.1 pwdx.1

LIBADD+= procstat xo util sbuf

LINKS+= ${BINDIR}/procstat ${BINDIR}/pargs
LINKS+= ${BINDIR}/procstat ${BINDIR}/penv
LINKS+= ${BINDIR}/procstat ${BINDIR}/pwdx

HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests

Expand Down
37 changes: 34 additions & 3 deletions usr.bin/procstat/procstat.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd March 4, 2019
.Dd September 14, 2020
.Dt PROCSTAT 1
.Os
.Sh NAME
Expand Down Expand Up @@ -102,6 +102,15 @@
.Op Fl N Ar system
.Op Fl w Ar interval
.Ar core ...
.Nm pargs
.Op Fl -libxo
.Ar pid ...
.Nm penv
.Op Fl -libxo
.Ar pid ...
.Nm pwdx
.Op Fl -libxo
.Ar pid ...
.Sh DESCRIPTION
.Nm
utility displays detailed information about the processes identified by the
Expand All @@ -112,6 +121,17 @@ flag is used, all processes.
It can also display information extracted from a process core file, if
the core file is specified as the argument.
.Pp
The
.Nm pargs ,
.Nm penv
and
.Nm pwdx
utilities display the arguments, environment, and current working directory,
respectively of the process specified by
.Ar pid
argument.
They mimic the behavior of Solaris utilities of the same names.
.Pp
If the
.Fl -libxo
flag is specified the output is generated via
Expand All @@ -121,7 +141,8 @@ See
.Xr xo_parse_args 3
for details on command line arguments.
.Pp
The following commands are available:
The following commands are available for
.Nm :
.Bl -tag -width indent
.It Ar basic
Print basic process statistics (this is the default).
Expand Down Expand Up @@ -196,6 +217,12 @@ Display thread information for the process.
Display virtual memory mappings for the process.
.It Ar auxv | Fl x
Display ELF auxiliary vector for the process.
.It Ar pargs
Display arguments for the process.
.It Ar penv
Display environment variables for the process.
.It Ar pwdx
Display current working directory for the process.
.El
.Pp
All options generate output in the format of a table, the first field of
Expand Down Expand Up @@ -430,7 +457,7 @@ process signal disposition details, three symbols
if signal is pending in the global process queue; - otherwise.
.It I
if signal delivery disposition is
.Dv SIG_IGN;
.Dv SIG_IGN ;
- otherwise.
.It C
if the signal will be caught; - otherwise.
Expand Down Expand Up @@ -711,6 +738,10 @@ support was added by
.An -nosplit
Allan Jude
.Aq Mt [email protected] .
.br
.An Juraj Lutter
.Aq Mt [email protected]
added the pargs, penv and pwdx functionality.
.Sh BUGS
The display of open file or memory mapping pathnames is implemented using the
kernel's name cache.
Expand Down
Loading

0 comments on commit 085e049

Please sign in to comment.