Commit Graph

310 Commits

Author SHA1 Message Date
wiz 21f891a499 Bump date for previous. Remove/replace bogus Tn uses. 2017-08-28 05:57:37 +00:00
kamil a69b333e73 Remove the filesystem tracing feature
This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
 - /proc/#/ctl from mount_procfs(8)
 - P_FSTRACE note from the documentation of ps(1)
 - /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
 - KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
 - source code file miscfs/procfs/procfs_ctl.c
 - PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
 - KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
 - PSL_FSTRACE (0x00010000) from sys/sys/proc.h
 - P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed
PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).

Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>
2017-08-28 00:46:06 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
rin f637bb05bd simplify logic; there must be no CPU usage when p_swtime is zero 2016-12-26 20:52:39 +00:00
christos 6721aabc1e Handle functions that use the offset from either kinfo_proc2/kinfo_lwp properly. 2016-12-12 20:35:36 +00:00
christos 5a6cfab10a provide a tree like display with -d, from FreeBSD 2016-12-02 21:59:03 +00:00
rin cc1877ba3a 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
2016-11-28 08:21:10 +00:00
rin b095bb75a7 for donlist{,_sysctl}:
- obtain log_ccpu = log(ccpu) rather than ccpu itself
- use common default values and warn users appropriately when errors occur
ok martin
2016-11-28 08:19:23 +00:00
rin 078edf9ccc KNF
ok martin
2016-11-28 08:18:27 +00:00
sevan 51fe790c4c Drop main() prototype. 2016-09-05 01:00:07 +00:00
sevan 0b822dfa9c Earliest reference in the TUHS archive is v3
Unfortunately only the source code for the compiler is present for that
release. The v2 archive is missing the manuals & only contains a some of the
commands.
Switch to v3 and reference manual category eight, as per r1.32 of
src/bin/ps/ps.1 from OpenBSD.
Heads up from Ingo Schwarze.
2016-08-10 22:00:56 +00:00
sevan abc56c017d Document the version ps first appeared. 2016-08-10 18:44:50 +00:00
christos 7da746ab02 remove \n from error messages 2015-06-16 22:31:08 +00:00
joerg 0bab8dfecf Use l_wmesg if the string is not empty. Don't bother checking l_name for
nullness.
2014-11-15 01:58:34 +00:00
dholland f86ebf3938 Don't print junk errnos. Avoids:
% ps -tfoo
  ps: /dev/ttyfoo: Undefined error: 0
  Exit 1
2014-06-28 17:32:27 +00:00
dholland a468ec4988 Don't bother using variables whose value is never changed from the
initialization value.
2014-04-20 23:31:40 +00:00
dholland 4e3b1a0bd4 Use an enum type for PRINTMODE vs. WIDTHMODE. Compiler output diffs have
been checked.
2014-04-20 22:48:59 +00:00
dsl dc210c7fbd Remove some pointless inclusions os sys/user.h 2014-02-19 20:42:14 +00:00
wiz 2161b7b1e3 Bump date for previous. 2014-01-15 09:24:31 +00:00
mlelstv 067314c61e Make ps -s use LTIME instead of TIME in the default output format. 2014-01-15 08:09:10 +00:00
mlelstv b3dffa81d5 Add an LTIME column that prints lwp cputime. 2014-01-15 08:07:53 +00:00
joerg 1907ec3a61 Switch device database to cdb(5). Rework ttyname(3) and ttyname_r(3) to
depend on new devname_r(3) as heart. Add /dev/pts magic directly to
devname(3). While it can lead to returning non-existing paths, the
behavior is more consistent that way. Drop caching layer in devname(3),
it doesn't buy anything for the common case of having access to the
database. Teach devname(3) proper fallback behavior of scanning /dev.
Create both old-style and new-style database for now in /etc/rc.d/sysdb.
2012-06-03 21:42:44 +00:00
joerg 763e57918f 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).
2012-05-07 13:14:31 +00:00
wiz d1cbb54293 Increase width of table column so it formats more nicely. 2012-04-15 21:20:16 +00:00
wiz 623d7ac414 Choose better argument name for `-U' (sync with man page).
From Bug Hunting in email.
2012-04-15 18:10:13 +00:00
wiz 463d14b148 - choose better argument name for `-U';
- add argument names for options in man page;
- improve wording, punctuation, capitalization.

