History log of /src/bin/ps/ps.c |
Revision | | Date | Author | Comments |
1.98 |
| 13-Jul-2025 |
rillig | ps: remove unreachable break statement after return statement
No binary change.
|
1.97 |
| 14-Sep-2021 |
christos | use emalloc and friends, add ktrace flag printing.
|
1.96 |
| 04-Jun-2021 |
christos | use parsenum like everywhere else in the code.
|
1.95 |
| 04-Jun-2021 |
wiz | Sort options in usage.
|
1.94 |
| 04-Jun-2021 |
cjep | PR standards/11223
Add -G to take a single group argument heading towards POSIX.2 compliance. Patch from jperkin and reviewed by simonb.
|
1.93 |
| 15-Sep-2019 |
kamil | branches: 1.93.6; ps(1): Guard freeing the memory of pinfo with __NO_LEAKS.
No more leaks are detected by LSan/NetBSD as of the LLVM snapshot (clang10svn) from 2019-09-15.
|
1.92 |
| 11-Sep-2019 |
kamil | Plug memory leak in ps(1)
pinfo is allocated in setpinfo() with calloc(3).
Free it when no longer used, just before the program termination.
Detected with LSan.
|
1.91 |
| 11-Apr-2018 |
christos | branches: 1.91.2; kvm_geterr() already contains errno, use errx.
|
1.90 |
| 11-Apr-2018 |
christos | use EXIT_FAILURE instead of 1
|
1.89 |
| 12-Jan-2018 |
kamil | branches: 1.89.2; Fix an unitialized memory read bug in ps(1)
rawcpu of type int, is declared inside main(){} and it can be passed as uninitialized to setpinfo(). The setpinfo() function has a switch checking the value of rawcpu:
if (!rawcpu) pi[i].pcpu /= 1.0 - exp(ki[i].p_swtime * log_ccpu);
rawcpu is set to 1 with the command line argument "-C".
-C Change the way the CPU percentage is calculated by using a "raw" CPU calculation that ignores "resident" time (this normally has no effect).
Bug reproducible with an invocation: "ps u". It hides with "ps uC".
Initialize rawcpu by default to 0, before the getopt(3) machinery.
Detected with MSan running on NetBSD/amd64.
Sponsored by <The NetBSD Foundation>
|
1.88 |
| 26-Dec-2016 |
rin | branches: 1.88.6; simplify logic; there must be no CPU usage when p_swtime is zero
|
1.87 |
| 02-Dec-2016 |
christos | provide a tree like display with -d, from FreeBSD
|
1.86 |
| 28-Nov-2016 |
rin | Calculate CPU usage (pcpu) once per process if it is required. This change significantly improves performance for slow machines when output is sorted by pcpu.
ok martin
|
1.85 |
| 28-Nov-2016 |
rin | KNF ok martin
|
1.84 |
| 05-Sep-2016 |
sevan | Drop main() prototype.
|
1.83 |
| 16-Jun-2015 |
christos | branches: 1.83.2; remove \n from error messages
|
1.82 |
| 28-Jun-2014 |
dholland | Don't print junk errnos. Avoids: % ps -tfoo ps: /dev/ttyfoo: Undefined error: 0 Exit 1
|
1.81 |
| 20-Apr-2014 |
dholland | Don't bother using variables whose value is never changed from the initialization value.
|
1.80 |
| 19-Feb-2014 |
dsl | branches: 1.80.2; Remove some pointless inclusions os sys/user.h
|
1.79 |
| 15-Jan-2014 |
mlelstv | Make ps -s use LTIME instead of TIME in the default output format.
|
1.78 |
| 07-May-2012 |
joerg | branches: 1.78.2; Push logic to convert a ttyname to a device number into its own function. Improve dealing with ptyfs by explicitly handling missing pts/%d entries, if the kernel supports the pts device (PR 40813).
|
1.77 |
| 15-Apr-2012 |
wiz | Choose better argument name for `-U' (sync with man page). From Bug Hunting in email.
|
1.76 |
| 29-Aug-2011 |
joerg | branches: 1.76.2; 1.76.4; Use __dead
|
1.75 |
| 31-May-2010 |
rmind | Fix ps(1) and top(1) to show reasonable CPU numbers i.e. cpu_index() provided by the kernel, instead of CPU order number, which is generally random.
|
1.74 |
| 29-Mar-2009 |
mrg | - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total address space available to processes. this limit exists in most other modern unix variants, and like most of them, our defaults are unlimited. remove the old mmap / rlimit.datasize hack.
- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers. it is currently unused, but was added a few years ago.
- add a pair of new process size values to kinfo_proc2{}. one is the total size of the process memory map, and the other is the total size adjusted for unused stack space (since most processes have a lot of this...)
- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias RLIMIT_VMEM was already present and used if availble.)
- patch ps, top and systat to notice the new k_vm_vsize member of kinfo_proc2{}.
- update irix, svr4, svr4_32, linux and osf1 emulations to support this information. (freebsd could be done, but that it's best left as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values, which have never been entirely correct (since mmap), and have been very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially chuq and yamt for critical suggestions that lead to this patch not having a special ugliness i wasn't happy with anyway :-)
|
1.73 |
| 14-Feb-2009 |
lukem | fix -Wsign-compare issues
|
1.72 |
| 28-Dec-2008 |
christos | branches: 1.72.2; fix dev_t 64 bit issues.
|
1.71 |
| 26-Sep-2008 |
wiz | branches: 1.71.4; Sync usage with man page.
|
1.70 |
| 26-Sep-2008 |
apb | Add "ps -A" option. This displays information about all processes, like BSD "ps -ax" or SYSV "ps -ef". It's specified in SUSv3.
Also make some minor clarifications to the man page.
|
1.69 |
| 20-Jul-2008 |
lukem | Remove the \n and tabs from the __COPYRIGHT() strings.
|
1.68 |
| 26-May-2008 |
christos | PR/38755: murray armfield: /bin posix programs missing setprogname and/or setlocale
|
1.67 |
| 28-Apr-2008 |
martin | branches: 1.67.2; Remove clause 3 and 4 from TNF licenses
|
1.66 |
| 10-Mar-2008 |
dholland | branches: 1.66.2; ps -t? needs to imply -x. Otherwise the non-x logic filters all the results out. Thanks to der Mouse for prompting me to fix it...
|
1.65 |
| 10-Feb-2008 |
christos | branches: 1.65.2; Add a CPUID keyword; idea and some of the code from Anon Ymous
|
1.64 |
| 24-Oct-2007 |
yamt | make -s alter the default format rather than doing parsefmt. it allows users to use -o to replace it later.
|
1.63 |
| 17-Feb-2007 |
pavel | branches: 1.63.4; Revert the changes done after newlock2 merge, except for the removal of the now unused LSDEAD state. The current kernel headers are now source-compatible with pre-newlock2 kernel headers again.
Approved by Andrew Doran.
|
1.62 |
| 09-Feb-2007 |
ad | Sync with kernel changes introduced by merging the newlock2 branch.
|
1.61 |
| 02-Oct-2006 |
apb | * When all columns are given null customised headers, the blank header line is not printed at all. This is specified in P1003.1-2004 (SUSv3), and is useful.
* Customised headers may contain embedded space, commas and equals signs. To specify multiple customised headers, use multiple -o or -O options. This is specified (for "-o", not for "-O") in P1003.1-2004 (SUSv3), and is useful.
* When a column is given a null (blank) customised header, it keeps its default minimum width. This is specified in P1003.1-2004 (SUSv3), and seems harmless.
* Fix a bug that made it impossible to print the same keyword multiple times, with different customised headers each time. (Previously, the last customised header was used for all instances of the keyword.)
* Make the behaviour of "-O" more useful. The first -O option adds the default keywords only if there have not yet been any formatting options, and multiple -O options now insert their keywords in adjacent positions. Now {ps -j -O %cpu} is like {ps -j} with one extra column; Previously, it would have had all the columns implied by "-j", plus all the default columns, plus the extra column specified by "-O".
* Convert from home-grown linked lists to SIMPLEQ lists.
Discussed in tech-userlevel.
|
1.60 |
| 02-Sep-2006 |
christos | factor out the code that does numeric parsing into a function and check for errors properly.
|
1.59 |
| 26-Jun-2005 |
christos | sprinkle a little const, and now everything compiles with WARNS=3
|
1.58 |
| 01-Jun-2005 |
lukem | appease gcc -Wuninitialized
|
1.57 |
| 11-Feb-2005 |
christos | allow -t ttyp0 -t p0 -t /dev/ttyp0 -t /dev/pts/0
|
1.56 |
| 29-Nov-2004 |
atatat | Make ps understand "-tpts/4" by assuming that ptyfs is mounted on /dev/pts and that the '/' immediately preceding the digits does not need a 'p' in front of it (ick, kludge_oldps_options()).
|
1.55 |
| 29-Oct-2004 |
dsl | Add (unsigned char) cast to ctype function
|
1.54 |
| 27-Mar-2004 |
simonb | #define<TAB>
|
1.53 |
| 27-Mar-2004 |
simonb | Wrap some long lines. Consisently use (void) in front of printf(...); A few more white-space nits.
|
1.52 |
| 27-Mar-2004 |
simonb | KNF, ANSFify, de-__P, unC++ify, white space nits.
|
1.51 |
| 11-Jan-2004 |
jdolecek | g/c SDEAD
|
1.50 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
1.49 |
| 06-Mar-2003 |
dsl | - 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 - use PRId64 to remove some long long casts - use kvm_openfiles(NULL, NULL, NULL, KVN_NO_FILES, ..) unless core file specified (approved by christos)
|
1.48 |
| 18-Jan-2003 |
thorpej | Merge the nathanw_sa branch.
|
1.47 |
| 19-Jun-2002 |
jdolecek | g/c procfs fallback code, it's redundant now that we use sysctl to get process info
|
1.46 |
| 20-Dec-2001 |
soren | branches: 1.46.2; Sync getopt() / man page with actual getopt options.
|
1.45 |
| 03-Nov-2001 |
lukem | fix minor WARNS=2
|
1.44 |
| 30-Jul-2001 |
wiz | Remove duplicate `if'. Noted by Geoff C. Wing in bin/13551.
|
1.43 |
| 20-Jul-2001 |
matt | Add a small optimizetion in savevars(). break out of the loop once needcomm is set since setting it multiple times only wastes cpu time.
|
1.42 |
| 14-Jun-2001 |
cyber | If there were no processes to list, it meant that our criteria failed and didnt match anything. Dont make our caller think we succeeded.
|
1.41 |
| 16-Jun-2000 |
simonb | Don't check namelist when choosing to use the sysctl interface.
|
1.40 |
| 08-Jun-2000 |
simonb | 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.
|
1.39 |
| 07-Jun-2000 |
simonb | 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.
|
1.38 |
| 26-May-2000 |
simonb | branches: 1.38.2; 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.
|
1.37 |
| 29-Apr-2000 |
abs | 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.
|
1.36 |
| 15-Apr-2000 |
simonb | 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.
|
1.35 |
| 10-Apr-2000 |
chs | make -M imply -K. the current system is not likely to be a reasonable approximation of a crash dump.
|
1.34 |
| 04-Dec-1999 |
hubertf | Document -U switch (displays processes belonging to given user/uid). Reported in PR 8943 by WL <wliao@dura.spc.uchicago.edu>
|
1.33 |
| 03-Dec-1999 |
simonb | "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.
|
1.32 |
| 09-Nov-1999 |
drochner | 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.
|
1.31 |
| 15-Oct-1999 |
jdolecek | 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
|
1.30 |
| 15-Oct-1999 |
jdolecek | 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
|
1.29 |
| 15-Oct-1999 |
jdolecek | 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.
|
1.28 |
| 27-Mar-1999 |
bgrayson | branches: 1.28.2; 1.28.4; 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.
|
1.27 |
| 26-Mar-1999 |
bgrayson | 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.
|
1.26 |
| 04-Jan-1999 |
kim | Fixed segfaulting for "ps -T". There is no optarg with -T, so instructions under label "tty:" need to use ttname instead.
|
1.25 |
| 28-Jul-1998 |
mycroft | Add a -U option to select by user/uid.
|
1.24 |
| 28-Jul-1998 |
mycroft | Be more retentive about use of NOTREACHED and noreturn.
|
1.23 |
| 28-Jul-1998 |
mycroft | Delint.
|
1.22 |
| 27-Jul-1998 |
mycroft | __AUDIT__ cleanup.
|
1.21 |
| 06-Jul-1998 |
mrg | - 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
|
1.20 |
| 14-Sep-1997 |
lukem | getopt returns -1 not EOF cleanup manpage
|
1.19 |
| 20-Jul-1997 |
christos | Fix compiler warnings Add WARNS=1
|
1.18 |
| 21-Apr-1997 |
mrg | note that strcpy is safe.
|
1.17 |
| 28-Feb-1997 |
pk | Message buffer passed to kvm_openfiles() should _POSIX2_LINE_MAX long; PR#3266
|
1.16 |
| 27-Sep-1996 |
thorpej | Fix SEGV when kludging old-style options. From Greg Stark <gsstark@mit.edu>, PR #2550.
|
1.15 |
| 18-May-1995 |
mycroft | Create and strvis(3) the argument and environment lists only as needed. Do not keep extra copies around.
|
1.14 |
| 18-May-1995 |
mycroft | Gather the argument and environment lists when we actually want to print them.
|
1.13 |
| 21-Mar-1995 |
cgd | convert to new RCS id conventions.
|
1.12 |
| 16-Sep-1994 |
mycroft | Integrate `-c' option, from Arne Juul.
|
1.11 |
| 09-May-1994 |
cgd | clean up import
|
1.10 |
| 05-May-1994 |
cgd | update for changed flags
|
1.9 |
| 07-Oct-1993 |
cgd | fix from Thomas Eberhardt <thomas@mathematik.uni-Bremen.de>: don't try to display the resident text size; we can't do that anymore
|
1.8 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
1.7 |
| 19-Jul-1993 |
cgd | branches: 1.7.2; 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.
|
1.6 |
| 11-Jul-1993 |
cgd | fix alien 'w' handling. you really don't want to know...
|
1.5 |
| 01-Jun-1993 |
cgd | add support and documentation for the 'e' option, to print out the process environment.
|
1.4 |
| 23-Mar-1993 |
cgd | changed "Id" to "Header" for rcsids
|
1.3 |
| 22-Mar-1993 |
cgd | added rcs ids to all files
|
1.2 |
| 21-Mar-1993 |
cgd | after 0.2.2 "stable" patches applied
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.2 |
| 09-May-1994 |
cgd | new ps, to match libkvm
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.7.2.2 |
| 19-Jul-1993 |
cgd | 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.
|
1.7.2.1 |
| 19-Jul-1993 |
cgd | file ps.c was added on branch netbsd-0-9 on 1993-07-19 11:02:11 +0000
|
1.28.4.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.28.2.2 |
| 22-May-2000 |
he | Pull up revision 1.37 (requested by abs): Only check the terminal size via STDOUT, not STDERR or STDIN.
|
1.28.2.1 |
| 08-Nov-1999 |
cgd | pull up revs 1.29-1.31 from trunk (requested by jdolecek): When using the procfs for extracting process information, extract process start time, arguments, and session leadership status. Also, fall back to procfs when kvm_openfiles() completely fails (e.g. when /dev/mem is not readable). Fixes PR#7772.
|
1.38.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.46.2.11 |
| 12-Nov-2002 |
nathanw | Catch up to -current.
|
1.46.2.10 |
| 24-Oct-2002 |
nathanw | Small typo fix.
Treat SSTOP and SACTIVE the same way in pick_representative_lwp(), and include LSSTOP in the state hierarchy.
|
1.46.2.9 |
| 26-Jul-2002 |
nathanw | Consider LWPs in LSSUSPENDED as a worst-case for a representative LWP.
|
1.46.2.8 |
| 06-Jun-2002 |
nathanw | Use the real process state when picking a representative LWP, not the old-style state that was faked up for us by sysctl.
|
1.46.2.7 |
| 02-May-2002 |
nathanw | Don't puke on zero-LWP processes (zombies).
|
1.46.2.6 |
| 24-Apr-2002 |
nathanw | Note the presense of multiple LWPs or scheduler activations under "state". Add a "lstate" that prints LWP-specific state and display it instead of "state" under ps -s.
|
1.46.2.5 |
| 23-Apr-2002 |
wrstuden | Add -s to synopsis.
|
1.46.2.4 |
| 23-Apr-2002 |
nathanw | Don't need to free the kinfo_lwp pointer; libkvm does that.
|
1.46.2.3 |
| 23-Apr-2002 |
nathanw | Don't shadow global symbol "sleep".
|
1.46.2.2 |
| 23-Apr-2002 |
nathanw | Add support for handling multi-LWP processes by selecting one LWP as "representative" of the process. Also add a -s option that prints a line for each LWP. While I'm here, remove the /proc fallback code.
|
1.46.2.1 |
| 20-Dec-2001 |
nathanw | file ps.c was added on branch nathanw_sa on 2002-04-23 20:41:14 +0000
|
1.63.4.2 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.63.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.65.2.1 |
| 24-Mar-2008 |
keiichi | sync with head.
|
1.66.2.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.66.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.67.2.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.67.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.71.4.1 |
| 01-Apr-2009 |
snj | Pull up following revision(s) (requested by mrg in ticket #622): bin/csh/csh.1: revision 1.46 bin/csh/func.c: revision 1.37 bin/ps/print.c: revision 1.111 bin/ps/ps.c: revision 1.74 bin/sh/miscbltin.c: revision 1.38 bin/sh/sh.1: revision 1.92 via patch external/bsd/top/dist/machine/m_netbsd.c: revision 1.7 lib/libkvm/kvm_proc.c: revision 1.82 sys/arch/mips/mips/cpu_exec.c: revision 1.55 sys/compat/darwin/darwin_exec.c: revision 1.57 sys/compat/ibcs2/ibcs2_exec.c: revision 1.73 sys/compat/irix/irix_resource.c: revision 1.15 sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16 sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12 sys/compat/linux/common/linux_limit.h: revision 1.5 sys/compat/osf1/osf1_resource.c: revision 1.14 sys/compat/svr4/svr4_resource.c: revision 1.18 sys/compat/svr4_32/svr4_32_resource.c: revision 1.17 sys/kern/exec_subr.c: revision 1.62 sys/kern/init_sysctl.c: revision 1.160 sys/kern/kern_exec.c: revision 1.288 sys/kern/kern_resource.c: revision 1.151 sys/sys/param.h: patch sys/sys/resource.h: revision 1.31 sys/sys/sysctl.h: revision 1.184 sys/uvm/uvm_extern.h: revision 1.153 sys/uvm/uvm_glue.c: revision 1.136 sys/uvm/uvm_mmap.c: revision 1.128 usr.bin/systat/ps.c: revision 1.32 - - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total address space available to processes. this limit exists in most other modern unix variants, and like most of them, our defaults are unlimited. remove the old mmap / rlimit.datasize hack. - - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers. it is currently unused, but was added a few years ago. - - add a pair of new process size values to kinfo_proc2{}. one is the total size of the process memory map, and the other is the total size adjusted for unused stack space (since most processes have a lot of this...) - - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias RLIMIT_VMEM was already present and used if availble.) - - patch ps, top and systat to notice the new k_vm_vsize member of kinfo_proc2{}. - - update irix, svr4, svr4_32, linux and osf1 emulations to support this information. (freebsd could be done, but that it's best left as part of the full-update of compat/freebsd.) this addresses PR 7897. it also gives correct memory usage values, which have never been entirely correct (since mmap), and have been very incorrect since jemalloc() was enabled. tested on i386 and sparc64, build tested on several other platforms. thanks to many folks for feedback and testing but most espcially chuq and yamt for critical suggestions that lead to this patch not having a special ugliness i wasn't happy with anyway :-)
|
1.72.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
1.76.4.1 |
| 24-Jun-2012 |
riz | Pull up following revision(s) (requested by dholland in ticket #355): bin/ps/ps.c: revision 1.78 Push logic to convert a ttyname to a device number into its own function. Improve dealing with ptyfs by explicitly handling missing pts/%d entries, if the kernel supports the pts device (PR 40813).
|
1.76.2.3 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.76.2.2 |
| 23-May-2012 |
yamt | sync with head.
|
1.76.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.78.2.1 |
| 19-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.80.2.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.83.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.88.6.1 |
| 03-Feb-2018 |
snj | Pull up following revision(s) (requested by kamil in ticket #515): bin/ps/ps.c: revision 1.89 Fix an unitialized memory read bug in ps(1) rawcpu of type int, is declared inside main(){} and it can be passed as uninitialized to setpinfo(). The setpinfo() function has a switch checking the value of rawcpu: if (!rawcpu) pi[i].pcpu /= 1.0 - exp(ki[i].p_swtime * log_ccpu); rawcpu is set to 1 with the command line argument "-C". -C Change the way the CPU percentage is calculated by using a "raw" CPU calculation that ignores "resident" time (this normally has no effect). Bug reproducible with an invocation: "ps u". It hides with "ps uC". Initialize rawcpu by default to 0, before the getopt(3) machinery. Detected with MSan running on NetBSD/amd64. Sponsored by <The NetBSD Foundation>
|
1.89.2.1 |
| 16-Apr-2018 |
pgoyette | Sync with HEAD, resolve some conflicts
|
1.91.2.3 |
| 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.91.2.2 |
| 21-Apr-2020 |
martin | Sync with HEAD
|
1.91.2.1 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.93.6.1 |
| 06-Jun-2021 |
cjep | sync with head
|