aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/ktrdump/ktrdump.c
Commit message (Collapse)AuthorAgeFilesLines
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-2/+1
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* Add a "live" mode to ktrdump.John Baldwin2018-10-221-12/+57
| | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=339620
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+1
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=326276
* Provide an error message if KTR symbols in a vmcore cannot be resolved.Mark Johnston2017-09-111-2/+7
| | | | | | | | | | libkvm does not set an error string in this case, so we were previously failing silently. MFC after: 1 week Notes: svn path=/head/; revision=323439
* ktrdump(8): CapsicumifyConrad Meyer2016-12-161-0/+32
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=310142
* Change ktrdump to use the more standard -M/-N flags to specify the pathJohn Baldwin2015-02-061-8/+10
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=278327
* Don't dump entries that were modified during the time the KTR buffer was beingNeel Natu2014-03-141-3/+11
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=263196
* Fix an issue with ktrdump(8) where it would not print all entries in theNeel Natu2014-03-141-3/+7
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=263194
* Print the ktr(4) format line that caused a failure.Gleb Smirnoff2014-01-171-1/+1
| | | | | | | Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=260810
* - Implement run-time expansion of the KTR buffer via sysctl.Jeff Roberson2012-11-151-2/+4
| | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=243046
* Catch up with r238925. ktr_entries may not be a power of 2.Navdeep Parhar2012-10-301-2/+2
| | | | Notes: svn path=/head/; revision=242378
* Add -H flag to print thread id.Dmitry Chagin2011-01-261-2/+12
| | | | Notes: svn path=/head/; revision=217873
* Remove unnecessary opt* definations.Xin LI2009-02-211-3/+0
| | | | Notes: svn path=/head/; revision=188890
* Skip format flags, when parsing ktr_desc.Gleb Smirnoff2006-01-121-1/+7
| | | | Notes: svn path=/head/; revision=154274
* Really fix the relative timestamp bug. It was only incorrect for the ALQNate Lawson2005-12-091-1/+2
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=153270
* Fix -r flag to actually work. "now" comes after "then", not vice versa.Nate Lawson2005-12-061-1/+1
| | | | | | | MFC after: 1 day Notes: svn path=/head/; revision=153170
* Append a newline character to the usage string.Christian S.J. Peron2005-06-051-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=147034
* Sync program's usage() with manpage's SYNOPSIS.Ruslan Ermilov2005-05-211-2/+4
| | | | Notes: svn path=/head/; revision=146466
* Don't use an uninitialised variable when reading from a ktr alq file.Julian Elischer2004-09-271-1/+1
| | | | Notes: svn path=/head/; revision=135842
* Add a "-r" flag to ktrdump(1) to print relative timestamps when usedRobert Watson2004-05-221-5/+19
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=129574
* Add a quiet mode to ktrdump(1): if the "-q" flag is used, don't printRobert Watson2004-05-211-20/+27
| | | | | | | | the pretty text header on top of the output. Simplifies feeding the results of tracing into a script for mechanical processing. Notes: svn path=/head/; revision=129559
* When the 'f' flag is passed to ktrdump(1), use 40 characters for theRobert Watson2004-05-211-1/+1
| | | | | | | | | "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. Notes: svn path=/head/; revision=129558
* Remove an unused variable.David Malone2004-02-151-1/+0
| | | | Notes: svn path=/head/; revision=125858
* Use strlcpy() instead of strcpy() to not overflow static buffers.Kris Kennaway2002-10-061-2/+6
| | | | Notes: svn path=/head/; revision=104586
* - Add the -i option to read in a saved ktr file output by KTR_ALQ.Jeff Roberson2002-09-221-13/+41
| | | | Notes: svn path=/head/; revision=103791
* 1. Add missing include of stdint.h.Jake Burkholder2002-04-021-2/+3
| | | | | | | | | 2. Fix reversed arguments to strcpy. Noticed by: davidc (2) Notes: svn path=/head/; revision=93617
* ktrdump is a utility to dump the ktr trace buffer from userland. It canJake Burkholder2002-04-011-0/+236
also be run on a core dump. Notes: svn path=/head/; revision=93504