History log of /freebsd-current/bin/ps/print.c
Revision Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 3fe686f2 02-Oct-2021 Elyes HAOUAS <ehaouas@noos.fr>

src/bin/ps: Fix spelling error

Spell interruptible correctly.

Pull Request: https://github.com/freebsd/freebsd-src/pull/544
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>


# 2423585b 19-Jul-2021 Alex Richardson <arichardson@FreeBSD.org>

bin/ps: Avoid function name conflict with libc uname()

This prevents ps from being built with address sanitizer instrumentation.

Reviewed By: trasz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31048


# 4a022f0e 14-Jul-2020 Kirk McKusick <mckusick@FreeBSD.org>

Update to D25266, bin/ps: Make the rtprio option actually show
realtime priorities

The current `ps -axO rtprio' show threads running at interrupt
priority such as the [intr] thread as '1:48' and threads running
at kernel priority such as [pagedaemon] as normal:4294967260.

This change shows [intr] as intr:48 and [pagedaemon] as kernel:4.

Reviewed by: kib
MFC after: 1 week (together with -r362369)
Differential Revision: https://reviews.freebsd.org/D25660


# ac4b8a1c 27-Jun-2020 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

ps(1): don't try to handle non-SMP systems

As reported by kib, sysctl machdep.smp_active doesn't exist and on UP we
return CPU 0 for all threads anyway.

Reported by: kib


# 4f47f511 27-Jun-2020 Piotr Pawel Stefaniak <pstef@FreeBSD.org>

ps(1): reuse keyword "cpu" to show CPU number

This flag will now show the processor number on which a process is running.

This change was inspired by PR129965. Initially I didn't think that the
patch attached to it was correct -- it sacrificed ki_estcpu use in "cpu"
for ki_lastcpu and I thought that the old functionality should be kept and
the new (cpu#) one added to it. But I've since discovered that ki_estcpu is
sched_4bsd-specific. What's worse, it represents the same thing as
ki_pctcpu, except ki_pctcpu is universal -- so "%cpu" has been using it
successfully. Therefore, I've decided to replace information based on
ki_estcpu with information based on ki_oncpu/ki_lastcpu.

Key parts of the code and manual changes were borrowed from top(1).

PR: 129965
Reported by: Nikola Knežević
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25377


# 50301bb0 19-Jun-2020 Lorenzo Salvadore <salvadore@FreeBSD.org>

bin/ps: Make the rtprio option actually show realtime priorities

Fix the rtprio option that for some reason was progessively becoming an
option showing the priority class of threads. In particular:

- use the constants defined in sys/sys/rtprio.h instead of those defined in
sys/sys/priority.h: this helps making clearer that the code actually is
about realtime priorities and not standard scheduler priorities;
- remove the PRI_ITHD case that has nothing to do with realtime priorities;
- convert the priority levels to realtime priority levels using the same
formulas used for pri_to_rtp function in sys/kern/kern_resource.c.
- remove outdated note "101 = not a realtime process" in the man page and
replace it with a more useful reference to man 1 rtprio.

Approved by: src (mckusick), manpages (bcr), gerald (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25266


# aa8ab146 07-Jun-2020 Yuri Pankov <yuripv@FreeBSD.org>

ps: use %hs instead of %s format specifiers

Use %hs (locale-based encoding) instead of %s (UTF-8) format for
strings that are expected to be in current locale encoding (date/time,
process names/argument list).

PR: 241491
Reviewed by: phil
Differential Revision: https://reviews.freebsd.org/D22160


# c6a5ff71 12-Jun-2018 Eitan Adler <eadler@FreeBSD.org>

ps(1): fix some nits

- fracmem and mempages are double. ki_rssize should be too
- remove default case that is fully covered by all existing cases
- mark usage as dead


# 2f5a9b76 13-Mar-2018 John Baldwin <jhb@FreeBSD.org>

Add a "jail" keyword to list the name of a jail rather than its ID.

Inspired by: mwlucas
Reviewed by: jamie
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D14683


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 6f47d67b 06-Sep-2017 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make ps(1) flag processes in capsicum(4) capability mode with "C".

Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA, AFRL


# e4d52dfd 06-Sep-2017 Edward Tomasz Napierala <trasz@FreeBSD.org>

Reflect realtime and idle priorities in ps(1) state flags, same like
we do for the usual nice values. It could be argued that they should
use another set of indicators, since the underlying mechanism is
different, but they match the description in the manual page, and so
I think it's ok to not overcomplicate things.

PR: 81757
MFC after: 2 weeks
Sponsored by: DARPA, AFRL


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 3d32d4a7 07-Dec-2016 Eric van Gyzen <vangyzen@FreeBSD.org>

Export the whole thread name in kinfo_proc

kinfo_proc::ki_tdname is three characters shorter than
thread::td_name. Add a ki_moretdname field for these three
extra characters. Add the new field to kinfo_proc32, as well.
Update all in-tree consumers to read the new field and assemble
the full name, except for lldb's HostThreadFreeBSD.cpp, which
I will handle separately. Bump __FreeBSD_version.

Reviewed by: kib
MFC after: 1 week
Relnotes: yes
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D8722


# 45ed6753 01-Jun-2016 Conrad Meyer <cem@FreeBSD.org>

ps(1): Expand variables to match expanded fields

ki_flag and ki_tdflag have been 'long', not 'int', since 2000 and 2005,
respectively.

Submitted by: Shawn Wills <swills at isilon dot com>
Sponsored by: EMC / Isilon Storage Division


# 8beb1a2f 22-May-2015 Marcel Moolenaar <marcel@FreeBSD.org>

Convert to use libxo. Document use of libxo as well.

Obtained from: Phil Shafer <phil@juniper.net>
Sponsored by: Juniper Networks, Inc.


# c2290ff6 16-Mar-2015 Mark Felder <feld@FreeBSD.org>

Use 24h timestamps in the ps(1) STARTED column

The previous 12h AM/PM format was perplexing as it didn't follow the
locale of the user and was a minor annoyance to FreeBSD users coming
from Linux. Additionally, the man page was incorrect about the strftime
format.

There are three time formats that may be displayed in the STARTED
column depending on the age of the process. Below is an example.

For a process started at 14:30 on Monday 16 March 2015, the following
formats may be used:

14:30 for process < 24h old (24h Timestamp)
Mon14 for process > 24h, < 1 week old (Weekday Hour)
16Mar15 for process > 1 week old (Day Month Year)

Differential Revision: https://reviews.freebsd.org/D1620
Reviewed by: brd
Approved by: trasz


# c5985c1f 21-Oct-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Don't test arrays for being NULL.

MFC after: 1 month


# 2aff415a 15-Jul-2012 Jilles Tjoelker <jilles@FreeBSD.org>

ps: Fix memory leak when showing start/lstart for swapped-out process.

Spotted by: scan-build (uqs)


# 6aed20fe 17-Jan-2012 Ed Schouten <ed@FreeBSD.org>

Remove unused variables.

Simply annotate the function parameters with __unused, instead of adding
the ve-variables. This makes the code build with GCC 4.7 and -Werror.


# aa7a15b6 30-Oct-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

For processes with no controlling terminal, display "-" in the TTY column
instead of "?".

Submitted by: arundel


# 1d1143ec 29-Sep-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make ps(1) automatically size its column widths.


# 9f365aa1 28-Sep-2011 Ed Schouten <ed@FreeBSD.org>

Get rid of major/minor number distinction.

As of FreeBSD 6, devices can only be opened through devfs. These device
nodes don't have major and minor numbers anymore. The st_rdev field in
struct stat is simply based a copy of st_ino.

Simply display device numbers as hexadecimal, using "%#jx". This is
allowed by POSIX, since it explicitly states things like the following
(example taken from ls(1)):

"If the file is a character special or block special file, the
size of the file may be replaced with implementation-defined
information associated with the device in question."

This makes the output of these commands more compact. For example, ls(1)
now uses approximately four columns less. While there, simplify the
column length calculation from ls(1) by calling snprintf() with a NULL
buffer.

Don't be afraid; if needed one can still obtain individual major/minor
numbers using stat(1).


# 925af544 18-Jul-2011 Bjoern A. Zeeb <bz@FreeBSD.org>

Rename ki_ocomm to ki_tdname and OCOMMLEN to TDNAMLEN.
Provide backward compatibility defines under BURN_BRIDGES.

Suggested by: jhb
Reviewed by: emaste
Sponsored by: Sandvine Incorporated
Approved by: re (kib)


# 9acd9127 14-Jun-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add "gid" and "group" keywords to display the effective group ID
and effective group name. Also, add "egid", "egroup" and "euid" aliases.

PR: bin/146331
Submitted by: Jeremie Le Hen <jeremie at le-hen dot org>


# f9db2550 24-Mar-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add proper width calculation for time fields (time, cputime and usertime).
This fixes the ugly overflow in "ps aux" output for "[idle]".


# 3bf92dec 24-Mar-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Make "LOGIN" and "CLASS" columns width scale properly instead of wasting space.


# a870bf2c 17-Mar-2011 Konstantin Belousov <kib@FreeBSD.org>

Implement the usertime and systime keywords for ps, printing the
corresponding times reported by getrusage().

Submitted by: Dan Nelson <dnelson allantgroup com>
MFC after: 1 week


# 7123f4cd6 05-Mar-2011 Edward Tomasz Napierala <trasz@FreeBSD.org>

Export login class information via kinfo and make it possible to view
it using "ps -o class".


# 50a57dfb 08-Jan-2011 Konstantin Belousov <kib@FreeBSD.org>

Move repeated MAXSLP definition from machine/vmparam.h to sys/vmmeter.h.
Update the outdated comments describing MAXSLP and the process
selection algorithm for swap out.

Comments wording and reviewed by: alc


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 41ded75d 17-Mar-2010 Juli Mallett <jmallett@FreeBSD.org>

o) Add a keyword to displaying elapsed time in integer seconds, "etimes".
o) Give slightly better (i.e. any) documentation of the format of "etime".

Reviewed by: jilles


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 6dcfa92e 24-May-2009 Jilles Tjoelker <jilles@FreeBSD.org>

Fix elapsed (etime) field for swapped out processes in ps:
show '-' instead of time since the Epoch.

PR: bin/123069
Submitted by: Vladimir Kozbin
Approved by: ed (mentor)
MFC after: 3 weeks


# 044fce53 16-May-2009 Brian Somers <brian@FreeBSD.org>

Add a -d option to ps to display descendant info with the output.
This is similar to linux's -H (or -f) switch.

MFC after: 3 weeks


# 4610a811 26-Feb-2009 Attilio Rao <attilio@FreeBSD.org>

[1] When showing threads, the thread name just appears if the comm
label is choosen as last printout (ucomm suffers of this such bug
too). That bug is caused by the fact that the fixed size of
printout doesn't leave enough space for them to be printed out.
Implement ucomm and comm commands with a dynamic size lenght for
buffers.

[2] On AMD64 architecture pointers don't have enough chars space to
be shown (8 chars while they need 16). Fix them by providing
a variadic space so that it fits well on both 64 and 32 bits
architectures.

[3] Check a return value of malloc() that wasn't checked before.

PR: bin/128841, bin/128842
Reviewed by: jhb, emaste
Sponsored by: Sandvine Incorporated


# 160bda36 13-Nov-2008 Ed Maste <emaste@FreeBSD.org>

Fix whitespace.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 7ab24ea3 26-Oct-2007 Julian Elischer <julian@FreeBSD.org>

Introduce a way to make pure kernal threads.
kthread_add() takes the same parameters as the old kthread_create()
plus a pointer to a process structure, and adds a kernel thread
to that process.

kproc_kthread_add() takes the parameters for kthread_add,
plus a process name and a pointer to a pointer to a process instead of just
a pointer, and if the proc * is NULL, it creates the process to the
specifications required, before adding the thread to it.

All other old kthread_xxx() calls return, but act on (struct thread *)
instead of (struct proc *). One reason to change the name is so that
any old kernel modules that are lying around and expect kthread_create()
to make a process will not just accidentally link.

fix top to show kernel threads by their thread name in -SH mode
add a tdnam formatting option to ps to show thread names.

make all idle threads actual kthreads and put them into their own idled process.
make all interrupt threads kthreads and put them in an interd process
(mainly for aesthetic and accounting reasons)
rename proc 0 to be 'kernel' and it's swapper thread is now 'swapper'

man page fixes to follow.


# b61ce5b0 16-Sep-2007 Jeff Roberson <jeff@FreeBSD.org>

- Move all of the PS_ flags into either p_flag or td_flags.
- p_sflag was mostly protected by PROC_LOCK rather than the PROC_SLOCK or
previously the sched_lock. These bugs have existed for some time.
- Allow swapout to try each thread in a process individually and then
swapin the whole process if any of these fail. This allows us to move
most scheduler related swap flags into td_flags.
- Keep ki_sflag for backwards compat but change all in source tools to
use the new and more correct location of P_INMEM.

Reported by: pho
Reviewed by: attilio, kib
Approved by: re (kensmith)


# 7bd5296d 21-Feb-2006 Olivier Houchard <cognet@FreeBSD.org>

For pts, print the pts number, instead of the full name. As it was, we ended
up always printing "pts".

Submitted by: Michal Mertl <mime at traveller dot cz>


# 2c61418d 19-Jul-2004 Tim J. Robbins <tjr@FreeBSD.org>

Use warn() instead of perror().


# 70548f64 27-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Change the "rtprio" format so it prints an informative string for
the PRI_ITHD case (instead of just printing the digit '1').

Submitted by: Cyrille Lefevre


# bdf8ab46 23-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Change "struct varent" to use the standard queue(8) macros, instead of
using it's own version of the same basic algorithm.

Submitted by: part by Cyrille Lefevre, part of it done by me


# 4e8a8d9f 22-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Avoid padding the value of "ucomm" when it is the last column in the line.

Submitted by: Cyrille Lefevre


# 820434b2 23-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Make sure the value of "upr" (scheduling priority on return from system call)
is scaled in the same way that "pri" (scheduling priority) is scaled.

Submitted by: Cyrille Lefevre


# 16ac318d 21-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Have `ps' return the cputimes for zombies, with the assumption that
kvm_getprocs() will provide useful information if it can, or *it*
will provide a zero value if it can not find something appropriate.

