xref: /src/bin/ps/
History log of /src/bin/ps/
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
1.31 14-Sep-2021 christos

Provide symbolic printing of some keywords by capitalizing them.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
1.30 06-Apr-2021 simonb

We only need -Wno-format-y2k for print.c .


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.29 14-Aug-2011 christos

branches: 1.29.44;
Document non-literal formats


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
1.28 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
1.27 26-May-2000 simonb

branches: 1.27.6;
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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
1.26 12-Sep-1999 chs

the PMAP_NEW option is gone as the new interface is no longer optional.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.25 26-Mar-1999 bgrayson

Added experimental fallback /proc-based lookup. Warnings are printed when the
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.


1.24 24-Mar-1999 mrg

completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.


1.23 25-Aug-1998 tv

Add CWARNFLAGS+=-Wno-format-y2k.


1.22 25-Aug-1998 ross

Kill the CFLAGS+=-Wno-format-y2k which will go, for now, into bsd.sys.mk
It wasn't working anyway, although that could have been fixed by moving it
down below the .include <bsd.prog.mk> line.

It's not completely clear that this usage of %y is in fact y2k-safe, it
seems safer for now to have a single XXX option in bsd.sys.mk, and we need
to rev this anyway for -Wno-uninitialized


1.21 21-Aug-1998 tv

This needs strftime()'s %y; use -Wno-format-y2k.


1.20 18-Feb-1998 perry

add -DPMAP_NEW if PMAP_NEW is on in mk.conf


1.19 09-Feb-1998 mrg

add -DUVM to CPPFLAGS if defined(UVM)


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.18 20-Jul-1997 christos

Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.


1.17 20-Jul-1997 christos

Fix compiler warnings
Add WARNS=1


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
1.16 26-Oct-1995 jtc

