summaryrefslogtreecommitdiff
path: root/bin/ps/ps.c
AgeCommit message (Collapse)Author
2019-03-24detect -t argument being too long, rather than truncatingTheo de Raadt
2019-02-05Let ps(1) work in single user mode where /var/run does not exist.Florian Obser
Give the same treatment if /dev doesn't exist. While things will be real interesting without /dev there is no reason to stop ps(1). Fix suggested by & OK deraadt OK millert
2018-09-16Use uid_from_user(3) and gid_from_group(3) in utilities thatTodd C. Miller
do repeated lookups. OK tb@
2018-08-08unveil dev.db "r" for devname(), /dev "r", and in the non-sysctl caseTheo de Raadt
some kernel memory/symbol files.
2016-09-23Attempt to use stdout, stderr, or stdin terminal widths if they exist.Anthony J. Bentley
This behavior already existed but was unintentionally lost in revision 1.70 of ps.c. ok millert@ tb@
2016-03-17Switch (non-curses, non-ksh) programs that use COLUMNS to a single idiom.Anthony J. Bentley
Previously behaviors were all over the map. This changes them to use COLUMNS first, and either terminal width or a hardcoded value (typically 80) as appropriate. ok deraadt@; man bits ok jmc@
2016-01-10UTF-8 support:Ingo Schwarze
In a UTF-8 locale, columnate correctly and replace valid, but non- printable characters with the Unicode replacement character U+FFFD. No change in the C/POSIX locale, and no change for invalid bytes. Grand total, the code becomes shorter by almost 30 lines. Feedback from czarkoff@, OK millert@.
2015-11-11fix pledge error messageTheo de Raadt
2015-10-25need "getpw" pledge; spotted by matthieuTheo de Raadt
2015-10-23With new pledge "ps" and "vminfo" requests, ps/top/w become possible.Theo de Raadt
2015-06-29After removing the p_swtime from the kernel, ps always printed 0.0Alexander Bluhm
as %cpu time. Remove the calculation in ps that includes the process lifetime. Just print the p_pctcpu value, that was done before when ps was called with -C. Keep -C as a no-op for existing scripts. OK millert@
2015-04-09kflag and wflag don't need to be counters; wflag only needs to know ifOkan Demirmen
greater than 0 for its one test case. ok deraadt
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-07-08sys/user.h can now be substantially gutted.Theo de Raadt
ok guenther
2014-06-05Add support for COLUMNS env variable, inspired by FreeBSD but with a dashPhilip Guenther
of strtonum() from millert@ sprinkled on top. Also, we've always supported TZ for formatting dates, so say so. ok jmc@ millert@
2014-05-07convert calloc to use reallocarray instead. ok millertTed Unangst
2013-11-21add unsigned char casts for specific calls to ctype.h macros.Theo de Raadt
ok guenther step
2013-10-31pull in less .h to do the sameTheo de Raadt
2013-10-28add -A (-ax) support; from Lauri Tirkkonen with some option sorting.Okan Demirmen
ok guenther@ jmc@
2013-09-22Stop merging the per-thread and per-process flags when reportingPhilip Guenther
them via sysctl(KERN_PROC). In struct kinfo_proc the per-process flags move to p_psflags, leaving the per-thread flags in p_flags. Flag descriptions in ps(1) updated to be less obtuse. discussed with matthew@ some time ago; ok jca@, manpage bits ok jmc@
2012-04-21Remove a check made superfluous by the KERN_PROC_SHOW_THREADS flag.Philip Guenthe
This lets new binaries work (at least w/o the -H option) with old kernels. ok pirofti@ deraadt@
2012-04-17Make it optional for kvm_getprocs() (and related sysctl) to returnPaul Irofti
thread information. Add a KERN_PROC_SHOW_THREADS flag that has to be set in order to get the thread info and make it off by default. This creates backwards compatibility for applications that relied on a given size/number of items to be returned. Modify ps(1) and top(1) accordingly. Okay guenther@.
2012-04-12Add per thread accounting, mainly for usage & friends.Paul Irofti
This expands the already bloated FILL_KPROC macro to take an extra parameter that indicates if the callee is a thread or a process. The userland bits are adjusted accordingly and ps(1) and top(1) now display per thread usage times when -H is used. Also pkill(1) had to be adjusted so that duplicates don't pop up. libkvm does basically the same thing as the kernel bits. Okay guenther@.
2012-04-04Add "tid" as a formatting keyword. If the -H option is specified, includeJoel Sing
the thread ID in the default format. ok deraadt@ sthen@
2011-10-13Remove support for systems that lack CPUs. (i.e., stop looking upPhilip Guenthe
HW_NCPU when the only test was whether it's non-zero) ok millert@
2011-09-25Add -H option to show rthreads, hiding them by defaultPhilip Guenthe
Diff from uwe@
2011-04-10Switch back from KERN_PROC2/kinfo_proc2 to KERN_PROC/kinfo_proc nowPhilip Guenthe
that we've got name we want for the API we want "ZAP!" deraadt@
2010-07-02ps uses libkvm, so it doesn't need its own copy of the "get process infoPhilip Guenthe
via sysctl" logic. ok millert@
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2008-07-18remove unnessasary cast.Kevin Lo
ok millert@
2008-03-08Instead of calling donlist() in the format print routines, call itTodd C. Miller
a single time before we print anything, if needed. Uses a flag to specify which formats need the kernel info donlist() provides. OK deraadt@
2007-12-28printf field widths are always int, so add a cast to removeCharles Longeau
"warning: field width is not type int" "looks good" otto@
2007-09-01malloc(n * m) -> calloc(n, m); from zinovikTheo de Raadt
2006-11-01simplify synopsis and sync usage();Jason McIntyre
2006-04-25various small lint cleanups; ok ottoTheo de Raadt
2004-11-24on MP machines, in STAT field, add /# where # is the cpu number so thatTheo de Raadt
you can see processes move around; ok pval millert
2004-09-14remove unused variableTheo de Raadt
2004-02-24- `C' before `c'Jason McIntyre
- replace `<' and `>' - sync usage()
2004-02-08'ps' should not act like 'ps a'. Resolves PR 3676.Otto Moerbeek
ok tdeval@ millert@
2004-02-04(uid_t) -1 is a valid uid, so do not use it as a flag.Otto Moerbeek
From Joris Vink <nimadeus at pandora dot be> with tweaks from me. ok tdeval@ hshoexer@ henning@
2004-01-08Convert to kinfo_proc2. The sort order for -u and -m will be differentTodd C. Miller
due to a bug fix in the sort routine.
2003-07-29spacingTheo de Raadt
2003-06-11ansification, art okTheo de Raadt
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-04-15mix of tdeval and my string cleaningTheo de Raadt
2002-06-12unused variableArtur Grabowski
2002-06-09Fix the start time on sysctl kvm.Artur Grabowski
2002-06-08Use KVM_NO_FILES and remove the setgid.Artur Grabowski
2002-04-06Fix a typo and sync usage() with man page; Brian PooleTodd C. Miller
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.