Submitted by: bde


# 15b87b53 20-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

Add the `-O emul' format option, which prints the name of the system-call
emulation environment the process is in. "emul" as a keyword is picked
up from OpenBSD.

PR: bin/65803
Submitted by: Cyrille Lefevre


# ce1affa2 20-Jun-2004 Garance A Drosehn <gad@FreeBSD.org>

From SUSv3:
Any [standard output] field need not be meaningful in all
implementations. In such a case a hyphen ('-') should be
output in place of the field value

So have the `-O label' option print out the string " -" if the
process has no label.

Approved by: Silence from rwatson and green (when asked in March...)


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 3998d222 27-Mar-2004 Garance A Drosehn <gad@FreeBSD.org>

Fix `-o rtprio' so it prints the correct value.

PR: bin/59417
Submitted by: Jan Willem Knopper
This fix by: bde (in the audit-trail of the PR)


# de244df7 13-Aug-2003 Hartmut Brandt <harti@FreeBSD.org>

Implement the nwchan keyword that has been in the man page, but was
not implemented. This is just handy if you want to ddb the address
some process is waiting on.


# 2d5506c9 15-Apr-2003 Philippe Charnier <charnier@FreeBSD.org>

Revert the zombie part of previous commit


# b85add5f 14-Apr-2003 Philippe Charnier <charnier@FreeBSD.org>

Correct style bugs. Don't skip zombies in cputime(), according to Bruce,
zombie CPU times are valid. Adjust array size in strftime(3).

Submitted by: Bruce


# e2c9ac69 12-Apr-2003 Tim J. Robbins <tjr@FreeBSD.org>

Display residency and sleep times (re and sl fields) larger than 127 as 127.
This is what the manual page says ps should do, and what OpenBSD and NetBSD do.
Based on a patch from Ken Stailey.

PR: 27433, 46232


# eaed5652 05-Feb-2003 Philippe Charnier <charnier@FreeBSD.org>

Display elapsed time (-o etime) using [[dd-]hh:]mm:ss, which according to
Solaris man page is the POSIX way.

Reviewed by: jmallett


# 78b1878a 18-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Per-variable\ entry headers, to allow the 'ps -otime -otime=FOO' or similar
case to do the right thing and affect exactly one column. This is consistent
with GNU ps(1) in BSD mode, and POLA.


# 775bba9f 17-Jan-2003 Juli Mallett <jmallett@FreeBSD.org>

Refer to the process label as proclabel, as there is a function called label,
and that's what these locals were called before.


# 01e5f166 31-Oct-2002 Tim J. Robbins <tjr@FreeBSD.org>

Do not print a header line if it would be empty; required by 1003.1-2001.


# 2af538eb 23-Oct-2002 Robert Watson <rwatson@FreeBSD.org>

Use the MAC interface to list process MAC labels rather than using
the LOMAC-specific interface (which is being deprecated). The
revised LOMAC using the MAC framework will export levels listable
using this mechanism.

Approved by: re
Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


# 0d632649 02-Oct-2002 John Baldwin <jhb@FreeBSD.org>

Catch up to SMTX -> SLOCK changes.


# 362d62ba 17-Sep-2002 Juli Mallett <jmallett@FreeBSD.org>

Rename new PLONG type to PGTOK as the conversion is more important than the
size (which is mostly undefined anyway).

Submitted by: bde


# 760bbf7d 16-Sep-2002 Juli Mallett <jmallett@FreeBSD.org>

Conglomerate printing of ps_pgtok'd data into a PLONG type. I couldn't think
of a better name, except PINT, but I decided to go with assuming LONG to
be safe, rather than assuming INT.


# f3073b05 16-Sep-2002 Juli Mallett <jmallett@FreeBSD.org>

Perform keyword.c:1.27 properly, implement -orss in the New World Order of
ps(1) formatting, using pgtok() to get the value in K, rather than printing
it in pages. This is consistent with behaviour before keyword.c:1.26 (et al)
which exists in STABLE today, and which uses the same metric as VSZ.

Submitted by: bde


# 6327ab9c 13-Sep-2002 Peter Wemm <peter@FreeBSD.org>

Do not risk using the kernel pgtok() which assumes the page size is
constant.


# c1f903a0 11-Jul-2002 Bruce Evans <bde@FreeBSD.org>

Fixed a printf format error that was fatal on alphas. Adding WFORMAT=0
to the Makefile didn't affect this bug because WFORMAT only controls
higher- level format checking (not the -Wformat that is implicit in
-Wall).

Fixed a nearby printf format error that was benign and 3 nearby style bugs.


# ffe25988 07-Jul-2002 Juli Mallett <jmallett@FreeBSD.org>

Make printval() take a 'void *' thus negating any assumptions the compiler
may try to make about the alignment of the dereferenced datum.


# 2749b141 29-Jun-2002 David E. O'Brien <obrien@FreeBSD.org>

Consistently use FBSDID


# c3f1b5a9 06-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Cast to long to match format. Hidden by revision 1.18 of Makefile.


# ba2cd770 06-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Use a global `now' variable for the current time, and initialise it at
startup, right after calling setlocale(3).