LIBMATH -> LIBM (PR# 1688)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.15 21-May-1995 mycroft

Split out some helper functions again.


1.14 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.13 21-Mar-1995 cgd

convert to new RCS id conventions.


1.12 03-Aug-1994 deraadt

do not need -I/sys


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.11 03-Jul-1994 deraadt

devname is in libc now


1.10 17-May-1994 pk

Restore "${DESTDIR}" in CFLAGS.


1.9 12-May-1994 mycroft

Need devname.c.


1.8 09-May-1994 cgd

clean up import


1.7 28-Jan-1994 cgd

needs -lkvm, not -lutil


1.6 14-Aug-1993 mycroft

Fix library dependencies.


1.5 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
1.4 17-Jun-1993 mycroft

Don't need -I/sys. (Why was it here?)


Revision tags: netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 perseant-exfatfs-base-20240630 perseant-exfatfs-base cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE agc-symver-base tls-maxphys-base yamt-pagecache-base8 yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base bouyer-quota2-nbase bouyer-quota2-base matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base mjf-devfs2-base yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base cube-autoconf-base hpcarm-cleanup-base nathanw_sa_before_merge nathanw_sa_base
1.7 03-Jul-1994 mycroft

Clean up deleted files.


1.6 09-May-1994 cgd

clean up import


1.5 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
1.4 21-Apr-1993 proven

Changed hash_open to dbopen.


Revision tags: netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.39 09-Dec-2017 kamil

branches: 1.39.4;
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>


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.38 02-Dec-2016 christos

provide a tree like display with -d, from FreeBSD


1.37 28-Nov-2016 rin

Calculate CPU usage (pcpu) once per process if it is required. This change
significantly improves performance for slow machines when output is sorted
by pcpu.

ok martin


1.36 28-Nov-2016 rin

for donlist{,_sysctl}:
- obtain log_ccpu = log(ccpu) rather than ccpu itself
- use common default values and warn users appropriately when errors occur
ok martin


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
1.35 20-Apr-2014 dholland

branches: 1.35.6;
Use an enum type for PRINTMODE vs. WIDTHMODE. Compiler output diffs have
been checked.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
1.34 15-Jan-2014 mlelstv

branches: 1.34.2;
Add an LTIME column that prints lwp cputime.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
1.33 31-May-2010 rmind

branches: 1.33.6; 1.33.12;
Fix ps(1) and top(1) to show reasonable CPU numbers i.e. cpu_index() provided
by the kernel, instead of CPU order number, which is generally random.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
1.32 10-Feb-2008 christos

Add a CPUID keyword; idea and some of the code from Anon Ymous


Revision tags: cube-autoconf-base matt-armv6-base
1.31 01-Sep-2007 yamt

add a keyword "lname", to print l_name.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base netbsd-4-base
1.30 29-Oct-2006 christos

branches: 1.30.8;
Add support for printing the emulation of the process.


1.29 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.


Revision tags: abandoned-netbsd-4-base
1.28 26-Jun-2005 christos

sprinkle a little const, and now everything compiles with WARNS=3


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.27 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.26 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


1.25 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.24 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.23 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.22 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
1.21 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.20 14-Jul-2001 matt

branches: 1.20.2;
Retrieve maxslp & uspace from kernel instead of using defines. Needed for
shared arm code.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
1.19 07-Jun-2000 simonb

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.18 02-Jun-2000 simonb

G/C evar() - now that everything is in the one structure it was exactly
the same as pvar().


Revision tags: minoura-xpg4dl-base
1.17 26-May-2000 simonb

branches: 1.17.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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.16 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.15 03-Dec-1999 simonb

"ps -e" only shows the environment for the processes owned by the
current user id or all process if run by root.

Fixes PR security/5967 from Todd Vierling.


Revision tags: comdex-fall-1999-base
1.14 15-Oct-1999 jdolecek

When using the procfs for extracting process information, extract
also process start time, process arguments and session leadership status.

The procfs fallback is also used when kvm_openfiles() completely fails
(e.g. when /dev/mem is not readable).

Solves PR 7772, though the final implementation is different.


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.13 26-Mar-1999 bgrayson

branches: 1.13.2; 1.13.4;
Added experimental fallback /proc-based lookup. Warnings are printed when the
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.


1.12 06-Feb-1998 mrg

remove old OLD BSD VM code.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.11 02-Oct-1996 ws

Fix p_nice vs. NZERO code.
Remove some unnecessary casts.
Remove an unused time format field.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.10 21-May-1995 mycroft

Split out some helper functions again.


1.9 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.8 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.7 03-Jul-1994 deraadt

devname is in libc now


1.6 16-Jun-1994 pk

Declare devname().


1.5 09-May-1994 cgd

clean up import


1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-base hpcarm-cleanup-base
1.21 12-Dec-2007 lukem

branches: 1.21.70;
use __RCSID()


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.20 27-Mar-2004 simonb

branches: 1.20.22;
Wrap some long lines.
Consisently use (void) in front of printf(...);
A few more white-space nits.


1.19 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_end nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.18 14-Feb-2002 enami

branches: 1.18.2;
Just use return value of strvis instead of calling strlen.


1.17 14-Feb-2002 enami

Don't define variable as static unnecessarily.


1.16 23-Mar-2001 enami

Always initialize an auto variable.


1.15 20-Mar-2001 itojun

do not update maxlen if realloc fails.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.14 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.13 03-Feb-1998 perry

branches: 1.13.6;
add <sys/time.h> to fix compiler error


1.12 09-Jan-1998 perry

RCS Id Police.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.11 20-Jul-1997 christos

Fix compiler warnings
Add WARNS=1


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.10 25-May-1995 mycroft

Simplify this just a little.


1.9 21-May-1995 mycroft

Split out some helper functions again.


1.8 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.7 18-May-1995 mycroft

Do the right thing for an empty environment.


1.6 18-May-1995 mycroft

Avoid an extra (gratuitous) pass through strvis(3).


1.5 21-Mar-1995 cgd

convert to new RCS id conventions.


1.4 08-Jan-1995 mycroft

Better fix for the previous.


1.3 08-Jan-1995 mycroft

Fix oversight in previous change, when argument list is sort of empty.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.2 18-May-1994 cgd

kill extra space, save my sanity


1.1 09-May-1994 cgd

branches: 1.1.1;
Initial revision


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
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.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
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>


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
1.56 11-Apr-2018 christos

branches: 1.56.2; 1.56.4;
use EXIT_FAILURE instead of 1


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
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>


Revision tags: netbsd-8-3-RELEASE netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-7-2-RELEASE netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
1.54 15-Jan-2014 mlelstv

Add an LTIME column that prints lwp cputime.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-premerge-20091211
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>.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
1.52 10-Feb-2008 christos

Add a CPUID keyword; idea and some of the code from Anon Ymous


Revision tags: cube-autoconf-base matt-armv6-base
1.51 01-Sep-2007 yamt

add a keyword "lname", to print l_name.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-mips64-base wrstuden-fixsa-base netbsd-4-base
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.


Revision tags: abandoned-netbsd-4-base
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


Revision tags: netbsd-3-base
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.


Revision tags: netbsd-2-0-base
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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
1.28 17-Oct-2002 itojun

correct use of format string (signedness, %ldd). PR 18679


Revision tags: netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
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


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
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().


Revision tags: minoura-xpg4dl-base
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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
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.


Revision tags: comdex-fall-1999-base
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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
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.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
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.


Revision tags: netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
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.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
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.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
1.28 26-Aug-2020 simonb

Don't rely on the USPACE kernel define as a fallback if the vm.uspace
sysctl fails. We've got bigger problems if the sysctl fail anyway.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.27 28-Nov-2016 rin

branches: 1.27.14;
for donlist{,_sysctl}:
- obtain log_ccpu = log(ccpu) rather than ccpu itself
- use common default values and warn users appropriately when errors occur
ok martin


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
1.26 28-Apr-2008 martin

branches: 1.26.12; 1.26.46;
Remove clause 3 and 4 from TNF licenses


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
1.25 16-Oct-2006 christos

branches: 1.25.16;
c99 initializers


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
1.24 22-Aug-2004 dsl

Use HW_PHYSMEM64 to avoid problem with > 2GB memory (and >4GB as well)
Fixes PR/23717 and PR/24092


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.23 27-Mar-2004 simonb

#define<TAB>


1.22 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


1.21 25-Feb-2004 jrf

donlist_sysctl() was overwriting maxslp with vm.uspace. Changed
it to use uspace. See PR bin/23713, approved by christos@netbsd.org.
Thanks to joff@stchome.com for the submission.


1.20 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.19 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.18 14-Jul-2001 matt

branches: 1.18.2;
Retrieve maxslp & uspace from kernel instead of using defines. Needed for
shared arm code.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
1.17 08-Jun-2000 simonb

Fix handling of "ps U<user>" where <user> ended it 't' - now if the
first argument doesn't start with a '-' and ends in 't', the 't' only
gets converted to a 'T' (for listing processes on the current tty)
if it doesn't contain any other command line option characters that
take an argument. Problem noticed by ITOH Yasufumi on tech-userlevel.

If the 'start' format was the last column, the width wouldn't be set
and started() output a zero length string instead of a string the right
length - fix header width calculations so the the last column is handled
the same all others. This only showed up for 'start' because started()
knew that the column header is the same width and the field itself...

Update copyrights.


Revision tags: minoura-xpg4dl-base
1.16 26-May-2000 simonb

branches: 1.16.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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.15 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.14 27-Mar-1998 is

branches: 1.14.6;
Use the physmem variable to get at the physical memory size (instead of the
avail_end - avail_start difference which is only correct on machines with
contiguous memory).


1.13 06-Feb-1998 mrg

remove old OLD BSD VM code.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.12 20-Jul-1997 christos

Fix compiler warnings
Add WARNS=1


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.11 21-Mar-1995 cgd

convert to new RCS id conventions.


1.10 04-Dec-1994 cgd

from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.


1.9 25-Nov-1994 mycroft

Format police.


1.8 25-Nov-1994 deraadt

print %MEM correctly


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.7 09-May-1994 cgd

clean up import


1.6 05-May-1994 cgd

update for changed flags


1.5 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
1.4 23-Mar-1993 cgd

changed "Id" to "Header" for rcsids


1.3 22-Mar-1993 cgd

added rcs ids to all files


Revision tags: patchkit-0-2-2
1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
1.138 26-Jan-2022 andvar

remove double t from targeted, add missing r to arbitrary
And fix few more typos along the way in comments and man pages.


1.137 14-Sep-2021 christos

use emalloc and friends, add ktrace flag printing.


1.136 14-Sep-2021 christos

Provide symbolic printing of some keywords by capitalizing them.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
1.135 17-Apr-2021 maya

Remove SCCS workaround. No binary change.


1.134 06-Apr-2021 christos

- dedup code
- add a safe_strftime() to handle error cases


1.133 06-Apr-2021 simonb

Fix the column width calculation for the lstart column if an empty
column header is specified.

Fixes bug pointed out by Ted Spradley in
https://mail-index.netbsd.org/netbsd-users/2021/04/05/msg026808.html .


Revision tags: netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
1.132 19-Jun-2019 kamil

branches: 1.132.2;
Add a fallback definition of LSDEAD in ps(1)

The symbol is no longer available in headers.

Requested by <mrg>


1.131 18-Jun-2019 kamil

Make LSDEAD usage conditional

LSDEAD is not used since NetBSD-5.0 and will be gone.

The same conditional usage is already in ps.c in the same program.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930
1.130 19-Sep-2018 maxv

Don't display l_wchan, either there is something in l_wmesg and we display
it, or there's nothing and we print "-".


Revision tags: pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
1.129 11-Apr-2018 christos

branches: 1.129.2;
use EXIT_FAILURE instead of 1


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.128 09-Dec-2017 kamil

branches: 1.128.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>


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.127 12-Dec-2016 christos

branches: 1.127.6;
Handle functions that use the offset from either kinfo_proc2/kinfo_lwp properly.


1.126 02-Dec-2016 christos

provide a tree like display with -d, from FreeBSD


1.125 28-Nov-2016 rin

Calculate CPU usage (pcpu) once per process if it is required. This change
significantly improves performance for slow machines when output is sorted
by pcpu.

ok martin


1.124 28-Nov-2016 rin

for donlist{,_sysctl}:
- obtain log_ccpu = log(ccpu) rather than ccpu itself
- use common default values and warn users appropriately when errors occur
ok martin


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
1.123 15-Nov-2014 joerg

branches: 1.123.2;
Use l_wmesg if the string is not empty. Don't bother checking l_name for
nullness.


Revision tags: netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
1.122 20-Apr-2014 dholland

branches: 1.122.2;
Use an enum type for PRINTMODE vs. WIDTHMODE. Compiler output diffs have
been checked.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
1.121 15-Jan-2014 mlelstv

branches: 1.121.2;
Add an LTIME column that prints lwp cputime.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4
1.120 20-Mar-2012 matt

branches: 1.120.2;
Use C89 function definitions


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 netbsd-6-base
1.119 13-Feb-2012 wiz

Remove unused variable.
From cppcheck via Henning Petersen in PR 46002.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.118 13-Jun-2011 dholland

branches: 1.118.2;
When converting from pages to kilobytes, cast the return value of
getpagesize() to size_t. For some reason getpagesize() is defined to
return int, and several of the page counts we get come back from the
kernel as int32_t; in LP64 without the cast the byte count will be
computed in a 32-bit value and for large processes will overflow and
become negative... and then remain negative when divided by 1024 to
convert to kilobytes.

Fixes a problem I hit the other day where I saw negative RSS, which
turns out also to be PR 40642.

Note: other logic in here will break down when we first get >2TB
processes... and int32 page counts will break on >8TB processes. But
hopefully we won't see any of that for a few years yet.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
1.117 22-Jan-2011 christos

branches: 1.117.2;
fix previous.


1.116 22-Jan-2011 christos

Make printing of lwp flags similar to the process one, identifying (O)nproc
(K)ernel threads and scheduler (a)ctivations.


Revision tags: matt-mips64-premerge-20101231
1.115 28-Jul-2010 njoly

branches: 1.115.2;
Do not check pcpu value against 100.0 but rather 99.95, to properly
deal with value rounding. From apb@.


1.114 27-Jul-2010 njoly

Make %cpu drop the decimal part when reaching 100%, to stay in the 5
expected columns.


1.113 31-May-2010 rmind

Fix ps(1) and top(1) to show reasonable CPU numbers i.e. cpu_index() provided
by the kernel, instead of CPU order number, which is generally random.


Revision tags: matt-premerge-20091211
1.112 21-Oct-2009 rmind

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>.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
1.111 29-Mar-2009 mrg

- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)


