Commit Graph

125 Commits

Author SHA1 Message Date
Mateusz Guzik
8b04bbef31 Return real parent pid in kinfo (used by e.g. ps)
Add a separate field which exports tracer pid and add a new keyword
("tracer") for ps to display it.

This is a follow up to r270444.

Reviewed by:	kib
MFC after:	1 week
Relnotes:	yes
2014-08-28 08:41:11 +00:00
Konstantin Belousov
d735998057 Correct the problems with the ptrace(2) making the debuggee an orphan.
One problem is inferior(9) looping due to the process tree becoming a
graph instead of tree if the parent is traced by child. Another issue
is due to the use of p_oppid to restore the original parent/child
relationship, because real parent could already exited and its pid
reused (noted by mjg).

Add the function proc_realparent(9), which calculates the parent for
given process. It uses the flag P_TREE_FIRST_ORPHAN to detect the head
element of the p_orphan list and than stepping back to its container
to find the parent process. If the parent has already exited, the
init(8) is returned.

Move the P_ORPHAN and the new helper flag from the p_flag* to new
p_treeflag field of struct proc, which is protected by proctree lock
instead of proc lock, since the orphans relationship is managed under
the proctree_lock already.

The remaining uses of p_oppid in ptrace(PT_DETACH) and process
reapping are replaced by proc_realparent(9).

Phabric:	D417
Reviewed by:	jhb
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2014-08-07 05:47:53 +00:00
Sergey Kandaurov
38d22923f7 Add support for inspecting process flags set in p_flag2.
Reviewed by:	jhb
MFC after:	1 week
2014-06-06 22:52:11 +00:00
Bryan Drewery
13767130c7 Add -J to filter by matching jail IDs and names.
-J 0 can be used to show only host processes.

Patch partially based on work by bz@

PR:		bin/78763
MFC after:	2 weeks
Relnotes:	yes
2014-05-02 15:05:47 +00:00
Mark Johnston
93f7e978f6 Correct the description of the V state, which indicates that the process'
parent is suspended, not the process itself.

MFC after:	3 days
2013-12-28 03:04:05 +00:00
Will Andrews
5e9ccc8797 Add the ability to display the default FIB number for a process to the
ps(1) utility, e.g. "ps -O fib".

bin/ps/keyword.c:
	Add the "fib" keyword and default its column name to "FIB".

bin/ps/ps.1:
	Add "fib" as a supported keyword.

sys/compat/freebsd32/freebsd32.h:
sys/kern/kern_proc.c:
sys/sys/user.h:
	Add the default fib number for a process (p->p_fibnum)
	to the user land accessible process data of struct kinfo_proc.

Submitted by:	Oliver Fromme <olli@fromme.com>, gibbs
2013-08-26 23:48:21 +00:00
Joel Dahl
e9e3a1ab1f Add a few examples.
Obtained from:	OpenBSD
2013-03-15 20:12:54 +00:00
Konstantin Belousov
45732078c1 Document P_PPTRACE.
MFC after:	2 weeks
2013-02-07 15:37:51 +00:00
Andrey Zonov
08c62f8deb - Bump date.
Submitted by:	pluknet
Approved by:	kib (mentor)
X-MFC-With:	r240645
2012-09-18 13:24:14 +00:00
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
Joel Dahl
288eac5aed mandoc complains loudly when <TAB>s are misused in columnated lists. Fix
this syntax violation and while I'm here also convert <TAB> to Ta and adjust
quotation marks in order to prevent this problem in the future.
2012-03-29 16:02:40 +00:00
Konstantin Belousov
28c84226e8 Document P_ORPHAN.
MFC after:	3 days
2012-03-08 13:00:49 +00:00
Mikolaj Golub
6edf5accb6 Remove yet another outdated note about procfs(5) being required.
Spotted by:	arundel
2011-11-22 21:53:06 +00:00
Mikolaj Golub
57c87bfabb No need in procfs(5).
MFC after:	2 weeks
2011-11-22 21:14:46 +00:00
Edward Tomasz Napierala
aa7a15b6bb For processes with no controlling terminal, display "-" in the TTY column
instead of "?".

Submitted by:	arundel
2011-10-30 15:21:27 +00:00
Glen Barber
6ec3cd078c Correct a typo that was introduced in 225912
Submitted by:		Valentin Nechayev (netch % netch!kiev!ua), arundel
MFC after:		1 week
With-MFC:		225908
2011-10-02 16:05:19 +00:00
Glen Barber
2d455a01bd Tweaks to ps(1):
- there's no reason the semantics of the -x flag are being explained in
  the -a flag description
- be more precise regarding the relation between the -a flag and the
  security.bsd.see_other_uids sysctl
- describe the format of the -t flag's argument
- 'con' no longer is a possible entry in the 'TT' column
- explain that the 'TT' column refers to pseudo-terminals via mere numbers
- add a hint in the 'tt' keyword description that a keyword 'tty' exists,
  which will give the full terminal pathname