# 76e1a9fe 06-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Implement a SUSv3-ignorant but "time"-similar format for "etime", elapsed
run time (NOT cpu time). cputime() and elapsed() both need to honour SUSv3
now.


# e8eef4bb 06-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Support the SUSv3 `rgroup' format.

Clean up some local style bogons.


# 03334017 06-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

SUSv3 conform on the "comm" and "args" formats, and make correct the "command"
format, since it's BSDlike, and "comm" is actually different.


# 4fa7d788 05-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Widen the scope of fmt.c::1.19 and consistently use errx(3) if malloc(3) [or
realloc(3)] happens to fail, everywhere in ps(1).

Discussed with: bde, charnier (a while ago)

fmt_argv() can no longer return NULL, so don't bother checking.

Submitted by: bde


# fdbec398 04-Jun-2002 Juli Mallett <jmallett@FreeBSD.org>

Use a const char * where it is meant to be used. There's no reason to try
to discard the const qualifier here.


# a3dbc1d8 22-Feb-2002 Mark Murray <markm@FreeBSD.org>

ANSIfy.


# d9a5f890 21-Feb-2002 Matthew Dillon <dillon@FreeBSD.org>

Revert wchan functionality. Add 'mwchan' to supply new duel mutex/msleep
functionality and make it the default.

