Page MenuHomeFreeBSD

Upgrade top(1) to 3.8-beta1
Needs ReviewPublic

Authored by on May 30 2016, 4:24 AM.
Referenced Files
Unknown Object (File)
Fri, May 5, 2:22 AM
Unknown Object (File)
Apr 19 2023, 5:11 PM
Unknown Object (File)
Mar 31 2023, 8:40 AM
Unknown Object (File)
Mar 18 2023, 3:39 AM
Unknown Object (File)
Mar 3 2023, 12:18 AM
Unknown Object (File)
Feb 18 2023, 7:38 PM
Unknown Object (File)
Feb 16 2023, 8:45 PM
Unknown Object (File)
Feb 16 2023, 8:36 PM


Group Reviewers

This diff upgrades top(1) from 3.5-beta12 to 3.8-beta1. Upstream changed significantly between these releases. The following list shows notable upstream changes:

  • The process count in the header counts system processes regardless of whether they're displayed (-S). Previous behavior was to only count them if they're being displayed.
  • The uptime field in the header now matches uptime(1). Previously, it was 30 seconds behind.
  • top(1) now supports color via the TOPCOLORS environment variable.
  • Process priority is no longer normalized by subtracting PZERO.
  • There's a new summary line for the kernel, with per-second rates for context switches, traps, page faults, etc.

I made the following changes from the upstream version in vendor/top/dist:

  • Implement jail ID display column. The runtime command 'j' and command-line option -j toggle display of the column.
  • Implement filtering by jail with the runtime command 'J' and command-line option -J, with the same semantics as the previous version.
  • Implement display of an ARC summary line for systems with ZFS. This includes color tag support.
  • Implement the lastpid field in the freebsd-specific code so that it appears in the interface.
  • Replace strcpy() with strlcpy().
  • Add static assertion in utils.c to warn of problems if sizeof(int) is ever greater than 4.
  • Fix a bug that referenced a nonexistent sysctl in m_freebsd.c: s/smp.smp_active/
  • Pass _PATH_DEVNULL as second arg to kvm_open() to allow non-root users to view process command lines.
  • Patch thread display to show thread name to maintain behavior of previous version.
  • Make -m take 'cpu' and 'io' in addition to '0' and '1' to keep the behavior of our patch.
  • Make -H an alias for -t to preserve old behavior.
  • Document all modified behavior in the man page.

Remaining problems:

  • Displaying full command lines doesn't work because kvm_read() in m_freebsd.c returns "short read" (0 bytes). I'm not sure why.
  • There are conflicting arguments between upstream and FreeBSD's local patches:

    Conflicting runtime commands: CMD OLD NEW C toggle CPU/WCPU toggle color P toggle per-CPU statistics sort by CPU usage t toggle display of this process alias for H (display threads)

    Old commands not yet ported: CMD OLD NEW e show last error from kill/renice - z toggle display of system idle process - a toggle full process titles -

    Conflicting arguments: CMD OLD NEW -C toggle CPU/WCPU display toggle color -a show full command names don't limit number of processes -t do not display this process show threads

    Old arguments not yet ported: CMD OLD NEW -P per-CPU statics - -z do not show the system idle process -

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Tests Skipped

Event Timeline retitled this revision from to Upgrade top(1) to 3.8-beta1. updated this object. edited the test plan for this revision. (Show Details) added a reviewer: ngie. set the repository for this revision to rS FreeBSD src repository - subversion.