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
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
No functional change intended.
We restrict the (optional) input file and output files. It would be
nice to restrict the KVM files, but that's up to libkvm.
We wait until after kvm_nlist() is invoked to cap_enter() because
kldsym() isn't supported in the Capsicum sandbox.
Feedback from: emaste@ (earlier versions)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D7921
Unfortunately filemon/meta mode tracks all indirect dependencies here
since ld(1) is reading libelf when linking in libkvm. Churn would be
reduced if this was able to be limited to direct dependencies.
Sponsored by: EMC / Isilon Storage Division
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.
Still need to add real targets under targets/ to build packages.
Differential Revision: D2796
Reviewed by: brooks imp
to a crash dump and kernel, respectively. The existing -m/-e flags are
still supported for backwards compatiblity but are no longer documented.
Requested by: np
MFC after: 2 weeks
copied to userspace. Failing to do this would result in entries at the bottom
of the ktrdump output to be more recent than entries at the top.
With this change the timestamps are monotonically decreasing going from the
top to the bottom of the ktrdump output.
KTR buffer.
This happens when 'i' tries to wrap around from 0 to 'entries - 1'. Since 'i'
is a signed integer the modulo operation actually returns a negative number.
Fix this by computing the next index to use "by hand" instead of relying
on the modulo operator.
- Implement a function to ensure that all preempted threads have switched
back out at least once. Use this to make sure there are no stale
references to the old ktr_buf or the lock profiling buffers before
updating them.
Reviewed by: marius (sparc64 parts), attilio (earlier patch)
Sponsored by: EMC / Isilon Storage Division
case. It seems entries are in reverse order when read from the kernel
memory but in the right order when read from a file (i.e. ALQ). Handle
both cases.
MFC after: 1 day
with "-t" rather than absolute timestamps. This allows the reader
to get a better sense of latency between events, such as time to
schedule an interrupt thread from time the interrupt occurred. Assert
a copyright on ktrdump.c since I seem to be modifying it more than I
thought.
"file and line" field consistently; previously, a 32-character field
length was used for the table header, which resulted in the header
not lining up with the table.