Commit Graph

223 Commits

Author SHA1 Message Date
ad
5a6b9d89df Xref pkill/pgrep. 2002-03-04 13:02:32 +00:00
martin
f95cd5a968 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.
2002-02-21 19:31:03 +00:00
enami
b127ec2616 Just use return value of strvis instead of calling strlen. 2002-02-14 06:57:19 +00:00
enami
4c30ea4ac5 Don't define variable as static unnecessarily. 2002-02-14 06:54:41 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
jdolecek
ef1ec2419d 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.
2002-01-21 23:01:55 +00:00
soren
dc53bf3cba Sync getopt() / man page with actual getopt options. 2001-12-20 20:10:33 +00:00
wiz
8ee888f96f Properly quote punctuation. 2001-12-20 20:06:15 +00:00
wiz
3ebcdc5e43 Whitespace nits. 2001-12-20 19:31:48 +00:00
lukem
b8a6769184 fix minor WARNS=2 2001-11-03 13:21:09 +00:00
lukem
725b21190a fix comment: "[]" are [square] brackets, "<>" are angle brackets 2001-08-24 06:37:03 +00:00
enami
48661b973f Print commands within angled brackets only if they are system processes.
Print other commands, like cc, cpp and as, within parentheres.
2001-08-24 01:48:22 +00:00
wiz
1e378c4c12 precede, not preceed. 2001-08-20 12:00:46 +00:00
christos
c91b59d1de Print system processes/kernel threads as [kprocname] as top(1) does. 2001-08-07 14:46:09 +00:00
wiz
8c6310c4a3 Remove duplicate `if'. Noted by Geoff C. Wing in bin/13551. 2001-07-30 16:22:49 +00:00
matt
c6458f33d8 Add a small optimizetion in savevars(). break out of the loop once needcomm
is set since setting it multiple times only wastes cpu time.
2001-07-20 21:59:58 +00:00
matt
68b3b7e9c7 Retrieve maxslp & uspace from kernel instead of using defines. Needed for
shared arm code.
2001-07-14 06:53:43 +00:00
sommerfeld
d19e89a7c0 correct the description of paddr 2001-07-04 20:49:00 +00:00
cyber
428f40d685 If there were no processes to list, it meant that our criteria failed
and didnt match anything.  Dont make our caller think we succeeded.
2001-06-14 19:04:49 +00:00
enami
4aa8283eb7 Always initialize an auto variable. 2001-03-23 01:06:02 +00:00
itojun
58a9573963 do not update maxlen if realloc fails. 2001-03-20 19:05:11 +00:00
christos
a396a72f84 clarify things a bit more (from hubertf) 2001-01-15 21:02:58 +00:00
christos
3141a5cc48 Really explain what parenthesized names mean and why we parenthesize names! 2001-01-15 17:57:14 +00:00
hubertf
9bb3e62b11 Document the meaning of commands shown in parantheses.
Patches submitted by Jeremy C. Reed <reed@reedmedia.net> in PR 11930.
2001-01-15 16:16:51 +00:00
itojun
bc8fe00e2e KPTR/KPTR24 are using u_int64_t. commented by minoura 2001-01-09 01:21:59 +00:00
itojun
adf3a0eef5 redo previous (simplify KPTR) 2001-01-08 18:03:45 +00:00
itojun
3410e7bd02 backout previous; did not compile on non-alpha 2001-01-08 17:55:28 +00:00
itojun
a3c77f0437 simplify KPTR processing. 2001-01-08 17:18:24 +00:00
itojun
f320afb26b address PR 11653. checked on alpha.
XXX supports 32bit and 64bit pointers only
2001-01-08 13:20:29 +00:00
simonb
0a7d3a1ff5 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.
2000-10-23 05:54:06 +00:00
nathanw
904bfc5822 Update description of process flag 0x20000 to match reality:
P_NOCLDWAIT, not P_SSTEP.
2000-08-28 13:06:42 +00:00
mrg
8d4795719a remove include of <vm/vm.h> 2000-06-29 06:26:33 +00:00
simonb
eb32670668 Remove the 'poip' (pageouts in progress) keyword from the manpage.
From PR bin/8843 by Brian Stark.
2000-06-24 07:43:22 +00:00
simonb
643cb3c341 Don't check namelist when choosing to use the sysctl interface. 2000-06-16 03:51:00 +00:00
simonb
d530ee00d1 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.
2000-06-08 13:30:39 +00:00
simonb
292b668867 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.
2000-06-08 00:51:10 +00:00
simonb
a98dd470c6 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.
2000-06-07 04:57:59 +00:00
simonb
a717560d21 G/C evar() - now that everything is in the one structure it was exactly
the same as pvar().
2000-06-02 03:39:02 +00:00
simonb
fd521aefe9 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.
2000-05-26 03:04:28 +00:00
thorpej
06b81d67f4 Handle SONPROC state. 2000-05-26 00:42:34 +00:00
mjl
4ecbad3425 Fix problem in option processing, would segfault when parsing "-O,".
Closes PR/10096 by Yuji Yamano using the patch provided.
2000-05-11 08:52:30 +00:00
abs
22cfbf2cbb 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.
2000-04-29 00:18:48 +00:00
simonb
8384a1bbb8 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.
2000-04-15 04:40:46 +00:00
chs
233639846d make -M imply -K. the current system is not likely to be
a reasonable approximation of a crash dump.
2000-04-10 06:37:37 +00:00
jdolecek
13885bdfec Ignore also "self" link when searching for proc info.
Patch sent by NAKAJIMA Yoshihiro in bin/9819
2000-04-07 18:04:05 +00:00
dbj
00afbd6fd8 name database is kvm.db not kvm_netbsd.db 2000-02-22 06:47:27 +00:00
fredb
f3ac07c89e Fix CL* purge fallout. 1999-12-05 18:33:28 +00:00
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
e7f8f72d9d Since we have an "extern.h", put all external variable declarations in
that file and not sprinkled around various .c files.
1999-12-03 02:26:36 +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
mrg
fdea8ae38f skip "dty" just like we skip "tty", otherwise we just get "dt" in ps output for all dty's 1999-10-11 09:18:09 +00:00
chs
21eedb0ec1 the PMAP_NEW option is gone as the new interface is no longer optional. 1999-09-12 01:19:23 +00:00
veego
03fd106af5 According to the previous commit the new process state should be SDEAD and
not SDYING, so s/SDYING/SDEAD/.
1999-07-23 08:56:13 +00:00
thorpej
3586621927 Update for SDEAD. 1999-07-22 18:16:05 +00:00
thorpej
907831a0b3 KNF. 1999-05-09 19:23:38 +00:00
mrg
c0999a71b0 oops, fix merge botch in previous.. 1999-05-03 00:20:07 +00:00
mrg
d5c7180e2b limit session to 6 chars. from Geoff Wing <gcw@pobox.com> and fixes his PR#7506 1999-05-03 00:17:30 +00:00
christos
f3d0eddcde Add support for printing wide sigset_t properly. 1999-04-16 13:34:32 +00:00
bgrayson
2721f671ab - 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.
1999-03-28 00:46:47 +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
tron
0ee6a66c30 Add missing prototype so that this actually compiles. 1999-03-27 15:22:17 +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
mrg
d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
garbled
f124765044 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.
1999-03-22 18:25:43 +00:00
msaitoh
0a51b829fa ps's information is sorted by controlling terminal and (among processes with
the same controlling terminal) by PID.
1999-03-17 20:59:55 +00:00
mycroft
f6590b22cd Clean up SYNOPSIS formatting. 1999-03-07 11:02:05 +00:00
mycroft
7a981b1dc5 Fix formatting errors. 1999-03-07 10:48:31 +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
tron
29fe5bf18a The system namelist database is called "/var/db/kvm.db" not
"/var/db/kvm_netbsd.db". Fixes PR bin/6712 by Brian Grayson.
1999-01-02 16:11:43 +00:00
tv
8cfe18e8d3 Add CWARNFLAGS+=-Wno-format-y2k. 1998-08-25 15:13:16 +00:00
ross
17dbc471f0 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
1998-08-25 07:43:20 +00:00
tv
19bef08688 This needs strftime()'s %y; use -Wno-format-y2k. 1998-08-21 19:39:41 +00:00
mycroft
975ed85295 Add a -U option to select by user/uid. 1998-07-28 18:54:02 +00:00
mycroft
37e6d2f31d Look for the formats used by setproctitle(3) and login shells, and avoiding
outputting the redundant `(comm)'.
1998-07-28 18:41:59 +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
fair
fe40034fae change references to vadvise to madvise; remove reference to lisp(1) 1998-04-28 17:59:10 +00:00
kleink
15fbf68ce9 Need <time.h> for localtime(), time() and strftime() prototypes. 1998-04-01 14:19:27 +00:00
is
07a1b88ab8 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).
1998-03-27 22:45:47 +00:00
bouyer
a394682ff6 Sync with reality: the uprocp keyword doesn't exist. 1998-03-24 18:34:12 +00:00
perry
ba7b5f16ff add -DPMAP_NEW if PMAP_NEW is on in mk.conf 1998-02-18 03:54:58 +00:00
thorpej
047098bc5c Add a "sid" keyword to print the session ID. 1998-02-17 21:37:56 +00:00
mrg
279ce528ce add -DUVM to CPPFLAGS if defined(UVM) 1998-02-09 06:25:15 +00:00
mrg
79ddb78a38 remove old OLD BSD VM code. 1998-02-06 04:47:30 +00:00
gwr
54bd1bef90 Begone KERNBASE! (Just print kernel pointers as-is.) 1998-02-05 03:51:16 +00:00
perry
2850c7f9f7 add <sys/time.h> to fix compiler error 1998-02-03 03:16:01 +00:00
perry
0a9d9a55b9 RCS Id Police. 1998-01-09 07:00:57 +00:00
enami
3068d97149 Use .Nm "" instead of .Nm ps in SYNOPSIS. 1997-10-11 02:16:56 +00:00
lukem
76e13a0128 all but the first .Nm in SYNOPSIS need to be spelt out. [bin/4256] 1997-10-10 16:12:45 +00:00
lukem
a234ba3ffe getopt returns -1 not EOF
cleanup manpage
1997-09-14 08:57:37 +00:00
mikel
2179735ae5 default swap device is /dev/drum, not nonexistent /dev/swap; from
<entropy@tardis.bernstein.com> in PR bin/4042
1997-08-27 05:43:20 +00:00
mikel
6e662001bc use %c not %C for lstart; from tetsuya@secom-sis.co.jp via OpenBSD 1997-08-03 01:57:04 +00:00
christos
23edbe3557 Remove WARNS=1 from all the subdirectory Makefiles, and add it to Makefile.inc
now that all /bin has been cleaned.
1997-07-20 22:36:20 +00:00
christos
78295c8bc1 Fix compiler warnings
Add WARNS=1
1997-07-20 20:37:53 +00:00