1.110 14-Feb-2009 lukem

fix -Wsign-compare issues


1.109 03-Feb-2009 drochner

branches: 1.109.2;
make sure the table stays aligned even if no groups are to be displayed
with the "groupnames" option


1.108 03-Feb-2009 drochner

make sure the table stays aligned even if no groups are to be displayed
with the "groups" option


1.107 28-Dec-2008 christos

fix dev_t 64 bit issues.


Revision tags: netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
1.106 19-Oct-2008 christos

branches: 1.106.2;
Use 'O' for LSONPROC like solaris instead of bundling LSIDL, LSRUN, LSONPROC
to 'R'


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 wrstuden-revivesa-base
1.105 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
1.104 10-Feb-2008 christos

branches: 1.104.4;
Add a CPUID keyword; idea and some of the code from Anon Ymous


Revision tags: matt-armv6-base
1.103 31-Dec-2007 ad

Remove systrace. Ok core@.


Revision tags: cube-autoconf-base
1.102 06-Nov-2007 ad

Kill another use of PZERO.


1.101 01-Sep-2007 yamt

add a keyword "lname", to print l_name.


Revision tags: matt-mips64-base
1.100 28-Jul-2007 dsl

branches: 1.100.4; 1.100.6;
Don't call P_ZOMBIE(struct kinfo_proc2), it's p_stat field contains
lwp states, not process states!
Since the times are filled with zeros for zombie processes the check
before assuming teh process time is zero is moot - delete it.
Fix the other chact to test the p_realstat.
Fixer PR kern/36295


1.99 17-Feb-2007 pavel

Revert the changes done after newlock2 merge, except for the removal of
the now unused LSDEAD state. The current kernel headers are now
source-compatible with pre-newlock2 kernel headers again.

Approved by Andrew Doran.


1.98 10-Feb-2007 ad

Further changes to use compat process flags mapped by sysctl. To be
revisited soon.


1.97 09-Feb-2007 ad

Sync with kernel changes introduced by merging the newlock2 branch.


Revision tags: netbsd-4-base
1.96 29-Oct-2006 christos

branches: 1.96.2; 1.96.4;
Add support for printing the emulation of the process.


1.95 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.


Revision tags: abandoned-netbsd-4-base
1.94 27-Jun-2005 christos

Add some more const so that this compiles again.


1.93 26-Jun-2005 christos

sprinkle a little const, and now everything compiles with WARNS=3


1.92 07-Jun-2005 he

Appease -Wuninitialized by initializing val and uval to 0.
Marked with XXXGCC for hpcarm (found while building for it).

Reviewed (in a slightly different form) by lukem.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
1.91 16-Nov-2004 christos

print TTY instead of TT, one question mark instead of two and always the
full tty name.


1.90 23-Apr-2004 simonb

s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.89 27-Mar-2004 simonb

Gah, fix uninitialised variable with the "etime" change. _Never_ be
happy with something and then edit a single line before committing
without retesting...


1.88 27-Mar-2004 simonb

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.87 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.86 27-Mar-2004 simonb

#define<TAB>


1.85 27-Mar-2004 simonb

Use some constants from <tzfile.h>.


1.84 27-Mar-2004 simonb

Wrap some long lines.
Consisently use (void) in front of printf(...);
A few more white-space nits.


1.83 27-Mar-2004 simonb

Fix grammar in a comment.


1.82 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


1.81 24-Feb-2004 wiz

Spell interrupt with two rs. From Peter Postma.


1.80 11-Jan-2004 jdolecek

g/c SDEAD


1.79 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.78 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.77 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.76 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge nathanw_sa_base
1.75 06-Jan-2003 wiz

interrupt with two rs.


Revision tags: fvdl_fs64_base
1.74 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


1.73 17-Jun-2002 christos

Document some missing flags and add systrace(1) 'x' flag.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.72 24-Apr-2002 nathanw

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.71 21-Feb-2002 martin

branches: 1.71.2;
Use int32_t for temporary variables (instead of long), that is the same
type as we get the data passed from the kernel. This avoids (missing)
sign extension bugs on LP64 systems and partly takes care of PR 15677.

We now print this values as negative seconds - still wrong, but that
probably is due to the simple way this values are acumulated in the
scheduler, causing negative times when ntpd steps time backwards.


1.70 21-Jan-2002 jdolecek

started(): don't assume that the field width is correct and recompute
it as needed

This fixes bogus output for cases like `ps -ao start=xx`, as reported by
Martin Macok of Undeground.cz on current-users@netbsd.org.


1.69 24-Aug-2001 lukem

fix comment: "[]" are [square] brackets, "<>" are angle brackets


1.68 24-Aug-2001 enami

Print commands within angled brackets only if they are system processes.
Print other commands, like cc, cpp and as, within parentheres.


1.67 07-Aug-2001 christos

Print system processes/kernel threads as [kprocname] as top(1) does.


1.66 14-Jul-2001 matt

Retrieve maxslp & uspace from kernel instead of using defines. Needed for
shared arm code.


1.65 15-Jan-2001 christos

clarify things a bit more (from hubertf)


1.64 15-Jan-2001 christos

Really explain what parenthesized names mean and why we parenthesize names!


1.63 15-Jan-2001 hubertf

Document the meaning of commands shown in parantheses.

Patches submitted by Jeremy C. Reed <reed@reedmedia.net> in PR 11930.


1.62 09-Jan-2001 itojun

KPTR/KPTR24 are using u_int64_t. commented by minoura


1.61 08-Jan-2001 itojun

redo previous (simplify KPTR)


1.60 08-Jan-2001 itojun

backout previous; did not compile on non-alpha


1.59 08-Jan-2001 itojun

simplify KPTR processing.


1.58 08-Jan-2001 itojun

address PR 11653. checked on alpha.
XXX supports 32bit and 64bit pointers only


1.57 23-Oct-2000 simonb

Add a K flag to the state information - K is for kernel thread or system
process (ie, P_SYSTEM set in p_flag). The L flag (locked in core) is
only used for non-P_SYSTEM processes.


1.56 29-Jun-2000 mrg

remove include of <vm/vm.h>


Revision tags: netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
1.55 08-Jun-2000 simonb

branches: 1.55.2;
Fix handling of "ps U<user>" where <user> ended it 't' - now if the
first argument doesn't start with a '-' and ends in 't', the 't' only
gets converted to a 'T' (for listing processes on the current tty)
if it doesn't contain any other command line option characters that
take an argument. Problem noticed by ITOH Yasufumi on tech-userlevel.

