HomeFreeBSD

Add a "live" mode to ktrdump.

Description

Add a "live" mode to ktrdump.

Support a "live" mode in ktrdump enabled via the -l flag. In this
mode, ktrdump polls the kernel's trace buffer periodically (currently
hardcoded as a 50 millisecond interval) and dumps any newly added
entries. Fancier logic for the timeout (e.g. a command line option or
some kind of backoff based on the time since the last entry) can be
added later as the need arises.

While here, fix some bugs from when this was Capsicum-ized:

  • Use caph_limit_stream() for the output stream so that isatty() works and the output can be line-buffered (especially useful for live mode).
  • Use caph_limit_stderr() to permit error messages to be displayed if an error occurs after cap_enter().

Reviewed by: kib, 0mp (manpage)
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D17315

Details

Provenance
jhbAuthored on
Reviewer
kib
Differential Revision
D17315: Add a "live" mode to ktrdump.
Parents
rS339619: A couple of style fixes in recent TCP changes.
Branches
Unknown
Tags
Unknown