OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.67 / (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_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.66: +2 -6 lines
Diff to previous 1.66 (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.66 / (download) - annotate - [select for diffs], Mon Aug 8 16:54:09 2022 UTC (21 months, 1 week ago) by cheloha
Branch: MAIN
Changes since 1.65: +18 -21 lines
Diff to previous 1.65 (colored)

top(1): display uptime with seconds, print uptime in fixed format

1. It's sometimes useful to know the system uptime with more precision
   than one minute.

So, this patch changes top(1) to print seconds of uptime in addition
to minutes, hours, and days.

2. It's *always* annoying when the information you want on a realtime
   display is not shown in the same place in a consistent format.

So, this patch also changes top(1) to always print the uptime like
this:

	up D days HH:MM:SS

This is much easier to read at a glance.  In particular, it requires
no additional thought on my part to figure out whether the machine has
been up less than one day.

Maybe of note is that these changes make top(1)'s output different
from that of uptime(1).  I don't think this matters very much.  top(1)
is a realtime display, so it isn't likely to be parsed.  uptime(1) is
a different story.

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

Positive feedback from kn@.

ok gnezdo@ bluhm@ millert@

Revision 1.65 / (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.64: +2 -1 lines
Diff to previous 1.64 (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.64 / (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.63: +3 -1 lines
Diff to previous 1.63 (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.63 / (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.62: +2 -2 lines
Diff to previous 1.62 (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.62 / (download) - annotate - [select for diffs], Sat Jun 27 01:09:57 2020 UTC (3 years, 10 months ago) by kn
Branch: MAIN
Changes since 1.61: +4 -2 lines
Diff to previous 1.61 (colored)

Add missing scroll keys to help page, name default signale for kill command

The order of commands is not in sync between help page and manual, but I
refrained from reordering to avoid churn.

OK millert

Revision 1.61 / (download) - annotate - [select for diffs], Sun Oct 27 13:52:26 2019 UTC (4 years, 6 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

+ resets P as well

The manual has it, complete the help screen.

OK millert

Revision 1.60 / (download) - annotate - [select for diffs], Tue Oct 8 07:26:59 2019 UTC (4 years, 7 months ago) by kn
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.59: +5 -8 lines
Diff to previous 1.59 (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.59 / (download) - annotate - [select for diffs], Wed Jul 3 03:24:02 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.58: +3 -3 lines
Diff to previous 1.58 (colored)

snprintf/vsnprintf return < 0 on error, rather than -1.

Revision 1.58 / (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.57: +3 -2 lines
Diff to previous 1.57 (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.57 / (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.56: +20 -11 lines
Diff to previous 1.56 (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.56 / (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.55: +8 -25 lines
Diff to previous 1.55 (colored)

Revert KERN_CPTIME2 ENODEV changes in kernel and userspace.

ok kettenis deraadt

Revision 1.55 / (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.54: +26 -9 lines
Diff to previous 1.54 (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.54 / (download) - annotate - [select for diffs], Thu Jan 4 17:44:20 2018 UTC (6 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.53: +2 -1 lines
Diff to previous 1.53 (colored)

glaring KNF violation

Revision 1.53 / (download) - annotate - [select for diffs], Mon Dec 18 05:51:53 2017 UTC (6 years, 5 months ago) by cheloha
Branch: MAIN
Changes since 1.52: +5 -13 lines
Diff to previous 1.52 (colored)

Add the CLOCK_BOOTTIME clockid for use with clock_gettime(2)
and put it to use in userspace in lieu of the kern.boottime
sysctl.

Its absolute value is the time that has elapsed since the
system booted, i.e., the system uptime.

Use in top(1), w(1), and snmpd(8) eliminates a race with
settimeofday(2), adjtime(2), etc. inherent to deriving the
system uptime via the kern.boottime sysctl.

Product of a great deal of discussion/revision with jca@, tb@,
and guenther@.

ok tb@ jca@ guenther@ dlg@ mlarkin@ tom@

Revision 1.52 / (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_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

annoying whitespace die die die

Revision 1.51 / (download) - annotate - [select for diffs], Sat Aug 27 04:07:42 2016 UTC (7 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.50: +2 -1 lines
Diff to previous 1.50 (colored)

Pull in <sys/time.h> for struct timespec and timeval

ok deraadt@

Revision 1.50 / (download) - annotate - [select for diffs], Mon Oct 26 12:44:22 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.49: +45 -1 lines
Diff to previous 1.49 (colored)

print uptime too. ok deraadt

Revision 1.49 / (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.48: +2 -1 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Thu Nov 27 14:08:01 2014 UTC (9 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

All cpus -> N Cpus
"makes sense" theo

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jan 14 02:44:57 2014 UTC (10 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.46: +7 -4 lines
Diff to previous 1.46 (colored)

getnstr() returns KEY_RESIZE if there was a pending resize event, so loop
until it stops returning that, resetting the cursor position each time.

hint from Gregor Best (gbe (at) ring0.de)
problem noted by and ok sthen@

Revision 1.46 / (download) - annotate - [select for diffs], Thu Nov 28 18:24:55 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

unsigned char for ctype
ok krw okan

Revision 1.45 / (download) - annotate - [select for diffs], Mon Jan 14 21:35:08 2013 UTC (11 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.44: +2 -2 lines
Diff to previous 1.44 (colored)

Remove an unnecessary function cast

ok jsing@

Revision 1.44 / (download) - annotate - [select for diffs], Mon Jan 14 21:33:59 2013 UTC (11 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.43: +11 -20 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Tue Jun 5 18:52:53 2012 UTC (11 years, 11 months ago) by brynet
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

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

feedback & ok lum@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Apr 15 19:52:16 2012 UTC (12 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

Move the check for a <0 number of process display_lines to a better place.
This makes:
This terminal can only display -N processes.
a thing of the past.

Revision 1.41 / (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.40: +2 -2 lines
Diff to previous 1.40 (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.40 / (download) - annotate - [select for diffs], Fri Apr 23 09:26:13 2010 UTC (14 years ago) by otto
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.39: +8 -3 lines
Diff to previous 1.39 (colored)

show hostname in header line; ok lum@ phessler@

Revision 1.39 / (download) - annotate - [select for diffs], Wed Mar 24 05:03:15 2010 UTC (14 years, 1 month ago) by lum
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

Document updating the display using the space-bar.
ok jmc@ otto@

Revision 1.38 / (download) - annotate - [select for diffs], Thu Mar 18 12:52:06 2010 UTC (14 years, 2 months ago) by otto
Branch: MAIN
Changes since 1.37: +3 -2 lines
Diff to previous 1.37 (colored)

make the 'e' command work, from Mark Lumsden

Revision 1.37 / (download) - annotate - [select for diffs], Fri Feb 5 10:21:10 2010 UTC (14 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.36: +2 -4 lines
Diff to previous 1.36 (colored)

Header_lines always has the same value as y_procs; so zap the former;
from Mark Lumsden.

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

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

Revision 1.35 / (download) - annotate - [select for diffs], Tue Dec 22 15:06:56 2009 UTC (14 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

add -1 to show_help(); from Mark Lumsden

Revision 1.34 / (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.33: +57 -30 lines
Diff to previous 1.33 (colored)

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

Revision 1.33 / (download) - annotate - [select for diffs], Fri Nov 30 10:39:01 2007 UTC (16 years, 5 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.32: +5 -16 lines
Diff to previous 1.32 (colored)

Simplify process header display logic a bit. From Mark Lumsden

Revision 1.32 / (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.31: +8 -9 lines
Diff to previous 1.31 (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.31 / (download) - annotate - [select for diffs], Thu Nov 1 19:10:32 2007 UTC (16 years, 6 months ago) by otto
Branch: MAIN
Changes since 1.30: +9 -50 lines
Diff to previous 1.30 (colored)

cleanup of message handling, originally from Mark Lumsden, with a
twist by me. ok deraadt@

Revision 1.30 / (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.29: +153 -136 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun Sep 30 13:26:39 2007 UTC (16 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.28: +1 -4 lines
Diff to previous 1.28 (colored)

unused static var; from Mark Lumsden

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

size_t vs ssize_t error; spotted by zinovik@cs.karelia.ru

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

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

Revision 1.26 / (download) - annotate - [select for diffs], Fri Jul 27 13:57:50 2007 UTC (16 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +5 -5 lines
Diff to previous 1.25 (colored)

replace a few more malloc(n*m) idioms with calloc(n,m) for safety;
inspired by zinovik@cs.karelia.ru

Revision 1.25 / (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.24: +236 -446 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Fri Mar 30 19:21:19 2007 UTC (17 years, 1 month ago) by otto
Branch: MAIN
Changes since 1.23: +1 -4 lines
Diff to previous 1.23 (colored)

Remove some uneeded includes and declarations. -Wall is happy and no
binary change. From Mark Lumsden.

Revision 1.23 / (download) - annotate - [select for diffs], Sat Mar 4 06:58:11 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.22: +1 -29 lines
Diff to previous 1.22 (colored)

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

Revision 1.22 / (download) - annotate - [select for diffs], Fri Jul 1 19:33:35 2005 UTC (18 years, 10 months ago) by jaredy
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.21: +3 -2 lines
Diff to previous 1.21 (colored)

NUL-terminate the screen buffer in u_process(), since it is passed to
strlen() in line_buffer() (requires allocating an extra byte for it).

from markus, ok deraadt

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 17 12:12:28 2005 UTC (18 years, 11 months ago) by markus
Branch: MAIN
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

replace hardcoded 128 with MAX_COLS (now 256)

Revision 1.20 / (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.19: +160 -92 lines
Diff to previous 1.19 (colored)

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

Revision 1.19 / (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.18: +2 -2 lines
Diff to previous 1.18 (colored)

use STD{IN,OUT,ERR}_FILENO

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jun 13 18:49:02 2004 UTC (19 years, 11 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Typos in comments and a redundant prototype. From Brian Poole via jmc@
ok jmc@

Revision 1.17 / (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.16: +11 -2 lines
Diff to previous 1.16 (colored)

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

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jun 19 22:40:45 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.15: +48 -26 lines
Diff to previous 1.15 (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.15 / (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.14: +1 -5 lines
Diff to previous 1.14 (colored)

remove unused variables

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jun 13 21:52:24 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.13: +671 -812 lines
Diff to previous 1.13 (colored)

readable code

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jun 13 04:29:59 2003 UTC (20 years, 11 months ago) by pvalchev
Branch: MAIN
Changes since 1.12: +7 -4 lines
Diff to previous 1.12 (colored)

use proper varargs(3), as opposed to a hack; ok millert

Revision 1.12 / (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.11: +57 -116 lines
Diff to previous 1.11 (colored)

cleanup; ok deraadt

Revision 1.11 / (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.10: +22 -5 lines
Diff to previous 1.10 (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.10 / (download) - annotate - [select for diffs], Wed Jun 12 06:07:16 2002 UTC (21 years, 11 months ago) by mpech
Branch: MAIN
Changes since 1.9: +6 -6 lines
Diff to previous 1.9 (colored)

a real pid_t cleanup.

espie@ ok for make/,
deraadt@ one extra eye,
millert@ ok

Revision 1.9 / (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.8: +5 -5 lines
Diff to previous 1.8 (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.8 / (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.7: +53 -53 lines
Diff to previous 1.7 (colored)

kill more registers

millert@ ok

Revision 1.7 / (download) - annotate - [select for diffs], Mon Sep 3 18:08:10 2001 UTC (22 years, 8 months ago) by camield
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

don't print zero values on processes line

ok millert@

Revision 1.6 / (download) - annotate - [select for diffs], Fri Aug 24 20:16:35 2001 UTC (22 years, 8 months ago) by art
Branch: MAIN
Changes since 1.5: +2 -3 lines
Diff to previous 1.5 (colored)

Display even zeros so that the swap output makes more sense.
From Brian Poole <raj@cerias.purdue.edu>

Revision 1.5 / (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.4: +71 -33 lines
Diff to previous 1.4 (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.4 / (download) - annotate - [select for diffs], Sat Mar 6 20:27:42 1999 UTC (25 years, 2 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.3: +16 -20 lines
Diff to previous 1.3 (colored)

back out changes that should not have escaped my local tree

Revision 1.3 / (download) - annotate - [select for diffs], Sat Mar 6 20:19:21 1999 UTC (25 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.2: +21 -17 lines
Diff to previous 1.2 (colored)

add missing reference to infocmp

Revision 1.2 / (download) - annotate - [select for diffs], Fri Aug 22 07:16:27 1997 UTC (26 years, 9 months ago) by downsj
Branch: MAIN
CVS Tags: 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: +55 -51 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:21 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.