]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a "live" mode to ktrdump.
authorjhb <jhb@FreeBSD.org>
Mon, 22 Oct 2018 21:25:28 +0000 (21:25 +0000)
committerjhb <jhb@FreeBSD.org>
Mon, 22 Oct 2018 21:25:28 +0000 (21:25 +0000)
commitdf51d482a8efb12e7224c7e423b8a8237d048b82
treec345b27bcf900a3eadb3643515b44c4dc573f1cd
parent439be2ca2b9d2dbf92dc465d1f03952f5deb6574
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
usr.bin/ktrdump/ktrdump.8
usr.bin/ktrdump/ktrdump.c