OpenBSD CVS

CVS log for src/usr.bin/top/top.c


[BACK] Up to [local] / src / usr.bin / top

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.109 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:12 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.108: +1 -5 lines
Diff to previous 1.108 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.108 / (download) - annotate - [select for diffs], Fri Dec 16 15:54:27 2022 UTC (17 months ago) by cheloha
Branch: MAIN
Changes since 1.107: +2 -2 lines
Diff to previous 1.107 (colored)

top(1): always recount number of online CPUs

If hw.smt is toggled while top(1) is running in "combined" mode the
CPU count on the CPU state line is incorrect.

We always need to recount the number of online CPUs.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Sep 10 16:58:51 2022 UTC (20 months, 1 week ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.106: +2 -2 lines
Diff to previous 1.106 (colored)

top(1): remove last vestiges of "last pid" support

millert@ removed most of the "last pid" support from top(1) in 1997.
See, e.g. top/machine.c,v1.7:

http://cvsweb.openbsd.org/src/usr.bin/top/machine.c?rev=1.7&content-type=text/x-cvsweb-markup

Let's remove the rest of it:

- Eliminate system_info.last_pid.

- Remove mpid parameter and "last pid" printing code from i_loadave().

Link: https://marc.info/?l=openbsd-tech&m=166277253606823&w=2

ok millert@

Revision 1.106 / (download) - annotate - [select for diffs], Wed Aug 26 16:21:28 2020 UTC (3 years, 8 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.105: +26 -9 lines
Diff to previous 1.105 (colored)

Add "t" to toggle the display of routing tables

Swap the WAIT column with RTABLE (and vice versa);  WAIT is wide enough to
fit RTABLE, somewhat adds additional value to STATE and seems therefore most
appropiate to hide in favour of RTABLE.

Filtering rtables with "T" does not toggle the column, just like filtering
users with "u" does not toggle between user and thread id.

Feedback jmc
OK remi

Revision 1.105 / (download) - annotate - [select for diffs], Sun Aug 23 21:11:55 2020 UTC (3 years, 8 months ago) by kn
Branch: MAIN
Changes since 1.104: +60 -4 lines
Diff to previous 1.104 (colored)

Filter by routing table

"-T-0" for processes outside the default routing table, "-T3" for those in
a specific one;  same semantics as with other filters.

Manual wording and command line flag taken from pgrep(1) being the only way
to identify processes by routing table;  After netstat(1)'s recent addition
of "-R", filtering in top makes for handy tooling around rtable(4).

"looks good to me" millert
OK remi

Revision 1.104 / (download) - annotate - [select for diffs], Sun Jul 26 21:59:16 2020 UTC (3 years, 9 months ago) by kn
Branch: MAIN
Changes since 1.103: +4 -2 lines
Diff to previous 1.103 (colored)

Add / as alias for g (grep)

Simpliy mdoc(7) markup for "n|# count" while here.

Positive manual feedback jmc
No objections millert

Revision 1.103 / (download) - annotate - [select for diffs], Thu Jun 25 20:38:41 2020 UTC (3 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.102: +2 -3 lines
Diff to previous 1.102 (colored)

Remove unused "remaining" member in struct handle

Only ever set or decremented since import with machine.c r1.1 (1997);

While here, simplify the skip semantics behind the scroll functionality.

OK millert

Revision 1.102 / (download) - annotate - [select for diffs], Mon Jan 6 20:05:10 2020 UTC (4 years, 4 months ago) by zhuk
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.101: +31 -2 lines
Diff to previous 1.101 (colored)

Implement scrolling in top(1) using 9 and 0 keys.

Planned improvements: scroll position displaying, using arrow/pgup/pgdown keys.

okay tedu@

Revision 1.101 / (download) - annotate - [select for diffs], Tue Oct 8 20:51:03 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.100: +4 -4 lines
Diff to previous 1.100 (colored)

Simplify threads flag handling

Instead of always passing the threads flag which decides whether other
function arguments are used or not, make callers pass those arguments or
NULL depending on the threads flag.

This reflects better how thread IDs are shown in place of user names/IDs.

OK millert

Revision 1.100 / (download) - annotate - [select for diffs], Tue Oct 8 07:26:59 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.99: +41 -41 lines
Diff to previous 1.99 (colored)

Replace "boolean.h" with <stdbool.h>

Be consistent with other programs in base and unify variable usage as
follows to improve readability:

bool = (bool == No) ? Yes : No  ->  bool = !bool
if (bool == Yes)                ->  if (bool)
if (bool == No)                 ->  if (!bool)
bool = Maybe                    ->  bool = -1

OK millert

Revision 1.99 / (download) - annotate - [select for diffs], Sun Oct 6 15:08:54 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
Changes since 1.98: +2 -2 lines
Diff to previous 1.98 (colored)

Avoid gasting around get_process_info()

get_process_info() returns a pointer to the global handle later only be
used in format_next_process();  treat this struct handle as such without
casting the pointer to caddr_t and back again.

No object change.
OK millert deraadt

Revision 1.98 / (download) - annotate - [select for diffs], Wed Nov 28 22:00:30 2018 UTC (5 years, 5 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.97: +23 -21 lines
Diff to previous 1.97 (colored)

Allow reverse sort order

Prefixing the field with a dash will sort processes in reverse order.
`o -pid' will therefore list PID 1 on top.

"looks good" tedu, improvements and OK cheloha

Revision 1.97 / (download) - annotate - [select for diffs], Sat Nov 17 23:10:08 2018 UTC (5 years, 6 months ago) by cheloha
Branch: MAIN
Changes since 1.96: +22 -4 lines
Diff to previous 1.96 (colored)

Add new KERN_CPUSTATS sysctl(2) so we can identify offline CPUs.

Because of hw.smt we need a way to determine whether a given CPU is "online"
or "offline" from userspace.  KERN_CPTIME2 is an array, and so cannot be
cleanly extended for this purpose, so add a new sysctl(2) KERN_CPUSTATS
with an extensible struct.  At the moment it's just KERN_CPTIME2 with a
flags member, but it can grow as needed.

KERN_CPUSTATS appears to have been defined by BSDi long ago, but there are
few (if any) packages in the wild still using the symbol so breakage in ports
should be near zero.  No other system inherited the symbol from BSDi, either.

Then, use the new sysctl(2) in systat(1) and top(1):

  - systat(1) draws placeholder marks ('-') instead of percentages for
    offline CPUs in the cpu view.

  - systat(1) omits offline CPU ticks when drawing the "big bar" in
    the vmstat view.  The upshot is that the bar isn't half idle when
    half your logical CPUs are disabled.

  - top(1) does not draw lines for offline CPUs; if CPUs toggle on or
    offline in interactive mode we redraw the display to expand/reduce
    space for the new/missing CPUs.  This is consistent with what some
    top(1) implementations do on Linux.

  - top(1) omits offline CPUs from the totals when CPU totals are
    combined into a single line (the '-1' flag).

Originally prompted by deraadt@.  Discussed endlessly with deraadt@,
ketennis@, and sthen@.  Tested by jmc@ and jca@.  Earlier versions also
discussed with jca@.  Earlier versions tested by jmc@, tb@, and many
others.

docs ok jmc@, kernel bits ok ketennis@, everything ok sthen@,
"Is your stuff in yet?" deraadt@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Nov 2 12:46:10 2018 UTC (5 years, 6 months ago) by kn
Branch: MAIN
Changes since 1.95: +13 -2 lines
Diff to previous 1.95 (colored)

Accept numeric user IDs

This makes `top -U 0' and "u-1000" work.

Feedback and "that looks right" tedu, OK millert, manual bits and OK jmc

Revision 1.95 / (download) - annotate - [select for diffs], Thu Nov 1 18:04:13 2018 UTC (5 years, 6 months ago) by kn
Branch: MAIN
Changes since 1.94: +63 -71 lines
Diff to previous 1.94 (colored)

Merge duplicate code into helper functions

This introduces filteruser() and filterpid(), where the first one can now
easily be extended to support matching numeric UIDs. The latter one is now
used by the `highlight` command as well.

No change in behaviour or output.

Feedback and OK millert

Revision 1.94 / (download) - annotate - [select for diffs], Fri Oct 5 18:56:57 2018 UTC (5 years, 7 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

Revert KERN_CPTIME2 ENODEV changes in kernel and userspace.

ok kettenis deraadt

Revision 1.93 / (download) - annotate - [select for diffs], Wed Sep 26 17:23:13 2018 UTC (5 years, 7 months ago) by cheloha
Branch: MAIN
Changes since 1.92: +3 -3 lines
Diff to previous 1.92 (colored)

KERN_CPTIME2: set ENODEV if the CPU is offline.

This lets userspace distinguish between idle CPUs and those that are
not schedulable because hw.smt=0.

A subsequent commit probably needs to add documentation for this
to sysctl.2 (and perhaps elsewhere) after the dust settles.

Also included here are changes to systat(1) and top(1) that account
for the ENODEV case and adjust behavior accordingly:

 - systat(1)'s cpu view prints placeholder marks ('-') instead of
   percentages for each state if the given CPU is offline.

 - systat(1)'s vmstat view checks for offline CPUs when computing the
   machine state total and excludes them, so the CPU usage graph
   only represents the states for online CPUs.

 - top(1) does not draw CPU rows for offline CPUs when the view is
   redrawn.  If CPUs "go offline", percentages for each state are
   replaced by placeholder marks ('-'); the view will need to be
   redrawn to remove these rows.  If CPUs "go online" the view will
   need to be redrawn to show these new CPUs.  In "combined CPU" mode,
   the count and the state totals only represent online CPUs.

Ports using KERN_CPTIME2 will need to be updated.  The changes
described above to make systat(1) and top(1) aware of the ENODEV
case *and* gracefully handle a changing HW_NCPUONLINE while the
application is running are not necessarily appropriate for each
and every port.

The changes described above are so extensive in part to demonstrate
one way a program *might* be made robust to changing CPU availability.
In particular, changing hw.smt after boot is an extremely rare event,
and this needs to be weighed when updating ports.

The logic needed to account for the KERN_CPTIME2 ENODEV case is
very roughly:

	if (sysctl(...) == -1) {
		if (errno != ENODEV) {
			/* Actual error occurred. */
		} else {
			/* CPU is offline. */
		}
	} else {
		/* CPU is online and CPU states were set by sysctl(2). */
	}

Prompted by deraadt@.  Basic idea for ENODEV from kettenis@.  Discussed at
length with kettenis@.  Additional testing by tb@.

No complaints from hackers@ after a week.

ok kettenis@, "I think you should commit [now]" deraadt@

Revision 1.92 / (download) - annotate - [select for diffs], Sat Sep 22 16:50:35 2018 UTC (5 years, 7 months ago) by millert
Branch: MAIN
Changes since 1.91: +9 -11 lines
Diff to previous 1.91 (colored)

Use user_from_uid() and uid_from_user() directly.  The wrappers
in username.c are now so simple there is no longer a good reason
to use them.  OK deraadt@

Revision 1.91 / (download) - annotate - [select for diffs], Thu Sep 13 15:23:32 2018 UTC (5 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

Fix warnings caused by user_from_uid() and group_from_gid() now
returning const char *.

Revision 1.90 / (download) - annotate - [select for diffs], Sun Jul 29 13:34:26 2018 UTC (5 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.89: +3 -1 lines
Diff to previous 1.89 (colored)

After "termcap" initilization is finished, top appears to not open any
files ever again, so we can re-pledge tighter.

Revision 1.89 / (download) - annotate - [select for diffs], Wed Mar 15 04:24:14 2017 UTC (7 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.88: +5 -5 lines
Diff to previous 1.88 (colored)

annoying whitespace die die die

Revision 1.88 / (download) - annotate - [select for diffs], Thu Nov 5 17:17:13 2015 UTC (8 years, 6 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

allow "kill" from top, by using proc instead of id
(event though the documentation does not yet state that proc allows
setpriority for renice)

Problem found by me, tweak suggested by theo buehler
Committed prompted by deraadt@

Revision 1.87 / (download) - annotate - [select for diffs], Wed Nov 4 21:28:27 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.86: +3 -3 lines
Diff to previous 1.86 (colored)

replace setbuf with setvbuf, from Frederic Nowak

Revision 1.86 / (download) - annotate - [select for diffs], Fri Oct 30 13:57:33 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

top renice command requires pledge "id", from Michael Lesniewski

Revision 1.85 / (download) - annotate - [select for diffs], Sun Oct 25 09:39:00 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.84: +2 -2 lines
Diff to previous 1.84 (colored)

need "getpw" pledge; spotted by matthieu

Revision 1.84 / (download) - annotate - [select for diffs], Fri Oct 23 03:26:24 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.83: +4 -1 lines
Diff to previous 1.83 (colored)

With new pledge "ps" and "vminfo" requests, ps/top/w become possible.

Revision 1.83 / (download) - annotate - [select for diffs], Wed May 6 07:53:29 2015 UTC (9 years ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.82: +5 -5 lines
Diff to previous 1.82 (colored)

Display thread IDs instead of the name of the process's owner when "-H"
is used.

The rationnal is that when you're looking at threads you're generally
already filtereing by PID and this allow you to see which thread is a
pig.

Written some time ago with mikeb@

ok sthen@, krw@, guenther@

Revision 1.82 / (download) - annotate - [select for diffs], Wed Sep 17 01:56:54 2014 UTC (9 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.81: +8 -1 lines
Diff to previous 1.81 (colored)

if there are more than 8 cpus, default to combined cpu stats (like
you passed -1 on the command line).

ok kettenis@ tedu@

Revision 1.81 / (download) - annotate - [select for diffs], Mon Apr 7 15:49:22 2014 UTC (10 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.80: +5 -3 lines
Diff to previous 1.80 (colored)

Just exit if we get an error or HUP when poll()ing the keyboard.
Otherwise, top may spin when its tty goes away.  OK deraadt@

Revision 1.80 / (download) - annotate - [select for diffs], Mon Jan 14 21:33:59 2013 UTC (11 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.79: +4 -3 lines
Diff to previous 1.79 (colored)

When showing threads, say so.  Fix up some comments and names at the same time.

original diff by zhuk@
ok jsing@ mpi@ zhuk@

Revision 1.79 / (download) - annotate - [select for diffs], Fri Jun 8 13:41:16 2012 UTC (11 years, 11 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.78: +5 -1 lines
Diff to previous 1.78 (colored)

Add checks for command line input (or the TOP environment var)
ommitted from 1.78.  Now a $ top -U -username -U username command will
behave the same as interactive mode. ok brynet@

Revision 1.78 / (download) - annotate - [select for diffs], Tue Jun 5 18:52:53 2012 UTC (11 years, 11 months ago) by brynet
Branch: MAIN
Changes since 1.77: +27 -9 lines
Diff to previous 1.77 (colored)

Add support for hiding a user's processes in top.

feedback & ok lum@

Revision 1.77 / (download) - annotate - [select for diffs], Fri Apr 20 16:36:11 2012 UTC (12 years, 1 month ago) by pirofti
Branch: MAIN
Changes since 1.76: +4 -3 lines
Diff to previous 1.76 (colored)

Silence warnings. Okay deraadt@.

Revision 1.76 / (download) - annotate - [select for diffs], Fri Dec 16 14:50:24 2011 UTC (12 years, 5 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.75: +4 -4 lines
Diff to previous 1.75 (colored)

Use H to make top show process threads, instead of the current T. This is
consistent with our ps(1) and top(1) on other operating systems.

ok deraadt@ mikeb@ millert@

Revision 1.75 / (download) - annotate - [select for diffs], Sat Apr 24 22:02:14 2010 UTC (14 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (colored)

delete two extra ; that got inserted somewhere along the line

Revision 1.74 / (download) - annotate - [select for diffs], Wed Apr 21 11:29:59 2010 UTC (14 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.73: +7 -3 lines
Diff to previous 1.73 (colored)

Handle a strdup failure.
ok otto@

Revision 1.73 / (download) - annotate - [select for diffs], Fri Mar 26 16:56:00 2010 UTC (14 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.72: +3 -7 lines
Diff to previous 1.72 (colored)

Remove unnecessary ptr.
ok otto@

Revision 1.72 / (download) - annotate - [select for diffs], Tue Mar 23 16:16:09 2010 UTC (14 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Fix pointer usage with the renice and kill error message structure. Pointer was used without allocating memory. ok beck@ otto@

Revision 1.71 / (download) - annotate - [select for diffs], Mon Mar 22 12:20:25 2010 UTC (14 years, 2 months ago) by lum
Branch: MAIN
Changes since 1.70: +2 -2 lines
Diff to previous 1.70 (colored)

make argument check for '-s' cli option and interactive 's' consistent. ok otto@

Revision 1.70 / (download) - annotate - [select for diffs], Thu Mar 18 12:47:48 2010 UTC (14 years, 2 months ago) by otto
Branch: MAIN
Changes since 1.69: +19 -19 lines
Diff to previous 1.69 (colored)

While resizing, show correct CPU stats, from Mark Lumsden

Revision 1.69 / (download) - annotate - [select for diffs], Fri Jan 29 00:36:09 2010 UTC (14 years, 3 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Allow sorting by command and pid.  Also, allow partial matches with strncmp.
ok jmc otto

Revision 1.68 / (download) - annotate - [select for diffs], Thu Dec 10 13:16:02 2009 UTC (14 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.67: +14 -6 lines
Diff to previous 1.67 (colored)

add an option '1' to display all cpu stats combined.  helps save space
with increasing processor counts.
ok deraadt (kettenis otto)

Revision 1.67 / (download) - annotate - [select for diffs], Sat Jul 18 06:12:41 2009 UTC (14 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.66: +3 -3 lines
Diff to previous 1.66 (colored)

restore -S as toggle;

from Mark Lumsden
ok oga

Revision 1.66 / (download) - annotate - [select for diffs], Thu Jun 4 19:01:30 2009 UTC (14 years, 11 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.65: +3 -1 lines
Diff to previous 1.65 (colored)

with -d1, switch interactive mode off, so the screen isn't restored
immediately afterwards on a smart terminal. found by claudio@.
"I like that diff" deraadt "yes please!" phessler "I think that
makes sense" claudio

Revision 1.65 / (download) - annotate - [select for diffs], Thu Nov 29 10:06:30 2007 UTC (16 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.64: +9 -7 lines
Diff to previous 1.64 (colored)

fix small glitch in displaying process list header; from Mark Lumsden

Revision 1.64 / (download) - annotate - [select for diffs], Tue Nov 27 13:19:16 2007 UTC (16 years, 5 months ago) by otto
Branch: MAIN
Changes since 1.63: +3 -2 lines
Diff to previous 1.63 (colored)

use symbolic constant 'Infinity' instead of -1 where appropriate; from
Mark Lumsden

Revision 1.63 / (download) - annotate - [select for diffs], Thu Nov 22 11:01:04 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.62: +58 -31 lines
Diff to previous 1.62 (colored)

Diff from Mark Lumsden: cleanup of reading strings and numbers, to
make sure command line args and interactive reading of numbers use the
same code. More concrete, interactive use of 'd' and 'n' now also
interpret 'max', 'infinite' and 'all' and handle non-numbers
correctly. tested by a few

Revision 1.62 / (download) - annotate - [select for diffs], Tue Nov 6 06:56:59 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (colored)

prevent segv on wrong sort name; Mark Lumsden.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Nov 4 18:51:48 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.60: +10 -10 lines
Diff to previous 1.60 (colored)

Also show warning message for -U and -p in message area; noted by Mark
Lumsden

Revision 1.60 / (download) - annotate - [select for diffs], Sun Nov 4 18:45:48 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.59: +21 -27 lines
Diff to previous 1.59 (colored)

Get rid of the very annoying warning message + delay when a command
line argument is wrong. Just display the message in the message area.
ok deraadt@ sobrado@ simon@ henning@

Revision 1.59 / (download) - annotate - [select for diffs], Thu Nov 1 19:25:32 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

make check on -s and interactive s consistent; from Tilo Stritzky

Revision 1.58 / (download) - annotate - [select for diffs], Tue Oct 16 07:33:08 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.57: +3 -5 lines
Diff to previous 1.57 (colored)

Properly adjust headers displayed when the screen contains few lines.
Avoid a segv also. Problem reported by Mark Lumsden; inital diff by
me, further polishing by Mark. Tested by ray@ canacar@ hshoexer@

Revision 1.57 / (download) - annotate - [select for diffs], Thu Oct 4 07:47:53 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.56: +3 -2 lines
Diff to previous 1.56 (colored)

only init screen when in interactive mode; ok ray@

Revision 1.56 / (download) - annotate - [select for diffs], Thu Sep 27 19:44:54 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.55: +32 -33 lines
Diff to previous 1.55 (colored)

No need to use two buffers for reading data from the user. From Mark
Lumsden; ok ray@

Revision 1.55 / (download) - annotate - [select for diffs], Wed Sep 26 11:06:41 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.54: +4 -5 lines
Diff to previous 1.54 (colored)

reuse available var, from Mark Lumsden

Revision 1.54 / (download) - annotate - [select for diffs], Tue Sep 18 11:15:25 2007 UTC (16 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.53: +2 -3 lines
Diff to previous 1.53 (colored)

redundant asignment; from Mark Lumsden

Revision 1.53 / (download) - annotate - [select for diffs], Mon Sep 10 10:48:01 2007 UTC (16 years, 8 months ago) by otto
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

typo in message, from Mark Lumsden.

Revision 1.52 / (download) - annotate - [select for diffs], Fri Jul 27 13:59:27 2007 UTC (16 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

u_endscreen()'s argument is entirely unused; inspired by zinovik@cs.karelia.ru

Revision 1.51 / (download) - annotate - [select for diffs], Tue May 29 00:56:56 2007 UTC (16 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.50: +74 -108 lines
Diff to previous 1.50 (colored)

Instead of using hand-crafted redraws minimizing screen updates, use curses.
Enables nice things like process highlighting without hurting the brain.
ok deraadt@

Revision 1.50 / (download) - annotate - [select for diffs], Sun Apr 1 19:07:48 2007 UTC (17 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.49: +3 -2 lines
Diff to previous 1.49 (colored)

tidy up usage(); partly from Mark Lumsden

Revision 1.49 / (download) - annotate - [select for diffs], Tue Feb 27 16:27:39 2007 UTC (17 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.48: +3 -3 lines
Diff to previous 1.48 (colored)

an atoi() -> strtonum() conversion from Mark Lumsden; ok simon@ ray@

Revision 1.48 / (download) - annotate - [select for diffs], Sun Feb 4 19:23:27 2007 UTC (17 years, 3 months ago) by otto
Branch: MAIN
Changes since 1.47: +12 -4 lines
Diff to previous 1.47 (colored)

Complain of the user specifies a negative number for the 's' command.
From Mark Lumsden.

Revision 1.47 / (download) - annotate - [select for diffs], Sun Feb 4 19:17:14 2007 UTC (17 years, 3 months ago) by otto
Branch: MAIN
Changes since 1.46: +10 -2 lines
Diff to previous 1.46 (colored)

Introducing the '+' interactive command to reset all filters.
From Mark Lumsden. ok millert@ deraadt@ simon@

Revision 1.46 / (download) - annotate - [select for diffs], Sun Feb 4 15:01:11 2007 UTC (17 years, 3 months ago) by otto
Branch: MAIN
Changes since 1.45: +2 -1 lines
Diff to previous 1.45 (colored)

actully use a default value when we say so. from Mark Lumsden

Revision 1.45 / (download) - annotate - [select for diffs], Wed Jan 3 18:57:49 2007 UTC (17 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.44: +25 -4 lines
Diff to previous 1.44 (colored)

Add a 'g' command to only show processes having a string in their
command name. ok deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Wed Dec 27 07:24:52 2006 UTC (17 years, 4 months ago) by otto
Branch: MAIN
Changes since 1.43: +7 -3 lines
Diff to previous 1.43 (colored)

Also provide 'C' as a command line arg. From Mark Lumsden <mark at cyodesigns
dot com>.

Revision 1.43 / (download) - annotate - [select for diffs], Sat Mar 4 06:58:12 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.42: +2 -14 lines
Diff to previous 1.42 (colored)

Show the CPU state %'s on first display as well. "looks good" deraadt@

Revision 1.42 / (download) - annotate - [select for diffs], Sat Mar 4 06:54:18 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
Changes since 1.41: +12 -5 lines
Diff to previous 1.41 (colored)

Handle signals in non-interactive mode. "looks good" deraadt@

Revision 1.41 / (download) - annotate - [select for diffs], Sun Dec 4 23:10:06 2005 UTC (18 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.40: +19 -4 lines
Diff to previous 1.40 (colored)

support for toggling thread viewing.
ok brad, hints from jmc

Revision 1.40 / (download) - annotate - [select for diffs], Fri Jun 17 09:40:48 2005 UTC (18 years, 11 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.39: +8 -2 lines
Diff to previous 1.39 (colored)

add a 'C' command ) that toggles the display of the full cmdline;
with Jared Yanovich; ok deraadt

Revision 1.39 / (download) - annotate - [select for diffs], Wed Jun 8 22:36:43 2005 UTC (18 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.38: +3 -2 lines
Diff to previous 1.38 (colored)

Multi-cpu support for top.  Each cpu now gets its own stats line.
Based on work by todd@ at the hackathon.

Revision 1.38 / (download) - annotate - [select for diffs], Sat May 14 09:03:31 2005 UTC (19 years ago) by jmc
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

sort options + sync usage();

Revision 1.37 / (download) - annotate - [select for diffs], Fri May 13 20:43:30 2005 UTC (19 years ago) by jaredy
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

grab bag of man page updates
- sync to reality (kill first BUG, WCPU field, and ABANDONED
  state and add WAIT field description)
- transform paragraph of field descriptions into a list
- minor mdoc, spelling, capitalization nits

ok & help jmc, mickey

Revision 1.36 / (download) - annotate - [select for diffs], Wed Apr 13 02:33:09 2005 UTC (19 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.35: +4 -4 lines
Diff to previous 1.35 (colored)

use STD{IN,OUT,ERR}_FILENO

Revision 1.35 / (download) - annotate - [select for diffs], Thu Oct 7 06:26:12 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.34: +56 -5 lines
Diff to previous 1.34 (colored)

introduce -p option and p command to only show a single process.
From Patrick Latifi. ok deraadt@ millert@

Revision 1.34 / (download) - annotate - [select for diffs], Tue Sep 14 22:55:48 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +5 -1 lines
Diff to previous 1.33 (colored)

ARGSUSED before signal handler with unused signo

Revision 1.33 / (download) - annotate - [select for diffs], Sun May 9 22:16:26 2004 UTC (20 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

delint

Revision 1.32 / (download) - annotate - [select for diffs], Sun May 9 22:14:15 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.31: +27 -27 lines
Diff to previous 1.31 (colored)

spaces

Revision 1.31 / (download) - annotate - [select for diffs], Fri May 7 19:19:49 2004 UTC (20 years ago) by millert
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored)

Check poll revents for error.

Revision 1.30 / (download) - annotate - [select for diffs], Sat Nov 1 20:20:57 2003 UTC (20 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.29: +27 -4 lines
Diff to previous 1.29 (colored)

process signals at the right time.  also handle stdin failure better;
millert looked at it..

Revision 1.29 / (download) - annotate - [select for diffs], Fri Sep 19 10:32:24 2003 UTC (20 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

commands.c: add `o' and `S' to internal help, sort options
top.1: sort options and SYNOPSIS
       add description of `o' (from Patrick Latifi)
top.c: sync usage() with SYNOPSIS

ok deraadt@

Revision 1.28 / (download) - annotate - [select for diffs], Thu Aug 21 08:14:50 2003 UTC (20 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.27: +6 -9 lines
Diff to previous 1.27 (colored)

use poll

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:52 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.26: +11 -11 lines
Diff to previous 1.26 (colored)

protos

Revision 1.26 / (download) - annotate - [select for diffs], Thu Jun 19 22:40:45 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

o get rid of strecpy() and use strlcpy() and/or snprintf() instead.
o make itoa() just use snprintf()
o rename itoa7() to format_uid() and use snprintf()
o max username len is _PW_NAME_LEN, not 8

Revision 1.25 / (download) - annotate - [select for diffs], Wed Jun 18 08:42:17 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.24: +2 -10 lines
Diff to previous 1.24 (colored)

SIGWINCH is always here

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jun 18 08:36:31 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.23: +2 -7 lines
Diff to previous 1.23 (colored)

remove unused variables

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jun 16 17:24:44 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.22: +4 -3 lines
Diff to previous 1.22 (colored)

Add missing #include <err.h>

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jun 16 01:09:02 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +17 -29 lines
Diff to previous 1.21 (colored)

use warnx(); millert ok

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jun 15 16:24:44 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.20: +7 -6 lines
Diff to previous 1.20 (colored)

use uid_t and fix some sign compare warnings; OK krw@ and deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jun 13 21:52:25 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +656 -801 lines
Diff to previous 1.19 (colored)

readable code

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 12 22:30:23 2003 UTC (20 years, 11 months ago) by pvalchev
Branch: MAIN
Changes since 1.18: +15 -28 lines
Diff to previous 1.18 (colored)

cleanup; ok deraadt

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jul 15 17:20:36 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.17: +22 -5 lines
Diff to previous 1.17 (colored)

license change from William LeFebvre <wnl@groupsys.com>; top is now BSD
licensed.  this same license will show up on his next release as well.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Jun 14 21:35:00 2002 UTC (21 years, 11 months ago) by todd
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

spelling; from Brian Poole <raj@cerias.purdue.edu>

Revision 1.16 / (download) - annotate - [select for diffs], Sun Apr 21 18:52:33 2002 UTC (22 years, 1 month ago) by hugh
Branch: MAIN
Changes since 1.15: +15 -9 lines
Diff to previous 1.15 (colored)

Add support for fractional delay values. Useful for fast updates
without spinning top. Cleared by millert.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:55 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.14: +6 -6 lines
Diff to previous 1.14 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Nov 19 19:02:17 2001 UTC (22 years, 6 months ago) by mpech
Branch: MAIN
Changes since 1.13: +4 -4 lines
Diff to previous 1.13 (colored)

kill more registers

millert@ ok

Revision 1.13 / (download) - annotate - [select for diffs], Sat Nov 17 19:57:36 2001 UTC (22 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +4 -4 lines
Diff to previous 1.12 (colored)

volatile sig_atomic_t

Revision 1.12 / (download) - annotate - [select for diffs], Sun Nov 11 01:48:58 2001 UTC (22 years, 6 months ago) by fgsch
Branch: MAIN
Changes since 1.11: +13 -5 lines
Diff to previous 1.11 (colored)

Add 'S' to interactive mode to toggle the display of system
processes; From NetBSD.
millert@ ok.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Sep 5 06:25:39 2001 UTC (22 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.10: +4 -3 lines
Diff to previous 1.10 (colored)

select correctly, and on the right file descriptors too!

Revision 1.10 / (download) - annotate - [select for diffs], Tue Sep 4 23:35:59 2001 UTC (22 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.9: +12 -27 lines
Diff to previous 1.9 (colored)

Replace the deprecated BSD sigsetmask/sigblock/sigpause functions with their POSIX counterparts.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jul 27 17:13:42 2001 UTC (22 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +23 -12 lines
Diff to previous 1.8 (colored)

abort if stdout use ever produces EOF.  before, top was one of those nasty
processes that could spin if it's output tty went away in some cases.

Revision 1.8 / (download) - annotate - [select for diffs], Tue Jul 17 02:23:58 2001 UTC (22 years, 10 months ago) by pvalchev
Branch: MAIN
Changes since 1.7: +2 -1 lines
Diff to previous 1.7 (colored)

-Wall cleanup; ok deraadt

Revision 1.7 / (download) - annotate - [select for diffs], Thu Jan 18 07:29:28 2001 UTC (23 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.6: +55 -53 lines
Diff to previous 1.6 (colored)

remove signal races, using flags

Revision 1.6 / (download) - annotate - [select for diffs], Fri Dec 22 22:46:57 2000 UTC (23 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +7 -2 lines
Diff to previous 1.5 (colored)

use strtoul() instead of atoi()

Revision 1.5 / (download) - annotate - [select for diffs], Tue Nov 21 07:22:19 2000 UTC (23 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +10 -1 lines
Diff to previous 1.4 (colored)

errno saving inside really crummy signal handlers

Revision 1.3.4.1 / (download) - annotate - [select for diffs], Fri Oct 6 20:06:24 2000 UTC (23 years, 7 months ago) by jason
Branch: OPENBSD_2_7
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored) next main 1.4 (colored)

Pull in patch from current:
Fix (millert):
Fixes a format string error in the kill (k) command; vort@wiretapped.net

Revision 1.4 / (download) - annotate - [select for diffs], Wed Oct 4 21:19:38 2000 UTC (23 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

Fixes a format string error in the kill (k) command; vort@wiretapped.net

Revision 1.3 / (download) - annotate - [select for diffs], Sun May 23 17:19:21 1999 UTC (25 years ago) by aaron
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_6_BASE, OPENBSD_2_6
Branch point for: OPENBSD_2_7
Changes since 1.2: +2 -2 lines
Diff to previous 1.2 (colored)

getopt(3) returns -1, not EOF

Revision 1.2 / (download) - annotate - [select for diffs], Fri Aug 22 07:16:30 1997 UTC (26 years, 9 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.1: +30 -57 lines
Diff to previous 1.1 (colored)

First sweep.  Prototype, type fixes, long fixes, mostly compiles with
-Wall.

Revision 1.1 / (download) - annotate - [select for diffs], Thu Aug 14 14:00:26 1997 UTC (26 years, 9 months ago) by downsj
Branch: MAIN

top 3.4, with a few changes.  Still needs more work.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.