Commit graph

62 commits

Author SHA1 Message Date
Warner Losh 5e3934b15a usr.bin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:01 -07:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Alfonso Gregory a1b6427a97 Mark usage function as __dead2 in programs where it does not return
In most cases, usage does not return, so mark them as __dead2. For the
cases where they do return, they have not been marked __dead2.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/735
2023-07-07 10:45:18 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Gleb Smirnoff dcb724b5a7 ktrdump: properly parse %% in the format string
Discovered by:	27ca37acb7
2021-12-29 23:08:15 -08:00
Dmitry Chagin 9e5aeba51b Fix warning about signed comparison and drop WARNS for ktrdump(8).
Reviewed By:		jhb, imp
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D29381
2021-03-24 10:51:25 +03:00
Mariusz Zaborski 377421df96 capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
2018-11-04 19:24:49 +00:00
John Baldwin 4403657034 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
2018-10-22 21:25:28 +00:00
Mariusz Zaborski 7672a0148f Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0.
No functional change intended.
2018-06-19 23:43:14 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
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.
2017-11-27 15:37:16 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Mark Johnston 8e15d40d24 Provide an error message if KTR symbols in a vmcore cannot be resolved.
libkvm does not set an error string in this case, so we were previously
failing silently.

MFC after:	1 week
2017-09-11 15:18:43 +00:00
Bryan Drewery 07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Conrad Meyer 208a859459 ktrdump(8): Capsicumify
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
2016-12-16 01:59:28 +00:00
Bryan Drewery cf990407e1 Update dependencies after r291406 added libelf to libkvm.
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
2015-12-01 05:18:48 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
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
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
John Baldwin 330c544318 Change ktrdump to use the more standard -M/-N flags to specify the path
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
2015-02-06 19:41:23 +00:00
Baptiste Daroussin 3e11bd9e2a Convert to usr.bin/ to LIBADD
Reduce overlinking
2014-11-25 14:29:10 +00:00
Simon J. Gerraty ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin 2b7af31cf5 use .Mt to mark up email addresses consistently (part3)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:23:05 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty 76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty 3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Neel Natu 3447a66db8 Don't dump entries that were modified during the time the KTR buffer was being
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.
2014-03-14 22:07:08 +00:00
Neel Natu f8c8b7ee8f Fix an issue with ktrdump(8) where it would not print all entries in the
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.
2014-03-14 21:35:16 +00:00
Gleb Smirnoff 0d52168e42 Print the ktr(4) format line that caused a failure.
Sponsored by:	Nginx, Inc.
2014-01-17 09:11:44 +00:00
Simon J. Gerraty 7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Jeff Roberson 28d91af30f - Implement run-time expansion of the KTR buffer via sysctl.
- 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
2012-11-15 00:51:57 +00:00
Simon J. Gerraty 23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Navdeep Parhar 913f53dc29 Catch up with r238925. ktr_entries may not be a power of 2. 2012-10-30 21:10:06 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Dmitry Chagin 718f2aed09 Add -H flag to print thread id. 2011-01-26 06:36:14 +00:00
Ed Schouten b7946da96b Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
Xin LI 612f2a0575 Remove unnecessary opt* definations. 2009-02-21 03:53:06 +00:00
Gleb Smirnoff e5ed7bcc74 Skip format flags, when parsing ktr_desc. 2006-01-12 22:32:07 +00:00
Nate Lawson ee574da534 Really fix the relative timestamp bug. It was only incorrect for the ALQ
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
2005-12-09 14:27:03 +00:00
Nate Lawson c578cf5e86 Fix -r flag to actually work. "now" comes after "then", not vice versa.
MFC after:	1 day
2005-12-06 14:13:39 +00:00
Ruslan Ermilov 39c59153e9 Markup and wording fixes.
Approved by:	re (blanket)
2005-06-14 11:50:53 +00:00
Christian S.J. Peron 671cff5aec Append a newline character to the usage string.
MFC after:	3 days
2005-06-05 23:49:35 +00:00
Ruslan Ermilov f682f10c76 Sync program's usage() with manpage's SYNOPSIS. 2005-05-21 09:55:10 +00:00
Hiten Pandya 9e1fb7fbad Document the '-i' option which allows the user to specify a ktr events
log file.
2005-03-08 06:58:56 +00:00
Julian Elischer c7f4c39534 Don't use an uninitialised variable when reading from a ktr alq file. 2004-09-27 05:56:57 +00:00
Ruslan Ermilov 2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00