With additional improvements by: Mark Peek <mp@FreeBSD.org>


# 576541a9 18-Feb-2002 Warner Losh <imp@FreeBSD.org>

Fixed divots that I created when I moved prototypes of group_from_gid
and user_from_uid to grp.h and pwd.h. Update the man pages.

Submitted by: David Malone
Pointy hat to: imp


# ebc1fff9 16-Feb-2002 Matthew Dillon <dillon@FreeBSD.org>

When blocked on a mutex, display the mutex name via the wchan string field
so we can at least tell the difference between being blocked in Giant
and being blocked in some other mutex.


# 871e8d8c 03-Feb-2002 Mark Murray <markm@FreeBSD.org>

WARNS=4 fixes (incomplete, so set NO_WERROR), and lots of extra
cleanup courtesy of automatic checking (lint).


# 46251dde 01-Feb-2002 Warner Losh <imp@FreeBSD.org>

o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.


# f1ff35ae 14-Jan-2002 Maxim Sobolev <sobomax@FreeBSD.org>

Add missed includes.

Reviewed by: md5


# 7304f61f 26-Nov-2001 Brian Feldman <green@FreeBSD.org>

Add LOMAC options (the "Z" flag in both cases) to display extra information
in ls(1) and ps(1).

Sponsored by: DARPA, NAI Labs


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# 85012e7c 10-Sep-2001 Peter Wemm <peter@FreeBSD.org>

