Page MenuHomeFreeBSD

Add a "live" mode to ktrdump.
ClosedPublic

Authored by jhb on Sep 25 2018, 6:07 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 10 2024, 1:50 AM
Unknown Object (File)
Nov 10 2023, 10:21 PM
Unknown Object (File)
Nov 10 2023, 8:47 AM
Unknown Object (File)
Nov 9 2023, 2:21 PM
Unknown Object (File)
Nov 5 2023, 4:59 PM
Unknown Object (File)
Oct 9 2023, 9:18 PM
Unknown Object (File)
Oct 9 2023, 7:43 AM
Unknown Object (File)
Oct 6 2023, 1:09 PM
Subscribers

Details

Summary

Support a "live" mode in ktrdump enabled via the -l flag. In this mode,
ktrdump polls the kernel's trace buffer periodiocally (currently hardcoded
as a 50 millisecond interval) and dumps any newly added entries.

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().
Test Plan
  • used to debug a ptrace issue with KTR_PTRACE

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib added inline comments.
usr.bin/ktrdump/ktrdump.c
383 ↗(On Diff #48441)

I suspect that some users would want a configurable interval. Also, it might make sense to compare the times between start of previous run and now, instead of introducing constant delays.

This revision is now accepted and ready to land.Sep 25 2018, 8:38 PM
jhb marked an inline comment as done.Sep 25 2018, 8:56 PM
jhb added inline comments.
usr.bin/ktrdump/ktrdump.c
383 ↗(On Diff #48441)

I thought about making the interval configurable. I did kind of figure if someone really wants it or wants fancier logic then that could be done as a followup change. I can maybe note that in the commit log.

0mp added a subscriber: 0mp.

The manpage update seems fine.

usr.bin/ktrdump/ktrdump.8
28 ↗(On Diff #48441)

Remember to dump the date.

This revision was automatically updated to reflect the committed changes.
jhb marked an inline comment as done.