Commit Graph

358 Commits

Author SHA1 Message Date
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh
42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh
b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Konstantin Belousov
5bd5470a2c top(8): restore erronously removed SWAIT array element
due to bad rebase.

Noted by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Fixes:	6a5e6a50bd55c3fb4933abe1edaad3a928700c42ESC
2023-06-21 08:43:11 +03:00
Konstantin Belousov
6a5e6a50bd top(8): add missed SLOCK state to the sorted_state[]
Put it near/after the sleep state.

Noted by:	Mark Millard <marklmi@yahoo.com>
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:37:25 +03:00
Konstantin Belousov
d636fc5bd1 top(8): document the actual sort order for process sorting
Noted by:	Mark Millard <marklmi@yahoo.com>
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:37:24 +03:00
Konstantin Belousov
bc2ac2585a top(8): use designated initializers for sorted_state[]
Also correct comments for individual state, duplicating the S* constants
descriptions from sys/proc.h [*].

Reviewed by:	kevans (previous version)
Noted by:	Mark Millard <marklmi@yahoo.com> [*]
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:36:45 +03:00
Konstantin Belousov
5c6393451f top(8): designate the sorted_state[] array as constant
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40607
2023-06-21 08:36:33 +03:00
Mark Johnston
e96ed17746 top: Use a cpuset_t to represent a CPU mask
The code attempts to detect holes in the CPU ID space, but previously
this would only work for up to sizeof(long)*8 CPUs.

MFC after:	2 weeks
2023-05-26 15:38:08 -04:00
Simon J. Gerraty
d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Kyle Evans
deb63adf94 top: fix sorting by pid (-o pid)
The 'pid' order was added, but the equivalent comparator was not back in
8b800d3af2 ("Add the PID column to the list of sort keys.").
`ordernames` indices need to match `compares` indices in order for this
to work.

A future commit will restructure all of this to make it less error prone
going forward (see D37083).

MFC after:	3 days
Reviewed by:	pstef (D37083)
2023-02-13 00:43:32 -06:00
Gordon Bergling
2fc0894023 top(1): Fix a typo in a source code comment
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:53:20 +02:00
Mateusz Piotrowski
01e3140571 top.1: Use the Dq macros instead of \*lq and \*rq
MFC after:	3 days
2021-11-18 15:56:49 +01:00
Mateusz Piotrowski
c947fc5fae top.1: Improve description of -m
Describe -m argument as "mode" instead of "display".

MFC after:	3 days
2021-11-18 15:56:48 +01:00
Mateusz Piotrowski
82d0f865ee top: Sort flags in usage message
While here, fix the indentation of the second line in the message.

MFC after:	3 days
2021-11-18 15:56:47 +01:00
Mateusz Piotrowski
1125390415 top.1: Sort options alphabetically
While here, add a short sentence introducing the options.

MFC after:	3 days
2021-11-18 15:56:47 +01:00
Mateusz Piotrowski
b8135ed67c top.1: Fix a typo in description of H interactive command
B is listed as an interactive command to toggle the display of threads.
This is a typo introduced during the conversion of the manual page to
mdoc.

Fixes:		9d6cce02a7
MFC after:	3 days
2021-11-18 15:56:46 +01:00
Baptiste Daroussin
cbc83e378a ncurses: chase dependency changes in the source tree
Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:24 +02:00
John Baldwin
4c9cb057bd top: Remove a duplicate extern declaration for show_args.
This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31937
2021-09-15 09:03:17 -07:00
John Grafton
4ccbbe5f06 top(1): indicate how to reset grep string
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files
2021-09-07 20:56:45 -06:00
John Grafton
a00d703f2f top(1): support command name and argument grepping
Obtained from:  OpenBSD
Reviewed by:	imp@
Pull Request:	https://github.com/freebsd/freebsd-src/pull/479
2021-06-29 17:51:18 -06:00
Yuri Pankov
13858b8824 top: VIS_SAFE turned out to be unsafe
Unset VIS_SAFE flag as it turned out to be actually unsafe
for continuos top display as it's passing through sequences
resulting cursor movement (backspace, tab, carriage-return),
and explicitly set VIS_TAB for the same reason.

Reported by:	Mark Millard <marklmi@yahoo.com>, swills
Tested by:	Mark Millard <marklmi@yahoo.com>, swills
2020-07-14 22:43:40 +00:00
Konstantin Belousov
5211c24ddf top: do not try to use sysctl machdep.smp_active.
The sysctl was removed by r76078 in 2001.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-06-28 00:29:21 +00:00
Mark Johnston
fb979f0db2 Fix up r359594: -m takes an argument.
PR:		244153
Reported by:	0mp
MFC with:	r359594
2020-04-03 14:47:40 +00:00
Mark Johnston
3035d538a4 Fix the description of the -m flag in top.1.
PR:		244153
Submitted by:	fehmi noyan isi <fnoyanisi@yahoo.com>
MFC after:	3 days
2020-04-03 13:35:44 +00:00
Philip Paeps
fc8ae86a8f top: display battery capacity remaining
Submitted by: Antranig Vartanian <antranigv@freebsd.am>
Reviewed by:  imp, philip
Differential Revision:        https://reviews.freebsd.org/D22871
2019-12-21 05:03:21 +00:00
Mark Johnston
738b2d5ceb Add a "B" suffix to memory quantities in top(1) output.
Otherwise small quantities look nonsensical.  For instance, when
swapping in a single page we would print "4096 In".

Fix code indentation while here.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2019-11-18 20:55:01 +00:00
Dimitry Andric
fc4ac32fa7 Allow entering fractional delays in top(1) interactive mode.
This uses the same logic as with the -s option, first validating the
entered value, then storing the result in a struct timeval.

MFC after:	3 days
X-MFC-With:	r352818
2019-09-27 20:53:31 +00:00
Dimitry Andric
a6f721ece8 Make fractional delays for top(1) work for interactive mode.
In r334906, the -s option was changed to allow fractional times, but
this only functioned correctly for batch mode.  In interactive mode, any
delay below 1.0 would get floored to zero.  This would put top(1) into a
tight loop, which could be difficult to interrupt.

Fix this by storing the -s option value (after validation) into a struct
timeval, and using that struct consistently for delaying with select(2).

Next up is to allow interactive entry of a fractional delay value.

MFC after:	3 days
2019-09-27 20:20:21 +00:00
Dimitry Andric
1a444441d8 Correct the final argument name in the top(1) manpage.
The description talks about 'number', while the final argument was
'count'.  Since 'count' is already used for the count of displays,
change the final argument name to 'number'.

MFC after:	3 days
2019-09-27 17:11:21 +00:00
Hiroki Sato
ecc2b89f96 Impove wording and move descriptions about
locale to LC_CTYPE in the ENVIRONMENT section.
2019-09-21 00:44:37 +00:00
Daichi GOTO
b1de37fadd top(1): support multibyte characters in command names (ARGV array)
depending on locale.

 - add setlocale()
 - remove printable() function
 - add VIS_OCTAL and VIS_SAFE to the flag of strvisx() to display
   non-printable characters that do not use C-style backslash sequences
   in three digit octal sequence, or remove it

This change allows multibyte characters to be displayed according to
locale. If it is recognized as a non-display character according to the
locale, it is displayed in three digit octal sequence.

Reference:
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165751.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165766.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165833.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165846.html
https://www.mail-archive.com/svn-src-all@freebsd.org/msg165891.html

Submitted by: hrs
Differential Revision: https://reviews.freebsd.org/D16204
2019-09-20 17:37:23 +00:00
Tijl Coosemans
8fb2c7ac84 Fix layout. -C needs to be styled as a flag here, not as a new list item.
MFC after:	2 weeks
2019-07-12 21:19:47 +00:00
Allan Jude
2984a71677 top(1): Don't show the swap line when there are no swap devices
Submitted by:	antranigv@freebsd.am
Reviewed by:	bapt
MFC after:	1 month
Sponsored by:	Klara Systems
Differential Revision:	https://reviews.freebsd.org/D18928
2019-06-20 15:44:43 +00:00
Dimitry Andric
c26e2e37aa Fix regression in top(1) after r344381, causing informational messages
to no longer be displayed.  This was because the reimplementation of
setup_buffer() did not copy the previous contents into any reallocated
buffer.

Reported by:	James Wright <james.wright@jigsawdezign.com>
PR:		236947
MFC after:	3 days
2019-04-02 18:01:54 +00:00
Dimitry Andric
281bdc30df Fix more AddressSanitizer violations in usr.bin/top
In line_update(), set lastcol correctly after moving to any non-zero
column, so the "overwrite old stuff" part does not attempt to address
negative offsets in the current line.

Rewrite setup_buffer() to always allocate at least 80 characters,
otherwise various calls to summary_format() will overwrite the end of
the buffers, if the screen width gets small enough.

MFC after:	1 week
2019-02-20 20:17:54 +00:00
Dimitry Andric
7362ea6db0 Fix the first couple of AddressSanitizer violations in usr.bin/top.
Avoid setting zero bytes beyond the length of the 'thisline' parameters
in i_process() and u_process(), and don't attempt to memset a negative
number of bytes.

MFC after:	1 week
2019-02-10 13:44:36 +00:00
Dimitry Andric
2f301637c8 Fix multiple warnings in usr.bin/top about variables shadowing global
declarations from base gcc, by renaming those variables.

MFC after:	1 week
2019-02-10 13:34:21 +00:00
Dimitry Andric
d0f687d30f Fix multiple warnings in usr.bin/top about discarded qualifiers from
both clang and gcc, by either constifying variables, or when that is not
possible, using __DECONST.

MFC after:	1 week
2019-02-10 13:31:08 +00:00
Justin Hibbits
61ef814f56 Fix top(1) long options handling
getopt_long(3) requires the long options be terminated by a NULL block.
Without the terminator, an invalid long option results in a segmentation
fault.

Reported by:	Brandon Bergren
MFC after:	1 week
2019-01-18 23:26:31 +00:00
Mark Johnston
e7a0ad24b0 Add missing display messages when toggling modes.
PR:		233667
Submitted by:	James Wright <james.wright@jigsawdesign.com>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D18331
2018-11-30 18:02:59 +00:00
Mateusz Piotrowski
fab44dc358 top(1): Rework DESCRIPTION OF MEMORY section.
Due to markup issues, the DESCRIPTION OF MEMORY section is rather
unreadable; rework it a bit, using subsections for different lines of the
top output, and move it closer to description.

While here, pet manlint ordering other sections as expected.

Submitted by:	Yuri Pankov <yuripv@yuripv.net>
Reviewed by:	eadler
Approved by:	re (gjb), krion (mentor)
Differential Revision:	https://reviews.freebsd.org/D17369
2018-10-02 08:13:54 +00:00
Mark Johnston
fedded8d04 Fix column alignment in per-thread mode.
PR:		230872
Approved by:	re (marius)
MFC after:	1 week
2018-08-25 15:59:51 +00:00
Eitan Adler
17be5f230a top(1): Use warnx and errx instead of fprintf
This also makes make "-v" exit without error, since it isn't.
2018-08-22 10:07:15 +00:00
Eitan Adler
eeb147d528 top(1): issue warning on invalid delay
When top -sH is run it continually updates. It should issue an warning
instead.

Reported by:	jmg
PR:		230803
2018-08-22 09:49:38 +00:00
Matt Macy
ef8e2d2d01 fix top after arc accounting change 2018-08-11 22:11:12 +00:00
Eitan Adler
550ddd16ed top(1): hide THR column in separate-thread mode.
It does not make sense to show a "thread count" column when displaying
threads separately. In fact we don't, but do show the header for this
column. Fix this.
2018-08-08 06:31:46 +00:00
Daichi GOTO
08092a9b8f top(1): fix a buffer overflow copying states to display while they were incremented
- fix an AddressSanitizer error

Submitted by:	devnexen@gmail.com
Reviewed by:	eadler
Approved by:	gnn (mentor)
Differential Revision:	https://reviews.freebsd.org/D16183
2018-07-27 07:05:50 +00:00