UPAGES as a constant is gone in KSE. We are going to have to trust
and/or fix ki_rssize.


# 7d1192a7 24-Aug-2001 Peter Wemm <peter@FreeBSD.org>

On today's kernels masking with ~KERNBASE is turning out to be less
than useful. It still hits at least 8 digits. Adjust for reality.

This is still not satisfactory for the alpha if you add "-O paddr".


# 564efb8f 16-Jun-2001 Tor Egge <tegge@FreeBSD.org>

Check for the PS_SINTR flag in the right field of struct kinfo_proc
(ki_sflag).


# 25bba4f6 03-May-2001 Mark Murray <markm@FreeBSD.org>

Depollute headers now that the VM headers DTRT.


# 325a83b4 01-May-2001 Mark Murray <markm@FreeBSD.org>

Compensate for header dethreading.


# f59105ee 02-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Small optimization: set use_ampm only when needed


# 08017519 02-Mar-2001 Andrey A. Chernov <ache@FreeBSD.org>

Use AM/PM time only when available in locale


# 4c85452b 11-Feb-2001 Jake Burkholder <jake@FreeBSD.org>

Catch up to new priority interface.


# 8073a93c 10-Feb-2001 Andrey A. Chernov <ache@FreeBSD.org>

Use decimal point from locale