If the 'start' format was the last column, the width wouldn't be set
and started() output a zero length string instead of a string the right
length - fix header width calculations so the the last column is handled
the same all others. This only showed up for 'start' because started()
knew that the column header is the same width and the field itself...

Update copyrights.


1.54 08-Jun-2000 simonb

Fix back-to-front assignment in tname() which meant that the column
width would never autosize past the header ("TT") width. Problem
noticed by Geoff Wing.


1.53 07-Jun-2000 simonb

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.52 02-Jun-2000 simonb

G/C evar() - now that everything is in the one structure it was exactly
the same as pvar().


Revision tags: minoura-xpg4dl-base
1.51 26-May-2000 simonb

branches: 1.51.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.50 26-May-2000 thorpej

Handle SONPROC state.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.49 05-Dec-1999 fredb

Fix CL* purge fallout.


1.48 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.47 03-Dec-1999 simonb

"ps -e" only shows the environment for the processes owned by the
current user id or all process if run by root.

Fixes PR security/5967 from Todd Vierling.


Revision tags: comdex-fall-1999-base
1.46 15-Oct-1999 jdolecek

command(): don't start using procfs_getargv() instead of kvm_getargv()
just because the latter returned a NULL - that may normally happen,
when the process is, for example, a kernel thread

procfs_getargv(): if the name is brackened in '(' and ')', just
return NULL immediately - the code in command() will DTRT
and the output will be same for procfs- and kvm- based lookup
in all cases


1.45 15-Oct-1999 jdolecek

When using the procfs for extracting process information, extract
also process start time, process arguments and session leadership status.

The procfs fallback is also used when kvm_openfiles() completely fails
(e.g. when /dev/mem is not readable).

Solves PR 7772, though the final implementation is different.


1.44 11-Oct-1999 mrg

skip "dty" just like we skip "tty", otherwise we just get "dt" in ps output for all dty's


1.43 23-Jul-1999 veego

branches: 1.43.2;
According to the previous commit the new process state should be SDEAD and
not SDYING, so s/SDYING/SDEAD/.


1.42 22-Jul-1999 thorpej

Update for SDEAD.


1.41 03-May-1999 mrg

limit session to 6 chars. from Geoff Wing <gcw@pobox.com> and fixes his PR#7506


1.40 16-Apr-1999 christos

Add support for printing wide sigset_t properly.


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.39 28-Jul-1998 mycroft

branches: 1.39.2;
Look for the formats used by setproctitle(3) and login shells, and avoiding
outputting the redundant `(comm)'.


1.38 27-Jul-1998 mycroft

__AUDIT__ cleanup.


1.37 01-Apr-1998 kleink

Need <time.h> for localtime(), time() and strftime() prototypes.


1.36 06-Feb-1998 mrg

remove old OLD BSD VM code.


1.35 05-Feb-1998 gwr

Begone KERNBASE! (Just print kernel pointers as-is.)


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.34 03-Aug-1997 mikel

use %c not %C for lstart; from tetsuya@secom-sis.co.jp via OpenBSD


1.33 20-Jul-1997 christos

Fix compiler warnings
Add WARNS=1


1.32 19-Mar-1997 mycroft

DTRT if e_wmesg is not NUL-terminated.


1.31 19-Mar-1997 mycroft

DTRT if e_login is not NUL-terminated.


1.30 02-Oct-1996 ws

Fix p_nice vs. NZERO code.
Remove some unnecessary casts.
Remove an unused time format field.


1.29 15-Aug-1996 explorer

return 0.0 cpu usage for zombies. closes pr bin/2693. Perhaps this should
be fixed in exit, so p->p_pctcpu is cleared when the process exits.


1.28 13-Jul-1996 explorer

include <pwd.h> for one function (user_from_uid) and correct one
%*d -> %*ld in a format string. (yes, trying to find the problem with
ps wwwwwwwww1 and core dump, and might as well clean up while here)


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.27 29-Sep-1995 cgd

add code to convert from INT32 and UINT32 to native types.


1.26 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.25 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.24 07-Jun-1995 cgd

typeof(timeval.ts_sec) != time_t


1.23 25-May-1995 mycroft

If there is another field after the command, fill in the command field with
blanks.


1.22 21-May-1995 mycroft

Split out some helper functions again.


1.21 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.20 18-May-1995 mycroft

Avoid an extra (gratuitous) pass through strvis(3).


1.19 08-May-1995 cgd

add the ability to understand and print INT and UINT-sized variables.


1.18 21-Mar-1995 cgd

convert to new RCS id conventions.


1.17 23-Dec-1994 cgd

be careful with addresses.


1.16 04-Dec-1994 cgd

from James Jegers <jimj@miller.cs.uwm.edu>: quiet -Wall, and squelch
some of the worst style errors.


1.15 03-Nov-1994 deraadt

kill UPAGES


1.14 15-Sep-1994 deraadt

NBPG -> getpagesize()


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.13 16-Jun-1994 pk

No more P_NOSWAP/P_PHYSIO.


1.12 09-May-1994 cgd

clean up import


1.11 05-May-1994 cgd

struct element foo


1.10 05-May-1994 cgd

update for changed flags


1.9 14-Aug-1993 mycroft

Fix test for zombie process.


1.8 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
1.7 18-Jun-1993 cgd

use strvis on the arguments and environment, so we don't end up in
sed and/or xterm-title-changing hell.


1.6 02-Jun-1993 cgd

make ps do something more sensible with zombie processes


1.5 01-Jun-1993 cgd

fix more-or-less-uninitialized variable...


1.4 01-Jun-1993 cgd

add support and documentation for the 'e' option, to print out
the process environment.


Revision tags: netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 perseant-exfatfs-base-20240630 perseant-exfatfs-base cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 phil-wifi-20200406 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base perseant-stdc-iso10646-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE yamt-pagecache-base9 yamt-pagecache-tag8 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE agc-symver-base tls-maxphys-base yamt-pagecache-base8 yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 yamt-pagecache-base6 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base bouyer-quota2-nbase bouyer-quota2-base matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base mjf-devfs2-base yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-pf42-base keiichi-mipv6-base cube-autoconf-base hpcarm-cleanup-base nathanw_sa_before_merge nathanw_sa_base
1.10 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
1.9 26-May-2000 simonb

branches: 1.9.6;
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.8 07-Apr-2000 jdolecek

Ignore also "self" link when searching for proc info.
Patch sent by NAKAJIMA Yoshihiro in bin/9819


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
1.7 15-Oct-1999 jdolecek

command(): don't start using procfs_getargv() instead of kvm_getargv()
just because the latter returned a NULL - that may normally happen,
when the process is, for example, a kernel thread

procfs_getargv(): if the name is brackened in '(' and ')', just
return NULL immediately - the code in command() will DTRT
and the output will be same for procfs- and kvm- based lookup
in all cases


1.6 15-Oct-1999 jdolecek

When using the procfs for extracting process information, extract
also process start time, process arguments and session leadership status.

The procfs fallback is also used when kvm_openfiles() completely fails
(e.g. when /dev/mem is not readable).

Solves PR 7772, though the final implementation is different.


1.5 09-May-1999 thorpej

branches: 1.5.2;
KNF.


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.4 28-Mar-1999 bgrayson

branches: 1.4.2;
- Be really paranoid. Any time we open a file that is in /proc, run
fstatfs() on the open file to verify that no intruder has mounted
something on portions of /proc. This will catch, for instance,
"mount_null /tmp /proc/1378". We already do 5 syscalls per
process, so one more won't hurt :) ... and safety is better than
performance when ps is otherwise broken.
- Also added a few close()'s at early returns, to avoid chewing up fd's.


1.3 27-Mar-1999 bgrayson

Minor fixes:
1. Use statfs() to verify that /proc is a procfs.
2. Add -K option to disable /proc-based method.
3. Make warnings less verbose, but still accurate.


1.2 27-Mar-1999 tron

Add missing prototype so that this actually compiles.


1.1 26-Mar-1999 bgrayson

Added experimental fallback /proc-based lookup. Warnings are printed when the
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
1.115 06-Nov-2021 msaitoh

s/maxiumum/maximum/


1.114 14-Sep-2021 christos

reflect reality on flags.


1.113 14-Sep-2021 christos

Provide symbolic printing of some keywords by capitalizing them.


Revision tags: cjep_sun2x-base1
1.112 04-Jun-2021 wiz

Sort options in synopsis.


1.111 04-Jun-2021 cjep

PR standards/11223

Add -G to take a single group argument heading towards POSIX.2 compliance.
Patch from jperkin and reviewed by simonb.


Revision tags: cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
1.110 06-Aug-2019 kamil

branches: 1.110.6;
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>


Revision tags: netbsd-9-base phil-wifi-20190609 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.109 28-Aug-2017 wiz

branches: 1.109.4; 1.109.6;
Bump date for previous. Remove/replace bogus Tn uses.


1.108 28-Aug-2017 kamil

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed
PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).

Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>


Revision tags: perseant-stdc-iso10646-base
1.107 03-Jul-2017 wiz

Remove workaround for ancient HTML generation code.


Revision tags: matt-nb8-mediatek-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.106 02-Dec-2016 christos

branches: 1.106.6;
provide a tree like display with -d, from FreeBSD


Revision tags: pgoyette-localcount-20161104 localcount-20160914
1.105 10-Aug-2016 sevan

Earliest reference in the TUHS archive is v3
Unfortunately only the source code for the compiler is present for that
release. The v2 archive is missing the manuals & only contains a some of the
commands.
Switch to v3 and reference manual category eight, as per r1.32 of
src/bin/ps/ps.1 from OpenBSD.
Heads up from Ingo Schwarze.


1.104 10-Aug-2016 sevan

Document the version ps first appeared.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 tls-maxphys-base
1.103 15-Jan-2014 wiz

branches: 1.103.8;
Bump date for previous.


1.102 15-Jan-2014 mlelstv

Add an LTIME column that prints lwp cputime.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
1.101 03-Jun-2012 joerg

branches: 1.101.2;
Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.


Revision tags: yamt-pagecache-base5 yamt-pagecache-base4
1.100 15-Apr-2012 wiz

Increase width of table column so it formats more nicely.


1.99 15-Apr-2012 wiz

- choose better argument name for `-U';
- add argument names for options in man page;
- improve wording, punctuation, capitalization.

