Home | History | Annotate | Download | only in ps
History log of /src/bin/ps/keyword.c
RevisionDateAuthorComments
 1.60  15-Sep-2021  christos Don't assign v to newvar, so we can still access the original length.
 1.59  14-Sep-2021  christos use emalloc and friends, add ktrace flag printing.
 1.58  14-Sep-2021  christos Provide symbolic printing of some keywords by capitalizing them.
 1.57  06-Aug-2019  kamil Restore maxrss, idrss, isrss, ixrss printing in ps(1)

The RSS related statistics are now back in the NetBSD kernel.

These values were disabled since day0 until today.

libkvm(3) users will still receive inappropriate values as RSS statistics
are updated upon sysctl(3) call.

Patch submitted by <Krzysztof Lasocki>
 1.56  11-Apr-2018  christos branches: 1.56.2; 1.56.4;
use EXIT_FAILURE instead of 1
 1.55  09-Dec-2017  kamil branches: 1.55.2;
ps: Rename local routine name from uname to usrname

This removes symbol name routine clash with libc's uname(3).
This allows to build ps(1) against LLVM Sanitizers.

Sponsored by <The NetBSD Foundation>
 1.54  15-Jan-2014  mlelstv Add an LTIME column that prints lwp cputime.
 1.53  21-Oct-2009  rmind branches: 1.53.6; 1.53.12;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.52  10-Feb-2008  christos Add a CPUID keyword; idea and some of the code from Anon Ymous
 1.51  01-Sep-2007  yamt add a keyword "lname", to print l_name.
 1.50  29-Oct-2006  christos branches: 1.50.8;
Add support for printing the emulation of the process.
 1.49  16-Oct-2006  christos c99 initializers
 1.48  02-Oct-2006  apb Set the width in the correct data structure. (Fix error in previous.)
 1.47  02-Oct-2006  apb * When all columns are given null customised headers, the blank header
line is not printed at all. This is specified in P1003.1-2004
(SUSv3), and is useful.

* Customised headers may contain embedded space, commas and equals
signs. To specify multiple customised headers, use multiple -o or -O
options. This is specified (for "-o", not for "-O") in P1003.1-2004
(SUSv3), and is useful.

* When a column is given a null (blank) customised header, it keeps its
default minimum width. This is specified in P1003.1-2004 (SUSv3), and
seems harmless.

* Fix a bug that made it impossible to print the same keyword multiple
times, with different customised headers each time. (Previously, the
last customised header was used for all instances of the keyword.)

* Make the behaviour of "-O" more useful. The first -O option adds
the default keywords only if there have not yet been any formatting
options, and multiple -O options now insert their keywords in adjacent
positions. Now {ps -j -O %cpu} is like {ps -j} with one extra column;
Previously, it would have had all the columns implied by "-j", plus
all the default columns, plus the extra column specified by "-O".

* Convert from home-grown linked lists to SIMPLEQ lists.

Discussed in tech-userlevel.
 1.46  18-Mar-2006  christos Coverity CID 1559: Fix memory leak.
 1.45  05-Nov-2005  chs add a keyword for the uarea address. very useful with crashdumps.
 1.44  26-Jun-2005  christos sprinkle a little const, and now everything compiles with WARNS=3
 1.43  16-Nov-2004  christos branches: 1.43.2;
print TTY instead of TT, one question mark instead of two and always the
full tty name.
 1.42  23-Aug-2004  nathanw Add a "laddr" keyword, analagous to "paddr". Useful for finding
struct pcb's.
 1.41  28-Jul-2004  simonb For the "lid" keyword, change ULONG to INT32 since it's a 32bit type.
From Nicolas Joly in PR bin/26452.
 1.40  27-Mar-2004  simonb branches: 1.40.2;
Add support for the POSIX.2 "args" and "comm" keywords. "args" is just
an alias for "command", and "comm" shows just argv[0] and not the whole
argument list.

Fix for part of PR standards/11224.
 1.39  27-Mar-2004  simonb Add support for the POSIX.2 "etime" keyword - shows the elapsed time