# e0aa5ab71 23-Jan-2001 John Baldwin <jhb@FreeBSD.org>

- Catch up to new proc flags.


# 1f7d2501 12-Dec-2000 Kirk McKusick <mckusick@FreeBSD.org>

Change the proc information returned from the kernel so that it
no longer contains kernel specific data structures, but rather
only scalar values and structures that are already part of the
kernel/user interface, specifically rusage and rtprio. It no
longer contains proc, session, pcred, ucred, procsig, vmspace,
pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If
any of these changed in size, ps, w, fstat, gcore, systat, and
top would all stop working. The new structure has over 200 bytes
of unassigned space for future values to be added, yet is nearly
100 bytes smaller per entry than the structure that it replaced.


# fd5f30bf 29-Nov-2000 John Baldwin <jhb@FreeBSD.org>

Introduce a 'mtxname' keyword that displays the current mutex that a
process is blocked on or '-'.


# 63743cbd 27-Sep-2000 Kris Kennaway <kris@FreeBSD.org>

No need to work around SCCS variable expansion any more.


# 0384fff8 06-Sep-2000 Jason Evans <jasone@FreeBSD.org>

Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The
alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
preempted (i386 only).

Partially contributed by: BSDi (BSD/OS)
Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 75c13541 28-Apr-1999 Poul-Henning Kamp <phk@FreeBSD.org>

This Implements the mumbled about "Jail" feature.

This is a seriously beefed up chroot kind of thing. The process
is jailed along the same lines as a chroot does it, but with
additional tough restrictions imposed on what the superuser can do.

For all I know, it is safe to hand over the root bit inside a
prison to the customer living in that prison, this is what
it was developed for in fact: "real virtual servers".

Each prison has an ip number associated with it, which all IP
communications will be coerced to use and each prison has its own
hostname.

Needless to say, you need more RAM this way, but the advantage is
that each customer can run their own particular version of apache
and not stomp on the toes of their neighbors.

It generally does what one would expect, but setting up a jail
still takes a little knowledge.

A few notes:

I have no scripts for setting up a jail, don't ask me for them.

The IP number should be an alias on one of the interfaces.

mount a /proc in each jail, it will make ps more useable.

/proc/<pid>/status tells the hostname of the prison for
jailed processes.

Quotas are only sensible if you have a mountpoint per prison.

There are no privisions for stopping resource-hogging.

Some "#ifdef INET" and similar may be missing (send patches!)

If somebody wants to take it from here and develop it into
more of a "virtual machine" they should be most welcome!

Tools, comments, patches & documentation most welcome.

Have fun...

Sponsored by: http://www.rndassociates.com/
Run for almost a year by: http://www.servetheweb.com/


# 4a40c5e7 05-Apr-1999 Peter Wemm <peter@FreeBSD.org>

Look at p_lock instead of P_NOSWAP etc as an indicator of unswappability.
(While here, put a #ifndef pgtok around the macro that gets a redefinition
warning)


# eb235b13 25-Nov-1998 Doug Rabson <dfr@FreeBSD.org>

Fix formatting of %CPU value on alpha.

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>


# 3929d518 14-Sep-1998 Doug Rabson <dfr@FreeBSD.org>

Portability fixes when sizeof(int) != sizeof(long).


# ce0cab88 28-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors (second round with non-i386 typedefs).


# 86e14119 28-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Oops, the previous log message should have read "Fixed type mismatches -
don't assume that time_t is long".


# f8ec5fe2 28-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors.


# 5832a752 30-May-1998 Bruce Evans <bde@FreeBSD.org>

Fixed imperfections in previous commit (a poor variable name,
excessive 64-bit arithmetic, and excessive changes).


# e796e00d 28-May-1998 Poul-Henning Kamp <phk@FreeBSD.org>

Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.

Clean up (or if antipodic: down) some of the msgbuf stuff.

Use an inline function rather than a macro for timecounter delta.

Maintain process "on-cpu" time as 64 bits of microseconds to avoid
needless second rollover overhead.

Avoid calling microuptime the second time in mi_switch() if we do
not pass through _idle in cpu_switch()

This should reduce our context-switch overhead a bit, in particular
on pre-P5 and SMP systems.

WARNING: Programs which muck about with struct proc in userland
will have to be fixed.

Reviewed, but found imperfect by: bde


# ad863cac 24-May-1998 Steve Price <steve@FreeBSD.org>

If no value is present for the login name set it to '-'.
Also pretty-up the display of 'ps -Ortprio'.

PR: 4947
Submitted by: Martin Kammerhofer <dada@sbox.tu-graz.ac.at>


# c9a8d1f4 15-May-1998 Philippe Charnier <charnier@FreeBSD.org>

Correct use of .Nm. Add rcsid.


# dc8ab2b6 01-Feb-1998 John Dyson <dyson@FreeBSD.org>

Display VSZ much more accurately now.


# e410bf23 03-Aug-1997 Peter Wemm <peter@FreeBSD.org>

Fix "lstart". (Displays "19" rather than time)

PR: 4206
Submitted by: Tetsuya Furukawa <tetsuya@secom-sis.co.jp>


# 940cca66 03-Aug-1997 Peter Wemm <peter@FreeBSD.org>

Kill #ifndef NEWVM etc. It affected a lot of other things besides
VM structure (eg: credentials etc) and it's highly unlikely we'll ever
get to see the "tainted" BSD<=4.3 VM code in public use. Although it
indicated the way some things used to be done, it obfuscates things too
much.


# 6a2d726b 28-Apr-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Dynamically adjust size of displayed username to the longest username which
appears, not the longest _maximum_ username (this should probably also go
into 2.2, for the day when we bump up the username length there too).

Submitted-By: Terry Lambert <terry@lambert.org>


# 3cc273e0 16-Apr-1997 John Polstra <jdp@FreeBSD.org>

When "-c" is specified, don't pad the command with spaces if it is
the last field on the line. "ps -axlc" was needlessly wrapping
around on 80-character windows.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 78b09ffe 13-Dec-1996 Steve Price <steve@FreeBSD.org>

-Wall cleaning.


# db91faac 21-Oct-1996 Peter Wemm <peter@FreeBSD.org>

Implement a -c option to ps to display the short command name instead of
the full argument vector.

I've bumped into a few things that expected this switch to be present,
the most recent was the snmp package in ports. I'm not 100% sure of the
origins of this, but Linux has it, so does the "BSD-compatable" version
of ps on our SVR4 systems (so I assume SunOS has it too).


# 0164b6d6 29-Jun-1996 Peter Wemm <peter@FreeBSD.org>

Make %CPU add up closer to 100%.. At least, it now agrees with top.. :-)

Pointed out by: bde


# 0cd02d20 29-Jun-1996 Peter Wemm <peter@FreeBSD.org>

Fix (I think) the %MEM count in 'ps -u'. It was bogusly taking the
vm_rssize (in pages, not bytes), then dividing (bogusly) by the page size,
then using that as a fraction of the total pages.


# 00d17f40 02-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

CLSIZE -> getpagesize()


# 3a91de06 02-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Replace NBPG with getpagesize()


# 8b9b0e39 28-Oct-1995 Poul-Henning Kamp <phk@FreeBSD.org>

I add #include <sys/user.h>


# c55931c7 26-Sep-1995 Peter Wemm <peter@FreeBSD.org>

Correct the alignment of the tty column, which was affected by my change to
allow more than two tty characters.

David Greenman pointed out that when a process that had been revoked from
it's controlling tty, the "-" sign was detached from any two-character
names.


# 69267920 03-Sep-1995 Peter Wemm <peter@FreeBSD.org>

Increase the tty column width from 2 to 3 characters.

This gives us more room to breath with tty names, especially with drivers
that support large numbers of ports.. eg: specialix and digiboard.

This does not actually change the current tty names, it just allows room
for reporting more characters if the drivers use them.


# 656dcd43 07-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


# 2162b2d2 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.

Reviewed by: phk


# 0fd510b7 19-Mar-1995 Joerg Wunsch <joerg@FreeBSD.org>

You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.

I (Joerg) finished most of Philippe's cleanup. /bin/sh will still
need *allot* of work, however.

Submitted by: charnier@lirmm.fr (Philippe Charnier)


# efc18e2c 02-Oct-1994 Andrey A. Chernov <ache@FreeBSD.org>

Skip 'cua' 3 chars like 'tty' 3 chars


# 8b6f5f5f 02-Oct-1994 David Greenman <dg@FreeBSD.org>

On second thought...back out previous commit.


# 793ced0e 02-Oct-1994 David Greenman <dg@FreeBSD.org>

Include rtprio.h


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources