Commit Graph

69 Commits

Author SHA1 Message Date
mrg 9ded70a5ef expand a buffer size to properly handle full-size 64 bit values 2019-10-13 07:42:27 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
christos a45df3f4cb simplify and explain 2019-04-27 14:10:01 +00:00
christos 260d5f320c for "countable" lwp names, try to display name*<count> instead of truncating. 2019-04-26 19:39:19 +00:00
maya 79176afac1 Fix typo s/fron/from/
From dfive on freenode, thanks!
2018-11-05 17:44:09 +00:00
kre d4305dc776 sysctl(KERN_BOPOTIME) started returning a struct timespec in 2009.
Update to match....    We're slow but we get there eventually!

NFC for any of these programs, struct timeval and struct timespec
are the same size, and only the tv_sec field of boottime is used,
and that's unchanged.
2018-10-30 21:15:09 +00:00
sevan 1ff6a451ed Document the WCPU field. 2018-08-26 21:31:34 +00:00
snj 3120750dcb rats in my attic, mice in my top. i've had enough of these damn rodents. 2018-06-06 02:12:47 +00:00
eadler 94ea5fdc4c top(1): revert 1.11
This change breaks the expectations of users that would like a coredump
of top(1). Other similar applications such as vmstat(1) don't do this.
Since the change was just a courtesy, revert.
2018-06-03 05:29:27 +00:00
eadler 6aed99669b top(1): chdir to / at init
This allows us to unmount whatever directory we happen to be in when we
started top(1).

ok phone
2018-06-02 22:30:19 +00:00
kamil ea3d16d0e0 Fix read of unitialized array elements in top(1)
The cp_old array is allocated with malloc(3) and its pointer is passed to
percentages64().

In this function there happens a calculation of total_change, which value
depends on the value inside the unitialized cp_old[] array.

==26662==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x268a2c in percentages64 /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6
#1 0x26748b in get_system_info /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:478:6
#2 0x25518e in do_display /usr/src/external/bsd/top/bin/../dist/top.c:507:5
#3 0x253038 in main /usr/src/external/bsd/top/bin/../dist/top.c:975:2
#4 0x21cad1 in ___start (/usr/bin/top+0x1cad1)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6 in percentages64
Exiting

Fix this issue by changling malloc(3) with calloc(3).

Detected with Memory Sanitizer during the integration of sanitizers with
the NetBSD basesystem.

Reported by <Yang Zheng>
2018-05-31 10:14:21 +00:00
kamil 3ff7937744 Fix unitialized signal mask passed to sigaction(2) in top(1)
Detected with Memory Sanitizer during the integration of sanitizers with
the NetBSD basesystem.

Reported by <Yang Zheng>
2018-05-31 09:20:05 +00:00
sevan cc576e1d8e Update supporting files for components which rely on autoconf to allow systems
introducing since release of software to be recognised. This should hopefully
allow the builds to progress a littles further on systems such as the POWER8
which features a little endian 64-bit PowerPC CPU identified as ppc64le.
2017-02-01 09:26:39 +00:00
abhinav e74c9f1425 Fix couple of typos:
s/summay/summary
	s/highligting/highlighting
2017-01-12 18:37:09 +00:00
leot 98fbbaab51 Document the `p' command in "interactive mode" that filters processes by pid.
While here add date to the `.TH' macro 3rd argument.

