Commit Graph

89 Commits

Author SHA1 Message Date
simonb d8f2ef9ae4 Gah, fix uninitialised variable with the "etime" change. _Never_ be
happy with something and then edit a single line before committing
without retesting...
2004-03-27 14:55:24 +00:00
simonb 891960dba2 Add support for the POSIX.2 "args" and "comm" keywords. "args" is just
an alias for "command", and "comm" shows just argv[0] and not the whole
argument list.

Fix for part of PR standards/11224.
2004-03-27 14:52:36 +00:00
simonb 63e11689ca Add support for the POSIX.2 "etime" keyword - shows the elapsed time
since the process was started.  Fix a couple of style nits as well.

Fix for part of PR standards/11224.
2004-03-27 14:49:13 +00:00
simonb a6b219ed94 #define<TAB> 2004-03-27 14:09:10 +00:00
simonb c2c9310515 Use some constants from <tzfile.h>. 2004-03-27 12:59:25 +00:00
simonb abb3201747 Wrap some long lines.
Consisently use (void) in front of printf(...);
A few more white-space nits.
2004-03-27 12:44:08 +00:00
simonb f43fbf8e69 Fix grammar in a comment. 2004-03-27 12:11:55 +00:00
simonb 53474900d5 KNF, ANSFify, de-__P, unC++ify, white space nits. 2004-03-27 12:09:28 +00:00
wiz 85746c6759 Spell interrupt with two rs. From Peter Postma. 2004-02-24 15:16:04 +00:00
jdolecek 2cc036866c g/c SDEAD 2004-01-11 18:55:33 +00:00
agc b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
dsl f24cb25605 - add keywords for utime, stime and ctime (output sss.ssssss if small)
- fiddle with keyword table - mainly to keep width under 80 cols
- add -k keylist so sort output
- don't use logs to work out field width, get -MAXINT right
- user defined headers can be 1 char (actually they can be zero length)
  so ?? in tty column isn't guaranteed to be wider than header
- remove some long long casts (compiles on sparc64 still)
- use kvm_openfiles(NULL, NULL, NULL, KVN_NO_FILES, ..) unless core file
  specified,
(approved by christos)
2003-03-06 09:04:21 +00:00
atatat 40f3045957 Add p_svuid and p_svgid to kinfo_proc2. Populate them in the kernel
and in libkvm.  Then teach ps how to show them to you.

Also, teach ps how to show the names for all the uids, the rest of the
group numbers, and the "group access list".
2003-03-01 05:41:55 +00:00
thorpej 3fdac2b8c5 Merge the nathanw_sa branch. 2003-01-18 10:52:16 +00:00
wiz 7e681f7063 interrupt with two rs. 2003-01-06 13:04:54 +00:00
jdolecek fc257046b9 g/c procfs fallback code, it's redundant now that we use sysctl to get
process info
2002-06-19 08:11:55 +00:00
christos d09016d45a Document some missing flags and add systrace(1) 'x' flag. 2002-06-17 16:48:44 +00:00
nathanw 43634bc5ba Since kinfo_proc2 has many values that are 64-bit, ps needs to know
that they're 64-bit, and grab them out of memory appropriately. Otherwise,
big-endian systems get the wrong end of the 64-bit value and lose.

Keywords affected: inblk, majflt, minflt, msgrcv, msgsnd, nivcsw, nsigs,
nswap, nvcsw, and oublk.
2002-04-24 21:41:22 +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
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
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
christos c91b59d1de Print system processes/kernel threads as [kprocname] as top(1) does. 2001-08-07 14:46:09 +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
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
mrg 8d4795719a remove include of <vm/vm.h> 2000-06-29 06:26:33 +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
fredb f3ac07c89e Fix CL* purge fallout. 1999-12-05 18:33:28 +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
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 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
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
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