since the process was started. Fix a couple of style nits as well.

Fix for part of PR standards/11224.
 1.38  27-Mar-2004  simonb Wrap some long lines.
Consisently use (void) in front of printf(...);
A few more white-space nits.
 1.37  27-Mar-2004  simonb Change the header for the "tty" keyword "TT" instead of "TTY".

Fixed POSIX.2 conformance problem mentioned in standards/11225 from
Ben Harris.
 1.36  16-Dec-2003  mjl Correct typo in page header for tpgid.
 1.35  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22249, verified by myself.
 1.34  08-Mar-2003  dsl Support -ktt and -ktty, quote "tdev" in comment so table can be sorted.
 1.33  08-Mar-2003  christos XXX: cast tdev to INT32 instead of UINT32 so that that sorting works as
before [NODEV entries come first]
 1.32  06-Mar-2003  dsl - add keywords for utime, stime and ctime (output sss.ssssss if small)
- fiddle with keyword table - mainly to keep width under 80 cols
- add -k keylist so sort output
- don't use logs to work out field width, get -MAXINT right
- user defined headers can be 1 char (actually they can be zero length)
so ?? in tty column isn't guaranteed to be wider than header
- remove some long long casts (compiles on sparc64 still)
- use kvm_openfiles(NULL, NULL, NULL, KVN_NO_FILES, ..) unless core file
specified,
(approved by christos)
 1.31  03-Mar-2003  dsl Seems better to display p_sv{u,g}id when asked for it...
 1.30  01-Mar-2003  atatat Add p_svuid and p_svgid to kinfo_proc2. Populate them in the kernel
and in libkvm. Then teach ps how to show them to you.

Also, teach ps how to show the names for all the uids, the rest of the
group numbers, and the "group access list".
 1.29  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.28  17-Oct-2002  itojun correct use of format string (signedness, %ldd). PR 18679
 1.27  24-Apr-2002  nathanw branches: 1.27.2;
Since kinfo_proc2 has many values that are 64-bit, ps needs to know
that they're 64-bit, and grab them out of memory appropriately. Otherwise,
big-endian systems get the wrong end of the 64-bit value and lose.

Keywords affected: inblk, majflt, minflt, msgrcv, msgsnd, nivcsw, nsigs,
nswap, nvcsw, and oublk.
 1.26  08-Jan-2001  itojun branches: 1.26.2;
address PR 11653. checked on alpha.
XXX supports 32bit and 64bit pointers only
 1.25  07-Jun-2000  simonb branches: 1.25.2;
Calculate field widths on the fly so that all columns line up nicely
and make more effective use of screen real estate when some columns
(eg USER and VSZ) didn't need the full default width.
 1.24  02-Jun-2000  simonb G/C evar() - now that everything is in the one structure it was exactly
the same as pvar().
 1.23  26-May-2000  simonb branches: 1.23.2;
Use new sysctl/kvm interfaces. This will stop the "proc size mismatch"
errors when internal kernel structures change size. Also remove
the sgid bit - all live kernel data is accessed through the sysctl
interface.
 1.22  11-May-2000  mjl Fix problem in option processing, would segfault when parsing "-O,".
Closes PR/10096 by Yuji Yamano using the patch provided.
 1.21  03-Dec-1999  simonb Since we have an "extern.h", put all external variable declarations in
that file and not sprinkled around various .c files.
 1.20  09-Nov-1999  drochner Since our gcc doesn't warn about NULL format strings anymore, we can
fix the incorrect err(1, "%s", "") et al.
Closes PR bin/7592 by cgd.
 1.19  03-May-1999  mrg branches: 1.19.4;
limit session to 6 chars. from Geoff Wing <gcw@pobox.com> and fixes his PR#7506
 1.18  16-Apr-1999  christos Add support for printing wide sigset_t properly.
 1.17  17-Feb-1998  thorpej Add a "sid" keyword to print the session ID.
 1.16  06-Feb-1998  mrg remove old OLD BSD VM code.
 1.15  20-Jul-1997  christos Fix compiler warnings