Reviewed by and thanks to <wiz>
2016-12-28 18:16:30 +00:00
leot 2b0c6991fb Implement the `c' command in "interactive mode" that displays only commands
that match a specified string.

Reviewed by and thanks to <Riastradh>
2016-12-26 12:46:31 +00:00
dholland 0ca1e3e00e Be more careful/explicit with FP rounding when converting floating time
to timeval. Also, don't truncate the seconds part to int for y2038.

I've had this patch sitting around since 2010 and I completely forget
what motivated it.
2016-08-27 18:48:30 +00:00
christos c89d254f72 PR/5068: Ingo Schwarze: Don't use the .af (alter format) request to display
a named register.
2016-01-23 22:10:44 +00:00
christos ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
christos 160897fee5 use more markup 2015-01-23 02:58:40 +00:00
christos 02160989ff Don't die if we resize to smaller than Y_LINES. The display could do better,
but it recovers if we grow.
2014-05-13 20:06:41 +00:00
christos 751bae8fd5 remove unused variables 2013-10-20 03:02:26 +00:00
roy af358e5553 Allow interactive displays if the termcap entry does not have the `li'
setting but we can calculate the lines from ioctl.
2013-10-01 11:39:37 +00:00
christos a4a10d58ae mandoc can now print numbered registers. 2013-03-21 21:43:22 +00:00
christos 40b61ad4dd The man page has numbered registers and conditionals and cannot be handled
by mandoc, so make it use groff. Unfortunately since we don't install cat
pages, this does not work. At least it works for html!
2013-03-21 02:04:05 +00:00
christos b32a30787e revert previous, this is a mandoc issue (does not handle .if and .nr) 2013-03-21 01:39:04 +00:00
christos 2c041bfd20 PR/47675: Nick Hudson: top(1) man page missing default number of seconds 2013-03-21 00:27:44 +00:00
para 2277afb1ef explicitly include sys/resource.h 2013-01-03 10:12:36 +00:00
sborrill e02c5b57f9 Switch off per-cpu states by default (i.e. display a single CPU line with a
mean average). Program behaviour now tallies with the man page, but more
importantly, the default behaviour is now sensible for modern multi-core
machines.

If you want the previous behaviour, please set TOP="-1" in your environment.

Fix multiple "1" options not toggling and thus allow settings in TOP
environmental variable to be reversed by a command line option.

Tweak description of "1"  command in interactive mode.

OK christos@
2012-03-23 14:46:05 +00:00
sborrill 076ec7d41f Mention that 1 can be used as an interactive command. 2012-03-23 13:32:51 +00:00
christos cc349219b4 PR/45739: Moritz Wilhelmy: top(1) segfaults on WINCH with unknown terminal 2011-12-24 22:29:48 +00:00
njoly e7df974e10 Adjust UID header position, to be aligned with the datas. 2011-10-08 08:45:37 +00:00
joerg ba0add90b0 Disable noreturn checks for remaining external code 2011-09-16 16:41:20 +00:00
christos 27b39b96e0 document that display.c uses non-literal format strings 2011-08-14 12:48:02 +00:00
christos 1d62298ca7 Swap the command and the thread name in the thread view and let the command
be as long as it wants. (Vladimir Kirillov)
2011-04-15 02:05:53 +00:00
christos 8d7359cabb PR/43562: Witold Jan Wnuk: top: CPU percentages overlap labels 2010-07-03 13:18:57 +00:00
is adbe495929 Avoid steps and other artefacts in head for more than 9 CPUs. 2010-06-30 11:08:12 +00:00
rmind c0c9bed8ab Fix previous, so it builds on some ports. 2010-05-31 18:14:59 +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
christos 58f9040724 implement fullcmd mode. Now we need to modernize the machine specific code
to handle displays > 80 columns to make this work effectively.
2010-05-12 22:09:36 +00:00
roy 98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34: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
njoly f4e46459c3 Make process CPU value drop the decimal part when reaching 100%, like
WCPU.
2009-07-27 16:26:48 +00:00
christos 97773de03d PR/41358: YAMAMOTO Takashi: top -n is broken, don't return -1 early if
!smartterminal
2009-05-05 18:52:13 +00:00
christos 213e7ef10b WARNS=4 2009-05-05 18:49:49 +00:00
njoly aaad3eb0f6 Drop the process WCPU decimal part when it reaches 100.0% (threaded
application on SMP system), to make it stay in the 5 expected columns.

ok by christos.
2009-04-24 19:07:45 +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
ad 5e99d26fbe Adjust weight of SIDL down so idle kthreads don't eat up all of the
thread display
2009-03-08 16:26:03 +00:00
oster ab54f8ad2b On a multi-cpu/core machine, running 'top' and pressing '1' resulted
in n-1 blank lines at the bottom of the display.  On the same machine,
running 'top -1' and pressing '1' resulted in a garbled display that
would just get progressively worse.  Invert the values returned by
display_setmulti() to correct both issues.
2009-02-27 17:38:14 +00:00
chris aa5f67e8e7 Add -lutil to allow linking to find the e-functions. 2008-12-13 12:21:50 +00:00