From Bug Hunting in email.


1.98 15-Mar-2012 wiz

Remove trailing whitespace.


1.97 15-Mar-2012 christos

Fix obsolete example (that referred to letters in process state that are
not set anymore), and clarify their meaning.


1.96 23-Feb-2012 dholland

The 'lstart' column uses strftime %c, not %C. Noted by mrg.


Revision tags: netbsd-6-base
1.95 27-Jan-2012 dholland

branches: 1.95.2;
Minor English improvements for -w, partly from Snader_LB.


Revision tags: yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
1.94 13-Feb-2011 dholland

branches: 1.94.4;
fix typo, from Randolf Richardson in PR 44559


Revision tags: matt-mips64-premerge-20101231
1.93 14-May-2010 joerg

branches: 1.93.2;
Don't break lines in .It, there be dragons in groff.


1.92 22-Mar-2010 joerg

Use .In instead of .Aq Pa for header files


Revision tags: matt-premerge-20091211
1.91 21-Oct-2009 wiz

Bump date for uarea swap-out removal.


1.90 21-Oct-2009 rmind

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.89 03-Aug-2009 wiz

Bump date for previous.


1.88 03-Aug-2009 dsl

Remove reference to P_SYSTRACE.
Fixes PR/41426
(leave defn in sys/sysctl.h since the bit shouldn't be reused!)


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
1.87 13-Mar-2009 joerg

Fix number of columns in .Bl. Escape %C.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
1.86 19-Oct-2008 wiz

branches: 1.86.4;
Improve wording.


1.85 19-Oct-2008 christos

Use 'O' for LSONPROC like solaris instead of bundling LSIDL, LSRUN, LSONPROC
to 'R'


1.84 26-Sep-2008 wiz

Sort options.
Remove systrace reference.


1.83 26-Sep-2008 apb

Add "ps -A" option. This displays information about all processes,
like BSD "ps -ax" or SYSV "ps -ef". It's specified in SUSv3.

Also make some minor clarifications to the man page.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
1.82 10-Feb-2008 christos

Add a CPUID keyword; idea and some of the code from Anon Ymous


Revision tags: matt-armv6-base
1.81 31-Dec-2007 ad

Remove systrace. Ok core@.


Revision tags: cube-autoconf-base
1.80 09-Sep-2007 apb

Document "emul" keyword. Fixes PR 36935.
Also sort list of keywords, and bump date.


1.79 01-Sep-2007 yamt

add a keyword "lname", to print l_name.


Revision tags: matt-mips64-base
1.78 25-Jun-2007 yamt

branches: 1.78.4;
remove descriptions of some states. ('A', 'S', '>')
- they are wrong. (madvise is not vadvise)
- they don't exist anymore.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
1.77 09-Oct-2006 wiz

Remove trailing whitespace.
Remove a partially duplicated sentence.


1.76 07-Oct-2006 apb

Make it clear that multiple sort keys may be specified.
Closes PR 34271.


1.75 03-Oct-2006 wiz

Avoid .No if easily possible.


1.74 02-Oct-2006 apb

Add some markup missed in previous.


1.73 02-Oct-2006 apb

Document changes to -o and -O options, and improve markup.


Revision tags: abandoned-netbsd-4-base
1.72 11-Nov-2005 chs

add "uaddr" and improve text for "laddr".


Revision tags: netbsd-3-base
1.71 29-Dec-2004 skrll

branches: 1.71.2;
Add the missing suspended state 'U'.

Bump date.


1.70 23-Aug-2004 wiz

Bump date for laddr.


1.69 23-Aug-2004 nathanw

Add a "laddr" keyword, analagous to "paddr". Useful for finding
struct pcb's.


1.68 23-Apr-2004 simonb

s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.67 27-Mar-2004 simonb

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.66 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.65 13-Feb-2004 wiz

Uppercase CPU where appropriate.


1.64 16-Oct-2003 wiz

Add Xr for dev_mkdb(8), per PR 23168. Increase width in FILES section while here.


1.63 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.62 16-Apr-2003 wiz

More mdoc.


1.61 17-Mar-2003 wiz

Update date for recent changes.


1.60 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.59 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.58 25-Feb-2003 wiz

.Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.


1.57 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
1.56 01-Oct-2002 wiz

Use more mdoc.


1.55 25-Sep-2002 wiz

New policy: New sentences start on a new line.
Patches by Robert Elz <kre at munnari oz au>, with minimal changes by me.


1.54 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


1.53 17-Jun-2002 wiz

Sort SEE ALSO.


1.52 17-Jun-2002 christos

Document some missing flags and add systrace(1) 'x' flag.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.51 24-Apr-2002 wiz

"a, b, c, and d", not "a, b, c and d".


1.50 04-Mar-2002 wiz

branches: 1.50.2;
Drop trailing space.


1.49 04-Mar-2002 ad

Xref pkill/pgrep.


1.48 08-Feb-2002 ross

Generate <>& symbolically. I'm avoiding .../dist/... directories for now.


1.47 20-Dec-2001 wiz

Properly quote punctuation.


1.46 20-Dec-2001 wiz

Whitespace nits.


1.45 20-Aug-2001 wiz

precede, not preceed.


1.44 07-Aug-2001 christos

Print system processes/kernel threads as [kprocname] as top(1) does.


1.43 04-Jul-2001 sommerfeld

correct the description of paddr


1.42 15-Jan-2001 christos

clarify things a bit more (from hubertf)


1.41 15-Jan-2001 christos

Really explain what parenthesized names mean and why we parenthesize names!


1.40 15-Jan-2001 hubertf

Document the meaning of commands shown in parantheses.

Patches submitted by Jeremy C. Reed <reed@reedmedia.net> in PR 11930.


1.39 23-Oct-2000 simonb

Add a K flag to the state information - K is for kernel thread or system
process (ie, P_SYSTEM set in p_flag). The L flag (locked in core) is
only used for non-P_SYSTEM processes.


1.38 28-Aug-2000 nathanw

Update description of process flag 0x20000 to match reality:
P_NOCLDWAIT, not P_SSTEP.


1.37 24-Jun-2000 simonb

Remove the 'poip' (pageouts in progress) keyword from the manpage.
From PR bin/8843 by Brian Stark.


Revision tags: netbsd-1-5-base minoura-xpg4dl-base
1.36 15-Apr-2000 simonb

branches: 1.36.4;
Use tty "?" to select processes with no controlling tty and tty "-" to
select processes with a revoked controlling tty.

Idea from SunOS/Solaris, suggested by Alexis Rosen.


1.35 10-Apr-2000 chs

make -M imply -K. the current system is not likely to be
a reasonable approximation of a crash dump.


1.34 22-Feb-2000 dbj

name database is kvm.db not kvm_netbsd.db


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.33 04-Dec-1999 hubertf

Document -U switch (displays processes belonging to given user/uid).
Reported in PR 8943 by WL <wliao@dura.spc.uchicago.edu>


1.32 03-Dec-1999 simonb

"ps -e" only shows the environment for the processes owned by the
current user id or all process if run by root.

Fixes PR security/5967 from Todd Vierling.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 comdex-fall-1999-base netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.31 27-Mar-1999 bgrayson

branches: 1.31.6;
Minor fixes:
1. Use statfs() to verify that /proc is a procfs.
2. Add -K option to disable /proc-based method.
3. Make warnings less verbose, but still accurate.


1.30 26-Mar-1999 bgrayson

Added experimental fallback /proc-based lookup. Warnings are printed when the
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.


1.29 22-Mar-1999 garbled

More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages. Many more to
come.


1.28 17-Mar-1999 msaitoh

ps's information is sorted by controlling terminal and (among processes with
the same controlling terminal) by PID.