Add WARNS=1
 1.14  02-Oct-1996  ws Fix p_nice vs. NZERO code.
Remove some unnecessary casts.
Remove an unused time format field.
 1.13  30-May-1996  cgd in findvar(), return after warning about unknown keyword so we don't
deref. a null pointer.
 1.12  29-Sep-1995  cgd branches: 1.12.6;
correct the sizes specified for various variables.
 1.11  15-Aug-1995  cgd Kenneth Stailey pointed out that his previous fix was incorrect. RE and SL
should be bounded at 127, not 99.
 1.10  14-Aug-1995  cgd as suggested in PR 1347, by Kenneth Stailey, make "RE" and "SL" fields
show up as two digits, max, displaying "99" if > 99. allow any field with
an unsigned value to be specified as printing that way (though right now
it's only used for RE and SL, which are both unsigned longs). This fix
is substantially different than that suggested in the PR.
 1.9  08-May-1995  cgd add a 'holdcnt' keyword and document it.
 1.8  21-Mar-1995  cgd convert to new RCS id conventions.
 1.7  09-May-1994  cgd clean up import
 1.6  05-May-1994  cgd struct element foo
 1.5  05-May-1994  cgd update for changed flags
 1.4  01-Aug-1993  mycroft Add RCS identifiers.
 1.3  23-Mar-1993  cgd changed "Id" to "Header" for rcsids
 1.2  22-Mar-1993  cgd added rcs ids to all files
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  09-May-1994  cgd new ps, to match libkvm
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.12.6.1  30-May-1996  cgd pull up from trunk:
in findvar(), return after warning about unknown keyword so we don't
deref. a null pointer.
 1.19.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.23.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.1  18-Oct-2002  itojun bin/ps 1.28 via patch

Correct printf format string.
 1.26.2.4  12-Nov-2002  nathanw Catch up to -current.
 1.26.2.3  24-Apr-2002  nathanw Parallel change to mainline: handle 64-bit values properly.
 1.26.2.2  24-Apr-2002  nathanw Note the presense of multiple LWPs or scheduler activations under "state".
Add a "lstate" that prints LWP-specific state and display it instead
of "state" under ps -s.
 1.26.2.1  23-Apr-2002  nathanw Add support for handling multi-LWP processes by selecting one LWP as
"representative" of the process.
Also add a -s option that prints a line for each LWP.
While I'm here, remove the /proc fallback code.
 1.27.2.1  21-Oct-2002  lukem Pull up revision 1.28 (requested by itojun in ticket #922):
correct use of format string (signedness, %ldd). PR 18679
 1.40.2.1  28-Jul-2004  tron Pull up revision 1.41 (requested by simonb in ticket #723):
For the "lid" keyword, change ULONG to INT32 since it's a 32bit type.
From Nicolas Joly in PR bin/26452.
 1.43.2.1  06-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #936):
bin/ps/keyword.c: revision 1.45
add a keyword for the uarea address. very useful with crashdumps.
 1.50.8.2  23-Mar-2008  matt sync with HEAD
 1.50.8.1  06-Nov-2007  matt sync with HEAD
 1.53.12.1  19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.53.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.2.1  16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.56.4.1  07-Aug-2019  martin Pull up following revision(s) (requested by kamil in ticket #24):

bin/ps/ps.1: revision 1.110
bin/ps/keyword.c: revision 1.57

Restore maxrss, idrss, isrss, ixrss printing in ps(1)

The RSS related statistics are now back in the NetBSD kernel.
These values were disabled since day0 until today.
libkvm(3) users will still receive inappropriate values as RSS statistics=
are updated upon sysctl(3) call.

Patch submitted by <Krzysztof Lasocki>
 1.56.2.3  21-Apr-2020  martin Ooops, restore accidently removed files from merge mishap
 1.56.2.2  21-Apr-2020  martin Sync with HEAD
 1.56.2.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed