Commit Graph

94 Commits

Author SHA1 Message Date
Andrey Zonov
38f2be1c54 - Add 'dsiz' and 'ssiz' keywords to show data and stack size respectively.
Approved by:	kib (mentor)
MFC after:	1 week
2012-09-18 12:25:14 +00:00
Konstantin Belousov
4f1e1f86a1 Add 'cow' keyword to show per-process cow count.
Submitted by:	Andrey Zonov <andrey zonov org>
MFC after:	1 week
2012-05-23 18:11:36 +00:00
Edward Tomasz Napierala
1d1143ec27 Make ps(1) automatically size its column widths. 2011-09-29 06:31:42 +00:00
Bjoern A. Zeeb
925af54487 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)
2011-07-18 20:06:15 +00:00
Edward Tomasz Napierala
9acd91270f 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>
2011-06-14 16:50:16 +00:00
Edward Tomasz Napierala
649fde88ff Get rid of DSIZ; instead just call the sizing function if provided. 2011-04-12 20:10:15 +00:00
Edward Tomasz Napierala
f9db2550b2 Add proper width calculation for time fields (time, cputime and usertime).
This fixes the ugly overflow in "ps aux" output for "[idle]".
2011-03-24 20:15:42 +00:00
Edward Tomasz Napierala
3bf92decd3 Make "LOGIN" and "CLASS" columns width scale properly instead of wasting space. 2011-03-24 17:20:24 +00:00
Konstantin Belousov
a870bf2c31 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
2011-03-17 11:25:32 +00:00
Edward Tomasz Napierala
7123f4cd6f Export login class information via kinfo and make it possible to view
it using "ps -o class".
2011-03-05 14:41:49 +00:00
Ed Maste
6239ef1d29 Make a thread's address available via the kern proc sysctl, just like the
process address.

Add "tdaddr" keyword to ps(1) to display this thread address.

Distilled from Sandvine's patch set by Mark Johnston.
2010-10-08 00:44:53 +00:00
Edward Tomasz Napierala
ab8d4d579f Fix alignment for the 'flags' label, and make more room for 'tdev'.
MFC after:	1 month
2010-07-24 15:37:36 +00:00
Juli Mallett
41ded75de8 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
2010-03-17 22:57:58 +00:00
Alexander Leidinger
5b412ffb6b Fix small resource leak (memory).
Reviewed by:	gad
MFC after:	1 week
2009-11-17 07:29:35 +00:00
Xin LI
1575bd0a6d Increase width for %CPU, RSS and VSZ columns for now. Modern systems
tend to have larger memory, larger process, and more CPU.
2009-11-03 09:28:45 +00:00
Attilio Rao
4610a8114d [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
2009-02-26 18:01:07 +00:00
Julian Elischer
c36b9f6253 fix sorting of 'tdnam' keyword in keyword list. 2007-10-28 17:10:36 +00:00
Julian Elischer
7ab24ea3b9 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.
2007-10-26 08:00:41 +00:00
Garance A Drosehn
6331f11eca Re-correct commit 1.73, but this time in a way that does not cause
all column-headers to print in lowercase by default.  I was in too
much of a rush in committing 1.75, and didn't notice that the case
had changed.  This time I did considerably more testing, and used
'diff' instead of just quickly eyeballing the results...

Apologies.  I expect this means the dunce cap is mine for awhile.
If this doesn't work, I'll just drop back to 1.72 and hide under
my desk for awhile.
2006-04-06 03:24:31 +00:00
Garance A Drosehn
a9f48b449a Fix a problem introduced by change 1.73, which causes a seg-fault if
the user specifies a keyword which is an alias to some other keyword.
E.g.: stat (for state) or pcpu (for %cpu)..

Submitted by:	Kostik Belousov
MFC plans:	"soon"
2006-04-05 17:40:46 +00:00
Garance A Drosehn
88985aedd2 Collapse strncpy/strncat/strncat into a single snprintf, as suggested
by pjd.

MFC after:	3 weeks
2006-03-08 09:15:20 +00:00
Garance A Drosehn
ec71648737 Fix the case where the user specifies an alternate heading for some
output-format keyword, and the keyword they picked is an alias to
some other keyword.                 E.g.:   ps -o stat=Zustand $$
('stat' is defined as an alias for 'state')

PR:		bin/57833
MFC after:	3 weeks
2006-03-08 08:58:44 +00:00
Pawel Jakub Dawidek
a990344f7e Add and document the 'jid' keyword for the '-o' option.
Reviewed by:	gad
MFC after:	3 days
2005-03-20 10:40:36 +00:00
Christian S.J. Peron
237d4cef65 Since it is not un-common for a process's resident set size (rss)
to exceed 10 megabytes in size (especially in X), bump the max
column width from 4 bytes to 5. This will make the ps auxw output
uniform again when a process's rss exceeds 10 megs.

It should be noted that when 5 digits becomes to small, other
solutions should be explored such as displaying them in megabytes
or having ps automatically re-size column widths.

Discussed with:	gad
MFC after:	1 week
2005-02-06 16:34:49 +00:00
Garance A Drosehn
bdf8ab4692 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
2004-06-23 23:48:09 +00:00
Garance A Drosehn
820434b27f 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
2004-06-23 11:56:57 +00:00
Garance A Drosehn
15b87b531e 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
2004-06-20 23:40:54 +00:00
Garance A Drosehn
76adc1fd42 Add new output-format keywords of LWP and NLWP, which show the thread-id
and number-of-threads tied to a process.  Result can be seen by typing,
e.g.:   ps -HO lwp,nlwp
These new options are not documented yet.  More options will be coming,
and I will update the man page after I get farther along.

PR:		bin/65803  (though adjusted to fit our present source)
Submitted by:	Cyrille Lefevre
2004-06-20 22:22:49 +00:00
Mark Murray
6195fb4102 Remove clause 3 from the UCB licenses.
OK'ed by:	imp, core
2004-04-06 20:06:54 +00:00
Juli Mallett
7cb9663b27 MFp4 @46705:
Support "uprocp" exactly like "paddr" with the former having been
documented in the manual but not implemented.

PR:		42484
2004-02-08 23:57:19 +00:00
Hartmut Brandt
de244df7c9 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.
2003-08-13 07:35:07 +00:00
Tim J. Robbins
e2c9ac698c 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
2003-04-12 10:39:56 +00:00
Maxim Sobolev
6f15bc16ed Fix slight disorder that broke sorting. Put in bold warning about the
fact that in this case order matters.

Submitted by:	Peter Edwards <pmedwards@eircom.net>
2003-02-05 19:22:39 +00:00
Philippe Charnier
eaed5652bf Display elapsed time (-o etime) using [[dd-]hh:]mm:ss, which according to
Solaris man page is the POSIX way.

Reviewed by:	jmallett
2003-02-05 13:18:17 +00:00
Juli Mallett
78b1878a16 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.
2003-01-19 00:31:16 +00:00
Juli Mallett
fde411d5a1 When inserting a non-user-specified (e.g. not via -o or -O) format, don't dupe
one that is already there.  This is consistent with GNU ps(1)'s BSD mode, and
POLA.

Reported by:	Andy Farkas <andyf@speednet.com.au>
Tested by:	Andy Farkas <andyf@speednet.com.au>
2003-01-19 00:22:34 +00:00
Robert Watson
2af538eb48 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
2002-10-24 00:00:57 +00:00
John Baldwin
0d6326492b Catch up to SMTX -> SLOCK changes. 2002-10-02 20:33:52 +00:00
Juli Mallett
8dd2eb05bf List valid keywords, ala kill(1), rather than the csh builtin kill, which
tells people to type kill -l, when no valid ones are specified.

Sponsored by:	Bright Path Solutions
MFC after:	4 days
2002-09-27 01:44:30 +00:00
Juli Mallett
36b025da93 Ala kill(1), tell people to type 'ps -L' for a list of format keywords.
Sponsored by:	Rachel Hestilow <rachel@jerkcity.com>
MFC after:	2 weeks
2002-09-27 01:40:30 +00:00
Juli Mallett
362d62ba07 Rename new PLONG type to PGTOK as the conversion is more important than the
size (which is mostly undefined anyway).

Submitted by:	bde
2002-09-17 17:13:52 +00:00
Juli Mallett
760bbf7d6d 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.
2002-09-17 02:52:44 +00:00
Juli Mallett
f3073b05b7 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
2002-09-16 20:19:51 +00:00
Juli Mallett
4086fd8e70 Remove some NOTINUSE stuff. Good housekeeping. 2002-09-16 20:06:04 +00:00
Robert Drehmel
a755f1c9d0 - Use (MAXLOGNAME - 1) where UT_NAMESIZE was used to be able to
(-)remove the inclusions of <utmp.h>.
2002-07-08 09:08:51 +00:00
David E. O'Brien
2749b14129 Consistently use FBSDID 2002-06-30 05:15:05 +00:00
Juli Mallett
2dda9fe910 Allow whitespace to act as a delimiter in the keywords list given to the -o,
again, but also allow it in the user-specified header, too.  This is far more
backwards compatible and SUSv3-happy than allowing only comma to seperate the
keywords list.

Submitted by:	tjr
2002-06-08 18:11:52 +00:00
Juli Mallett
76e1a9fe48 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.
2002-06-06 21:18:37 +00:00
Juli Mallett
e8eef4bb45 Support the SUSv3 `rgroup' format.
Clean up some local style bogons.
2002-06-06 20:42:16 +00:00
Juli Mallett
033340171a SUSv3 conform on the "comm" and "args" formats, and make correct the "command"
format, since it's BSDlike, and "comm" is actually different.
2002-06-06 20:21:47 +00:00