1.27 07-Mar-1999 mycroft

Clean up SYNOPSIS formatting.


1.26 07-Mar-1999 mycroft

Fix formatting errors.


1.25 02-Jan-1999 tron

The system namelist database is called "/var/db/kvm.db" not
"/var/db/kvm_netbsd.db". Fixes PR bin/6712 by Brian Grayson.


1.24 28-Apr-1998 fair

change references to vadvise to madvise; remove reference to lisp(1)


1.23 24-Mar-1998 bouyer

Sync with reality: the uprocp keyword doesn't exist.


1.22 06-Feb-1998 mrg

remove old OLD BSD VM code.


Revision tags: netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.21 11-Oct-1997 enami

branches: 1.21.2;
Use .Nm "" instead of .Nm ps in SYNOPSIS.


1.20 10-Oct-1997 lukem

all but the first .Nm in SYNOPSIS need to be spelt out. [bin/4256]


1.19 14-Sep-1997 lukem

getopt returns -1 not EOF
cleanup manpage


1.18 27-Aug-1997 mikel

default swap device is /dev/drum, not nonexistent /dev/swap; from
<entropy@tardis.bernstein.com> in PR bin/4042


1.17 23-Jun-1997 pk

Refer to execve(2), add section to `vfork' ref. (almost per PR#3627).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
1.16 21-Mar-1996 jtc

fix damage caused by sccs (long ago)


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.15 08-May-1995 cgd

add a 'holdcnt' keyword and document it.


1.14 07-May-1995 pk

Sync process flags with sys/proc.h


1.13 21-Mar-1995 cgd

convert to new RCS id conventions.


1.12 16-Sep-1994 mycroft

Integrate `-c' option, from Arne Juul.


1.11 06-Aug-1994 jtc