From Bug Hunting in email.
2012-04-15 18:09:50 +00:00
matt da4f7877a7 Use C89 function definitions 2012-03-20 18:42:28 +00:00
wiz 7fd6e7037d Remove trailing whitespace. 2012-03-15 15:49:59 +00:00
christos 21ae83057a Fix obsolete example (that referred to letters in process state that are
not set anymore), and clarify their meaning.
2012-03-15 15:43:43 +00:00
dholland cc236b866a The 'lstart' column uses strftime %c, not %C. Noted by mrg. 2012-02-23 21:54:28 +00:00
wiz 6b6a89aacb Remove unused variable.
From cppcheck via Henning Petersen in PR 46002.
2012-02-13 12:55:28 +00:00
dholland 145f9b8221 Minor English improvements for -w, partly from Snader_LB. 2012-01-27 05:59:17 +00:00
joerg 5bb1ddccc2 Use __dead 2011-08-29 14:51:17 +00:00
christos fe8677c354 Document non-literal formats 2011-08-14 10:53:16 +00:00
dholland e9b3916bd6 When converting from pages to kilobytes, cast the return value of
getpagesize() to size_t. For some reason getpagesize() is defined to
return int, and several of the page counts we get come back from the
kernel as int32_t; in LP64 without the cast the byte count will be
computed in a 32-bit value and for large processes will overflow and
become negative... and then remain negative when divided by 1024 to
convert to kilobytes.

Fixes a problem I hit the other day where I saw negative RSS, which
turns out also to be PR 40642.

Note: other logic in here will break down when we first get >2TB
processes... and int32 page counts will break on >8TB processes. But
hopefully we won't see any of that for a few years yet.
2011-06-13 03:42:15 +00:00
dholland f2815da66c fix typo, from Randolf Richardson in PR 44559 2011-02-13 08:34:00 +00:00
christos da9c1e1b4d fix previous. 2011-01-22 21:09:51 +00:00
christos 055b26bb55 Make printing of lwp flags similar to the process one, identifying (O)nproc
(K)ernel threads and scheduler (a)ctivations.
2011-01-22 20:55:58 +00:00
njoly c45af2045a Do not check pcpu value against 100.0 but rather 99.95, to properly
deal with value rounding. From apb@.
2010-07-28 17:39:54 +00:00
njoly 0697f9d213 Make %cpu drop the decimal part when reaching 100%, to stay in the 5
expected columns.
2010-07-27 12:40:48 +00:00
rmind 8b95f823bf 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.
2010-05-31 03:18:33 +00:00
joerg a6a5384f08 Don't break lines in .It, there be dragons in groff. 2010-05-14 17:37:06 +00:00
joerg 26590112cf Use .In instead of .Aq Pa for header files 2010-03-22 18:35:09 +00:00
wiz 467a0fa1ae Bump date for uarea swap-out removal. 2009-10-21 22:18:37 +00:00
rmind 40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
wiz 27ce49cc21 Bump date for previous. 2009-08-03 22:22:10 +00:00
dsl 666a334b2e Remove reference to P_SYSTRACE.
Fixes PR/41426
(leave defn in sys/sysctl.h since the bit shouldn't be reused!)
2009-08-03 20:00:39 +00:00
mrg fcc023545e - 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 :-)
2009-03-29 01:02:48 +00:00
joerg ddf187c649 Fix number of columns in .Bl. Escape %C. 2009-03-13 11:13:46 +00:00
lukem 990d25a96c fix -Wsign-compare issues 2009-02-14 08:02:04 +00:00