summaryrefslogtreecommitdiffstats
path: root/bin/ps/ps.c
Commit message (Collapse)AuthorAgeFilesLines
* Minor style fixes, mostly adding indent-protection on some comment-blocks.gad2004-03-301-6/+6
| | | | | Noticed by: bde MFC after: 1 week
* Replace pscomp() with a cleaner version, mostly written by bde (*).gad2004-03-301-14/+43
| | | | | | | | | | | This corrects a problem of lost-precision for `-r' (sort-by-CPU). Also, for sort-by-CPU and sort-by-memory, any processes which have the same value CPU or MEMORY are now sorted by TTY and then (if needed) by pid. (* - I just added the NODEV checks, after doing some testing of my own) Submitted by: bde MFC after: 1 week
* Oops. Remove some ';'s in #defines added by a previous update.gad2004-03-291-2/+2
| | | | Noticed by: bde
* Have this source explicitly include <sys/proc.h>, since it referencesgad2004-03-291-0/+1
| | | | | | | values such as P_CONTROLT and PS_INMEM. But this still won't define PID_MAX for us, since that is hidden inside of '#ifdef _KERNEL'. Noticed by: bde
* Since "kp" is a pointer, I should be comparing against NULL not 0.gad2004-03-291-1/+1
| | | | Noticed by: bde
* Various style improvements, mostly in comments and indentation.gad2004-03-291-43/+58
| | | | Suggested by: bde (well, for most of them)
* In the routines I've been working on, sort the variable declartionsgad2004-03-291-9/+9
| | | | | | so that non-pointers are listed after pointer-type variables. Noticed by: bde
* Split two 'fmt' strings so they're easier to read on 80-char windows.gad2004-03-291-2/+4
|
* Sort the declarations of global variables.gad2004-03-291-24/+25
|
* Sort the routine prototypes.gad2004-03-281-10/+9
|
* If <x> is a process id that does not exist, then just print the headergad2004-03-281-1/+1
| | | | | | | (if any) and exit, thus matching the behavior on -stable and other OS's. My earlier attempt to fix this (v1.65) only seemed to work because of a lucky random value in nentries (which was not being initialized back when I tested that earlier patch).
* If a non-existent user is given as part of `-U userlist', treat it asgad2004-03-271-11/+6
| | | | | a fatal error instead of a minor warning. It is possible that a few users are used to the previous behavior, but I'm claiming it was a bug.
* Explicitly wrap two long-ish linesi of code, to make them easier to read.gad2004-03-271-2/+4
|
* Change the #if-ish logic which is used to add the `-f' option when `ps'gad2004-03-271-9/+9
| | | | | | is compiled with LAZY_PS, so that there is only one PS_ARGS string to modify when changing the option-list. Also get `-f' to show up in the usage() statement when compiled with LAZY_PS.
* Move the 'f' case so it shows up in the right place, alphabetically.gad2004-03-271-6/+6
|
* Support more POSIX/SUSv3 options:gad2004-03-271-181/+525
| | | | | | | | | | | | | | | | | | | | | | - Change `-p' to allow a list of process IDs, and `-t' to allow a list of terminal names, instead of only a single value for each. - Add the `-A' option of SUSv3, which is exactly the same as `-ax'. - Add the `-G gidlist' (group id). - Allow any of these "selector options" to be specified multiple times, and have `ps' keep adding to a given list -- instead of replacing the previously-specified values. - Fix interactions between selector-options, so that: "If any are specified, ... ps shall select the processes represented by the inclusive OR of all the selection-criteria options." (from SUSv3) - Add a `-X' option, which is the reverse of the `-x' option. - various minor improvements in parsing and error handling. This does not get us to match POSIX/SUSv3, but it gets us closer. The `-g pgidlist', `-R ruserlist' and `-s sidlist' options mentioned in freebsd-standards are still under debate, so they skipped for now. It should be true that this introduces no user-visible incompatible changes, except to support "new stuff" that was not supported before.
* Fix 'ps -p proclist' and 'ps -u userlist' so the command returns non-zerogad2004-03-181-3/+13
| | | | | | | | if no processes were matched. Also sorts the list of 'int's in main, as long as I had to add another one... Noticed by: Nate Lawson MFC after: 10 days
* Improvements to 'ps -p <x>'. If <x> is a process id that does not exist, thengad2004-03-171-19/+99
| | | | | | | | | | | just print the header (if any) and exit, thus matching the behavior on -stable and other OS's. Also adds support for <x> being a comma-separated list of processes, and does a much better checking for invalid-values of <x>, such as 'ps -p someword'. Reviewed by: mentioned on freebsd-current MFC after: 10 days
* Allow the -H option to show threads when selecting by uid, tty,deischen2004-02-221-8/+6
| | | | and pid.
* Add the -H option to ps(1) to display all kernel visible threads in eachscottl2003-06-121-5/+12
| | | | | process. The default behavior of showing only the process is retained as the default.
* Display elapsed time (-o etime) using [[dd-]hh:]mm:ss, which according tocharnier2003-02-051-0/+1
| | | | | | Solaris man page is the POSIX way. Reviewed by: jmallett
* Per-variable\ entry headers, to allow the 'ps -otime -otime=FOO' or similarjmallett2003-01-191-1/+1
| | | | | case to do the right thing and affect exactly one column. This is consistent with GNU ps(1) in BSD mode, and POLA.
* When inserting a non-user-specified (e.g. not via -o or -O) format, don't dupejmallett2003-01-191-10/+22
| | | | | | | | 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>
* Use the MAC interface to list process MAC labels rather than usingrwatson2002-10-241-4/+2
| | | | | | | | | | 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
* Prevent ps(1) from doing idiotic munging of things in a -ofmt= string.jmallett2002-09-031-1/+8
| | | | God I hate the backwards compatability crap here.
* - Use (MAXLOGNAME - 1) where UT_NAMESIZE was used to be able torobert2002-07-081-2/+1
| | | | (-)remove the inclusions of <utmp.h>.
* Consistently use FBSDIDobrien2002-06-301-3/+2
|
* Don't try to decode old-style options if the argv[1] begins with `-' and thesobomax2002-06-201-10/+28
| | | | | | | | | | | | | second character represents some option taking an argument. This fixes problem when ps(1) is invoked for examply as follows: $ ps -Ufoobar1234 the above example results in option string being interpreted as -U foobarp1234 - note extra `p'. Reported by: Vladimir Sotnikov <vovan@kyivstar.net> MFC after: 2 weeks
* Use a global `now' variable for the current time, and initialise it atjmallett2002-06-061-0/+4
| | | | startup, right after calling setlocale(3).
* Widen the scope of fmt.c::1.19 and consistently use errx(3) if malloc(3) [orjmallett2002-06-051-6/+4
| | | | | | | | | | realloc(3)] happens to fail, everywhere in ps(1). Discussed with: bde, charnier (a while ago) fmt_argv() can no longer return NULL, so don't bother checking. Submitted by: bde
* Comma seperate format lists, since space is no longer up to the task.jmallett2002-06-051-6/+6
| | | | | Poked by: David Wolfskill <david@catwhisker.org> Pointy hat to: jmallett
* Respect setting of the COLUMNS environment variable (SUSv3)tjr2002-06-041-1/+4
|
* errx()/strerror() -> err()jedgar2002-04-071-2/+2
|
* Revert wchan functionality. Add 'mwchan' to supply new duel mutex/msleepdillon2002-02-211-1/+1
| | | | | | functionality and make it the default. With additional improvements by: Mark Peek <mp@FreeBSD.org>
* WARNS=4 fixes (incomplete, so set NO_WERROR), and lots of extramarkm2002-02-031-49/+47
| | | | cleanup courtesy of automatic checking (lint).
* o __P has been reovedimp2002-02-021-28/+19
| | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are.
* Remove a stray `:' after `v' in the getopt() call.ru2002-01-281-2/+2
| | | | Submitted by: bde
* GC the -W option. kvm(3) doesn't read swap for almost 10 years.ru2002-01-281-13/+7
| | | | | | PR: docs/34134 Reviewed by: bde, peter MFC after: 1 month
* Add missed includes.sobomax2002-01-151-0/+1
| | | | Reviewed by: md5
* Add LOMAC options (the "Z" flag in both cases) to display extra informationgreen2001-11-261-2/+8
| | | | | | in ls(1) and ps(1). Sponsored by: DARPA, NAI Labs
* Handle kvm_getprocs() returning nothing. Dont pass -1 to a sizepeter2001-08-241-1/+1
| | | | for malloc().
* Only capitalise the last `t' in ps's first argument when it'sbrian2001-08-161-1/+5
| | | | | | | actually part of an option argument. Submitted by: Chris Costello <chris@calldei.com> MFC after: 6 weeks
* Use PATH_MAX rather than MAXPATHLEN.imp2001-05-301-1/+1
|
* Depollute headers now that the VM headers DTRT.markm2001-05-031-1/+0
|
* Compensate for header dethreading.markm2001-05-011-0/+1
|
* The sess column went away last December with v1.26 of keyword.cbrian2001-04-071-1/+1
| | | | | | Remove it from ``jfmt''. Forgotten by: mckusick
* Small optimization: set use_ampm only when neededache2001-03-031-3/+0
|
* Use AM/PM time only when available in localeache2001-03-021-1/+4
|
* - Catch up to new proc flags.jhb2001-01-241-2/+2
|
* Change the proc information returned from the kernel so that itmckusick2000-12-121-22/+15
| | | | | | | | | | | | no longer contains kernel specific data structures, but rather only scalar values and structures that are already part of the kernel/user interface, specifically rusage and rtprio. It no longer contains proc, session, pcred, ucred, procsig, vmspace, pstats, mtx, sigiolst, klist, callout, pasleep, or mdproc. If any of these changed in size, ps, w, fstat, gcore, systat, and top would all stop working. The new structure has over 200 bytes of unassigned space for future values to be added, yet is nearly 100 bytes smaller per entry than the structure that it replaced.
OpenPOWER on IntegriCloud