Page MenuHomeFreeBSD

Upgrade top(1) to 3.8-beta1
Needs ReviewPublic

Authored by rwestlun_gmail.com on May 30 2016, 4:24 AM.

Details

Reviewers
ngie
eadler
Group Reviewers
manpages
Summary

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/kern.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

Repository
rS FreeBSD src repository
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

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