Commit Graph

34 Commits

Author SHA1 Message Date
hubertf b8a04b1a7e Document -U switch (displays processes belonging to given user/uid).
Reported in PR 8943 by WL <wliao@dura.spc.uchicago.edu>
1999-12-04 01:23:09 +00:00
simonb 5801c247fa "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.
1999-12-03 02:16:41 +00:00
drochner 85cbf55d16 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.
1999-11-09 15:06:30 +00:00
jdolecek a5ae7c6ca4 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
1999-10-15 20:39:52 +00:00
jdolecek e52880e76a 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
1999-10-15 20:01:33 +00:00
jdolecek f848d2ec0c 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.
1999-10-15 19:31:24 +00:00
bgrayson 05e0706ac9 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.
1999-03-27 21:38:08 +00:00
bgrayson be8534f744 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.
1999-03-26 22:36:02 +00:00
kim 26cc4401e8 Fixed segfaulting for "ps -T". There is no optarg with -T, so instructions
under label "tty:" need to use ttname instead.
1999-01-04 16:37:28 +00:00
mycroft 975ed85295 Add a -U option to select by user/uid. 1998-07-28 18:54:02 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
mycroft 9dc385beb1 Delint. 1998-07-28 05:31:22 +00:00
mycroft 0e2f9ea923 __AUDIT__ cleanup. 1998-07-27 17:06:48 +00:00
mrg 80efe80bc9 - 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
1998-07-06 07:50:18 +00:00
lukem a234ba3ffe getopt returns -1 not EOF
cleanup manpage
1997-09-14 08:57:37 +00:00
christos 78295c8bc1 Fix compiler warnings
Add WARNS=1
1997-07-20 20:37:53 +00:00
mrg ecdc59670c note that strcpy is safe. 1997-04-21 05:28:43 +00:00
pk bf18a93a17 Message buffer passed to kvm_openfiles() should _POSIX2_LINE_MAX long; PR#3266 1997-02-28 13:34:50 +00:00
thorpej 83e59fbba8 Fix SEGV when kludging old-style options.
From Greg Stark <gsstark@mit.edu>, PR #2550.
1996-09-27 02:59:53 +00:00
mycroft 3541700d61 Create and strvis(3) the argument and environment lists only as needed.
Do not keep extra copies around.
1995-05-18 20:33:20 +00:00
mycroft d70850c69c Gather the argument and environment lists when we actually want to print them. 1995-05-18 14:37:03 +00:00
cgd 49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00
mycroft 07cdfa9cd1 Integrate `-c' option, from Arne Juul. 1994-09-16 22:23:29 +00:00
cgd 4d1457ce4e clean up import 1994-05-09 03:31:07 +00:00
cgd 25718695be update for changed flags 1994-05-05 02:04:10 +00:00
cgd cd68b34ae6 fix from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>:
don't try to display the resident text size; we can't do that anymore
1993-10-07 00:45:59 +00:00
mycroft 8542364e07 Add RCS identifiers. 1993-08-01 18:49:50 +00:00
cgd 40194b0e50 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.
1993-07-19 11:02:10 +00:00
cgd 4434a6ed53 fix alien 'w' handling. you really don't want to know... 1993-07-11 17:34:29 +00:00
cgd 6ed1026d12 add support and documentation for the 'e' option, to print out
the process environment.
1993-06-01 01:38:28 +00:00
cgd 06be60083d changed "Id" to "Header" for rcsids 1993-03-23 00:22:59 +00:00
cgd 346aa5dd48 added rcs ids to all files 1993-03-22 08:04:00 +00:00
cgd e541169ce2 after 0.2.2 "stable" patches applied 1993-03-21 18:04:42 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00