vmunix -> netbsd (PR #375)


Revision tags: netbsd-1-0-base
1.10 09-May-1994 cgd

branches: 1.10.2;
clean up import


1.9 11-Jan-1994 jtc

Fix spelling errors.


1.8 07-Oct-1993 cgd

fix from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>:
don't try to display the resident text size; we can't do that anymore


1.7 01-Aug-1993 mycroft

Add RCS indentifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
1.6 13-Jun-1993 mycroft

Fix up FILES sections.


1.5 13-Jun-1993 mycroft

Update file names.


1.4 01-Jun-1993 cgd

add support and documentation for the 'e' option, to print out
the process environment.


Revision tags: netbsd-0-8 netbsd-alpha-1
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


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base
1.98 13-Jul-2025 rillig

ps: remove unreachable break statement after return statement

No binary change.


Revision tags: netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
1.97 14-Sep-2021 christos

branches: 1.97.4;
use emalloc and friends, add ktrace flag printing.


Revision tags: cjep_sun2x-base1
1.96 04-Jun-2021 christos

use parsenum like everywhere else in the code.


1.95 04-Jun-2021 wiz

Sort options in usage.


1.94 04-Jun-2021 cjep

PR standards/11223

Add -G to take a single group argument heading towards POSIX.2 compliance.
Patch from jperkin and reviewed by simonb.


Revision tags: cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 phil-wifi-20191119
1.93 15-Sep-2019 kamil

branches: 1.93.6;
ps(1): Guard freeing the memory of pinfo with __NO_LEAKS.

No more leaks are detected by LSan/NetBSD as of the LLVM snapshot
(clang10svn) from 2019-09-15.


1.92 11-Sep-2019 kamil

Plug memory leak in ps(1)

pinfo is allocated in setpinfo() with calloc(3).

Free it when no longer used, just before the program termination.

Detected with LSan.


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
1.91 11-Apr-2018 christos

branches: 1.91.2;
kvm_geterr() already contains errno, use errx.


1.90 11-Apr-2018 christos

use EXIT_FAILURE instead of 1


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
1.89 12-Jan-2018 kamil

branches: 1.89.2;
Fix an unitialized memory read bug in ps(1)

rawcpu of type int, is declared inside main(){} and it can be passed as
uninitialized to setpinfo().
The setpinfo() function has a switch checking the value of rawcpu:

if (!rawcpu)
pi[i].pcpu /= 1.0 - exp(ki[i].p_swtime * log_ccpu);

rawcpu is set to 1 with the command line argument "-C".

-C Change the way the CPU percentage is calculated by using a
"raw" CPU calculation that ignores "resident" time (this
normally has no effect).

Bug reproducible with an invocation: "ps u". It hides with "ps uC".

Initialize rawcpu by default to 0, before the getopt(3) machinery.

Detected with MSan running on NetBSD/amd64.

Sponsored by <The NetBSD Foundation>


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.88 26-Dec-2016 rin

branches: 1.88.6;
simplify logic; there must be no CPU usage when p_swtime is zero


1.87 02-Dec-2016 christos

provide a tree like display with -d, from FreeBSD


1.86 28-Nov-2016 rin

Calculate CPU usage (pcpu) once per process if it is required. This change
significantly improves performance for slow machines when output is sorted
by pcpu.

ok martin


1.85 28-Nov-2016 rin

KNF
ok martin


Revision tags: pgoyette-localcount-20161104 localcount-20160914
1.84 05-Sep-2016 sevan

Drop main() prototype.


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
1.83 16-Jun-2015 christos

branches: 1.83.2;
remove \n from error messages


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
1.82 28-Jun-2014 dholland

Don't print junk errnos. Avoids:
% ps -tfoo
ps: /dev/ttyfoo: Undefined error: 0
Exit 1


Revision tags: yamt-pagecache-base9
1.81 20-Apr-2014 dholland

Don't bother using variables whose value is never changed from the
initialization value.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
1.80 19-Feb-2014 dsl

branches: 1.80.2;
Remove some pointless inclusions os sys/user.h


1.79 15-Jan-2014 mlelstv

Make ps -s use LTIME instead of TIME in the default output format.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 yamt-pagecache-base5
1.78 07-May-2012 joerg

branches: 1.78.2;
Push logic to convert a ttyname to a device number into its own
function. Improve dealing with ptyfs by explicitly handling missing
pts/%d entries, if the kernel supports the pts device (PR 40813).


Revision tags: yamt-pagecache-base4
1.77 15-Apr-2012 wiz

Choose better argument name for `-U' (sync with man page).
From Bug Hunting in email.


Revision tags: netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
1.76 29-Aug-2011 joerg

branches: 1.76.2; 1.76.4;
Use __dead


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
1.75 31-May-2010 rmind

Fix ps(1) and top(1) to show reasonable CPU numbers i.e. cpu_index() provided
by the kernel, instead of CPU order number, which is generally random.


Revision tags: matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
1.74 29-Mar-2009 mrg

- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)


1.73 14-Feb-2009 lukem

fix -Wsign-compare issues


1.72 28-Dec-2008 christos

branches: 1.72.2;
fix dev_t 64 bit issues.


Revision tags: netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
1.71 26-Sep-2008 wiz

branches: 1.71.4;
Sync usage with man page.


1.70 26-Sep-2008 apb

Add "ps -A" option. This displays information about all processes,
like BSD "ps -ax" or SYSV "ps -ef". It's specified in SUSv3.

Also make some minor clarifications to the man page.


Revision tags: wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
1.69 20-Jul-2008 lukem

Remove the \n and tabs from the __COPYRIGHT() strings.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 wrstuden-revivesa-base
1.68 26-May-2008 christos

PR/38755: murray armfield: /bin posix programs missing setprogname and/or
setlocale


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2
1.67 28-Apr-2008 martin

branches: 1.67.2;
Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase
1.66 10-Mar-2008 dholland

branches: 1.66.2;
ps -t? needs to imply -x. Otherwise the non-x logic filters all the results
out. Thanks to der Mouse for prompting me to fix it...


Revision tags: hpcarm-cleanup-base
1.65 10-Feb-2008 christos

branches: 1.65.2;
Add a CPUID keyword; idea and some of the code from Anon Ymous


Revision tags: cube-autoconf-base matt-armv6-base
1.64 24-Oct-2007 yamt

make -s alter the default format rather than doing parsefmt.
it allows users to use -o to replace it later.


Revision tags: matt-mips64-base
1.63 17-Feb-2007 pavel

branches: 1.63.4;
Revert the changes done after newlock2 merge, except for the removal of
the now unused LSDEAD state. The current kernel headers are now
source-compatible with pre-newlock2 kernel headers again.

Approved by Andrew Doran.


1.62 09-Feb-2007 ad

Sync with kernel changes introduced by merging the newlock2 branch.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base netbsd-4-base
1.61 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.60 02-Sep-2006 christos

factor out the code that does numeric parsing into a function and check for
errors properly.


Revision tags: abandoned-netbsd-4-base
1.59 26-Jun-2005 christos

sprinkle a little const, and now everything compiles with WARNS=3


1.58 01-Jun-2005 lukem

appease gcc -Wuninitialized


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-3-base
1.57 11-Feb-2005 christos

allow -t ttyp0 -t p0 -t /dev/ttyp0 -t /dev/pts/0


1.56 29-Nov-2004 atatat

Make ps understand "-tpts/4" by assuming that ptyfs is mounted on
/dev/pts and that the '/' immediately preceding the digits does not
need a 'p' in front of it (ick, kludge_oldps_options()).


1.55 29-Oct-2004 dsl

Add (unsigned char) cast to ctype function


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.54 27-Mar-2004 simonb

#define<TAB>


1.53 27-Mar-2004 simonb

Wrap some long lines.
Consisently use (void) in front of printf(...);
A few more white-space nits.


1.52 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


1.51 11-Jan-2004 jdolecek

g/c SDEAD


1.50 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.49 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
- use PRId64 to remove some long long casts
- use kvm_openfiles(NULL, NULL, NULL, KVN_NO_FILES, ..) unless core file
specified
(approved by christos)


1.48 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
1.47 19-Jun-2002 jdolecek

g/c procfs fallback code, it's redundant now that we use sysctl to get
process info


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.46 20-Dec-2001 soren

branches: 1.46.2;
Sync getopt() / man page with actual getopt options.


1.45 03-Nov-2001 lukem

fix minor WARNS=2


1.44 30-Jul-2001 wiz

Remove duplicate `if'. Noted by Geoff C. Wing in bin/13551.


1.43 20-Jul-2001 matt

Add a small optimizetion in savevars(). break out of the loop once needcomm
is set since setting it multiple times only wastes cpu time.


1.42 14-Jun-2001 cyber

If there were no processes to list, it meant that our criteria failed
and didnt match anything. Dont make our caller think we succeeded.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
1.41 16-Jun-2000 simonb

Don't check namelist when choosing to use the sysctl interface.


1.40 08-Jun-2000 simonb

Fix handling of "ps U<user>" where <user> ended it 't' - now if the
first argument doesn't start with a '-' and ends in 't', the 't' only
gets converted to a 'T' (for listing processes on the current tty)
if it doesn't contain any other command line option characters that
take an argument. Problem noticed by ITOH Yasufumi on tech-userlevel.

If the 'start' format was the last column, the width wouldn't be set
and started() output a zero length string instead of a string the right
length - fix header width calculations so the the last column is handled
the same all others. This only showed up for 'start' because started()
knew that the column header is the same width and the field itself...

Update copyrights.


1.39 07-Jun-2000 simonb

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.


Revision tags: minoura-xpg4dl-base
1.38 26-May-2000 simonb

branches: 1.38.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.37 29-Apr-2000 abs

If ps cannot get the terminal size from STDOUT, it tried STDERR and STDIN.
What this does to the POLS when a script that is parsing ps output just happens
to run in a narrow terminal cannot be described in polite company.
If STDOUT is not a tty, leave width at 80.


1.36 15-Apr-2000 simonb

Use tty "?" to select processes with no controlling tty and tty "-" to
select processes with a revoked controlling tty.

Idea from SunOS/Solaris, suggested by Alexis Rosen.


1.35 10-Apr-2000 chs

make -M imply -K. the current system is not likely to be
a reasonable approximation of a crash dump.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
1.34 04-Dec-1999 hubertf

Document -U switch (displays processes belonging to given user/uid).
Reported in PR 8943 by WL <wliao@dura.spc.uchicago.edu>


1.33 03-Dec-1999 simonb

"ps -e" only shows the environment for the processes owned by the
current user id or all process if run by root.

Fixes PR security/5967 from Todd Vierling.


1.32 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.


Revision tags: comdex-fall-1999-base
1.31 15-Oct-1999 jdolecek

command(): don't start using procfs_getargv() instead of kvm_getargv()
just because the latter returned a NULL - that may normally happen,
when the process is, for example, a kernel thread

procfs_getargv(): if the name is brackened in '(' and ')', just
return NULL immediately - the code in command() will DTRT
and the output will be same for procfs- and kvm- based lookup
in all cases


1.30 15-Oct-1999 jdolecek

getkinfo_kvm(): fix bug in previous - handled size_t i as if it would be signed
saveuser(): don't check kd - if we get here, kd is never NULL


1.29 15-Oct-1999 jdolecek

When using the procfs for extracting process information, extract
also process start time, process arguments and session leadership status.

The procfs fallback is also used when kvm_openfiles() completely fails
(e.g. when /dev/mem is not readable).

Solves PR 7772, though the final implementation is different.


Revision tags: netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base
1.28 27-Mar-1999 bgrayson

branches: 1.28.2; 1.28.4;
Minor fixes:
1. Use statfs() to verify that /proc is a procfs.
2. Add -K option to disable /proc-based method.
3. Make warnings less verbose, but still accurate.


1.27 26-Mar-1999 bgrayson

Added experimental fallback /proc-based lookup. Warnings are printed when the
fallback method is used, as the results could be untrustworthy if an
intruder is present. It is highly likely that NetBSD-1.5 will have
an improved kvm interface for reading process information, at which
point this code can be garbage-collected. Also added a word to the
man page -x option description while I was here.


1.26 04-Jan-1999 kim

Fixed segfaulting for "ps -T". There is no optarg with -T, so instructions
under label "tty:" need to use ttname instead.


1.25 28-Jul-1998 mycroft

Add a -U option to select by user/uid.


1.24 28-Jul-1998 mycroft

Be more retentive about use of NOTREACHED and noreturn.


1.23 28-Jul-1998 mycroft

Delint.


1.22 27-Jul-1998 mycroft

__AUDIT__ cleanup.


1.21 06-Jul-1998 mrg

- change setgid kmem programs (that lend themselves to this) so setegid(getgid())
and the top, and then set the effective gid back to kmem around the call to
kvm_openfiles(). this reduces the time group kmem is available.
- for those above that also allow this, setgid(getgid()) after the call to
kvm_openfiles() to fully revoke priviledges.
- some KNF
- use err(3) over fprintf(3) in some places


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.20 14-Sep-1997 lukem

getopt returns -1 not EOF
cleanup manpage


1.19 20-Jul-1997 christos

Fix compiler warnings
Add WARNS=1


1.18 21-Apr-1997 mrg

note that strcpy is safe.


1.17 28-Feb-1997 pk

Message buffer passed to kvm_openfiles() should _POSIX2_LINE_MAX long; PR#3266


1.16 27-Sep-1996 thorpej

Fix SEGV when kludging old-style options.
From Greg Stark <gsstark@mit.edu>, PR #2550.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.15 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.14 18-May-1995 mycroft

Gather the argument and environment lists when we actually want to print them.


1.13 21-Mar-1995 cgd

convert to new RCS id conventions.


1.12 16-Sep-1994 mycroft

Integrate `-c' option, from Arne Juul.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.11 09-May-1994 cgd

clean up import


1.10 05-May-1994 cgd

update for changed flags


1.9 07-Oct-1993 cgd

fix from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>:
don't try to display the resident text size; we can't do that anymore


1.8 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
1.7 19-Jul-1993 cgd

branches: 1.7.2;
from Brian Somers <brian@awfulhak.demon.co.uk>:
The kvm entry isn't updated for command unless 'time' is given,
therefore
ps -o command
outputs blank lines [or, in NetBSD, seg faults]
ps -o time,command
works.


1.6 11-Jul-1993 cgd

fix alien 'w' handling. you really don't want to know...


1.5 01-Jun-1993 cgd

add support and documentation for the 'e' option, to print out
the process environment.


Revision tags: netbsd-0-8 netbsd-alpha-1
1.4 23-Mar-1993 cgd

changed "Id" to "Header" for rcsids


1.3 22-Mar-1993 cgd

added rcs ids to all files


Revision tags: patchkit-0-2-2
1.2 21-Mar-1993 cgd

after 0.2.2 "stable" patches applied


1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: perseant-exfatfs-base-20250801 netbsd-11-base netbsd-10-1-RELEASE perseant-exfatfs-base-20240630 perseant-exfatfs-base netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
1.32 14-Sep-2021 christos

use emalloc and friends, add ktrace flag printing.


1.31 14-Sep-2021 christos

Provide symbolic printing of some keywords by capitalizing them.


1.30 10-Sep-2021 rillig

bin: remove unnecessary lint comment CONSTCOND

Since 2021-01-31, lint no longer warns about 'do ... while (0)'.

No functional change.


Revision tags: netbsd-8-3-RELEASE netbsd-9-4-RELEASE netbsd-9-3-RELEASE cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320 bouyer-socketcan-base pgoyette-localcount-20170107
1.29 02-Dec-2016 christos

branches: 1.29.14;
provide a tree like display with -d, from FreeBSD


1.28 28-Nov-2016 rin

Calculate CPU usage (pcpu) once per process if it is required. This change
significantly improves performance for slow machines when output is sorted
by pcpu.

ok martin


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base tls-maxphys-base
1.27 20-Apr-2014 dholland

branches: 1.27.6;
Use an enum type for PRINTMODE vs. WIDTHMODE. Compiler output diffs have
been checked.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 netbsd-5-2-RELEASE netbsd-5-2-RC1 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231 matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE jym-xensuspend-nbase netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2 mjf-devfs2-base netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
1.26 02-Oct-2006 apb

branches: 1.26.40; 1.26.46; 1.26.60;
* 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.


Revision tags: abandoned-netbsd-4-base
1.25 26-Jun-2005 christos

sprinkle a little const, and now everything compiles with WARNS=3


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
1.24 27-Mar-2004 simonb

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.23 27-Mar-2004 simonb

#define<TAB>


1.22 27-Mar-2004 simonb

KNF, ANSFify, de-__P, unC++ify, white space nits.


1.21 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.20 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.19 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
1.18 24-Apr-2002 nathanw

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.


Revision tags: netbsd-1-5-PATCH003 netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base
1.17 07-Jun-2000 simonb

branches: 1.17.4;
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.


Revision tags: minoura-xpg4dl-base
1.16 26-May-2000 simonb

branches: 1.16.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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base
1.15 03-May-1999 mrg

oops, fix merge botch in previous..


1.14 03-May-1999 mrg

limit session to 6 chars. from Geoff Wing <gcw@pobox.com> and fixes his PR#7506


1.13 16-Apr-1999 christos

Add support for printing wide sigset_t properly.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 netbsd-1-4-PATCH001 netbsd-1-4-RELEASE netbsd-1-4-base netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base
1.12 02-Oct-1996 ws

Fix p_nice vs. NZERO code.
Remove some unnecessary casts.
Remove an unused time format field.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
1.11 29-Sep-1995 cgd

add INT32 and UINT32 variable type specifiers. some of the variables
that are printed are of fixed size.


1.10 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.9 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.8 18-May-1995 mycroft

Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.


1.7 08-May-1995 cgd

add the ability to understand and print INT and UINT-sized variables.


1.6 21-Mar-1995 cgd

convert to new RCS id conventions.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
1.5 09-May-1994 cgd

clean up import


1.4 01-Aug-1993 mycroft

Add RCS identifiers.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base netbsd-0-8 netbsd-alpha-1
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