Submitted by:		arundel (via docs@) (original)
MFC after:		1 week
With-MFC:		225908
2011-10-01 23:47:37 +00:00
Glen Barber
6401543842 Reorder default ps(1) output according to reality.
Submitted by:	arundel (via docs@)
MFC after:	1 week
2011-10-01 20:56:58 +00:00
Sergey Kandaurov
b758bdf8b3 Bump date after the previous commit. 2011-07-01 10:57:10 +00:00
Sergey Kandaurov
b3178949ee Update and sort the list of the available keywords. 2011-07-01 10:54:47 +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
Sergey Kandaurov
9abcf93a91 Spelling in P_HADTHREADS.
MFC after:	1 week
2011-05-20 14:32:28 +00:00
Sergey Kandaurov
0d69482994 Fix the description of the "paddr" keyword. It shows a process
pointer just like a dublicating "uprocp".

MFC after:	1 week
2011-05-20 14:07:08 +00:00
Edward Tomasz Napierala
b9ff20ab7e Document problems with -d/-w and the fact that -X is the default.
Suggested by:	arundel@
Reviewed by:	arundel@
2011-04-18 19:20:47 +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
Konstantin Belousov
f5f3977b8d Document P_FOLLOWFORK.
MFC after:	2 weeks
2011-01-25 11:04:16 +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
9cde081d0a Add P_HASTHREADS flag description. 2010-07-24 15:24:12 +00:00
Konstantin Belousov
9b0b529248 Update the list of the process flags for P_WKILLED.
MFC after:	4 weeks
2010-04-13 08:54:53 +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
Konstantin Belousov
7117b3d5aa Update the list of the process flags. Note that the lists of pending
signals for process and its threads are distinct.

Reviewed by:	jilles
MFC after:	2 weeks
2010-03-05 13:13:35 +00:00
Edward Tomasz Napierala
e50022797f Add manual page links to advertise procstat(1) a little better.
Approved by:	re (kib)
2009-07-09 16:40:00 +00:00
Brian Somers
044fce530f 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
2009-05-17 04:00:43 +00:00
Jeff Roberson
7f77f84497 - P_SA has been removed. 2008-03-12 10:01:34 +00:00
Ruslan Ermilov
9badf57f01 Markup fixes. 2006-09-17 17:40:07 +00:00
Yaroslav Tykhiy
7c5169efdd For the sake of clarity, explicitly tell that comma and space
characters can be included in a custom column title string --
that's why it may appear at the end of a keyword list argument
only.
2006-08-21 03:09:12 +00:00
Yaroslav Tykhiy
61b92b9a22 Document a detail in the present syntax of "ps -o foo=bar". Now
the header title string "bar" extends to the end of the argument
even if it contains commas or spaces, unlike in RELENG_4 or earlier.
The modern syntax agrees with SUSv3.

MFC after:	3 days
2006-08-18 14:12:38 +00:00
Maxim Konovalov
fa6c8d89c9 o Typo: s/teminal/terminal/.
Submitted by:	Michal Varga
2005-04-29 11:10:27 +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
Xin LI
6aac4c27da Several improvements to ps.1:
- Document the fact that empty heading text suppresses the
	  heading line (e.g. 'ps -o pid='), as this is very useful
	  in scripts.
	- Describe logname keyword more completely.
	- Describe the printing of arguments more completely.
	- Put lockname in the correct alphabetical order in the list
	  of all keywords.
	- Correct sentence in standards section.

Submitted by:	Jilles Tjoelker <jilles at stack nl>
PR:		docs/73618
MFC After:	1 week
2005-02-14 16:56:15 +00:00
Ruslan Ermilov
a89237ae95 Sync program's usage() with manpage's SYNOPSIS. 2005-02-09 17:37:39 +00:00
Warner Losh
9ddb49cbe4 /*- or .\"- or #- to begin license clauses. 2005-01-10 08:39:26 +00:00
Robert Watson
85c5243c1d Remove single line containing the word "KLD" ommitted in ps.1:1.80.
Pointed out by:	ru (some time ago)
2004-12-22 09:04:47 +00:00
Robert Watson
ac06cb0ad3 Point at the mac(4) man page when describing the -Z option.
Remove reference to /dev/lomac, which is no longer used by mac_lomac(4).

MFC after:	3 days
2004-11-29 12:00:24 +00:00
Garance A Drosehn
e4b70e6697 When displaying the "COMMAND" field for system-processes and/or kernel
threads, put the command name in square brackets instead of parenthesis.
This matches NetBSD, and also seems to be what linux does.  The sentence
which is added to the man page is taken straight from NetBSD.

PR:		bin/65803
Submitted by:	Cyrille Lefevre
Obtained from:	NetBSD
2004-06-22 01:59:54 +00:00
Garance A Drosehn
585bf55792 Add pgrep(1) and pkill(1) to the cross-reference section of ps(1). 2004-05-25 14:05:25 +00:00
Garance A Drosehn
259fcfacc4 Add the 'sid' info to the output of `ps -j', to make up for the 'sess'
(session-pointer) info which was dropped from `ps' earlier in 5.x.

PR:		bin/59423
Submitted by:	Jilles Tjoelker
2004-05-23 21:35:35 +00:00
Ruslan Ermilov
287d1861eb Assorted markup fixes. 2004-05-16 21:35:05 +00:00