Commit Graph

155 Commits

Author SHA1 Message Date
John Baldwin
01a36e296d Allow the -p argument to kdump to accept either a PID or a thread ID.
Submitted by:	Dmitry Banschikov  d.banschikov hostcomm ru
MFC after:	1 week
2012-06-04 19:09:14 +00:00
Alexander Motin
f6ad3f237a MFprojects/zfsd:
Revamp the CAM enclosure services driver.
This updated driver uses an in-kernel daemon to track state changes and
publishes physical path location information\for disk elements into the
CAM device database.

Sponsored by:   Spectra Logic Corporation
Sponsored by:   iXsystems, Inc.
Submitted by:   gibbs, will, mav
2012-05-24 14:07:44 +00:00
John Baldwin
88bf5036fc Include the associated wait channel message for context switch ktrace
records.  kdump supports both the old and new messages.

Submitted by:	Andrey Zonov  andrey zonov org
MFC after:	1 week
2012-04-20 15:32:36 +00:00
Dimitry Andric
c1b2e4fc21 In kdump's mkioctls script, use '${CPP}' instead of hardcodedly using
'gcc -E'.  This fixes building when WITH_CLANG_IS_CC is in effect.

Report by:	Niclas Zeising <zeising@daemonic.se>
MFC after:	1 week
2012-04-09 14:47:18 +00:00
John Baldwin
35818d2e94 Add new ktrace records for the start and end of VM faults. This gives
a pair of records similar to syscall entry and return that a user can
use to determine how long page faults take.  The new ktrace records are
enabled via the 'p' trace type, and are enabled in the default set of
trace points.

Reviewed by:	kib
MFC after:	2 weeks
2012-04-05 17:13:14 +00:00
John Baldwin
9fd52232b8 Fix style in previous commit.
Submitted by:	bde
2012-02-24 20:12:53 +00:00
John Baldwin
145e6aa9f8 Pretty-print the advice constants passed to posix_fadvise(2).
MFC after:	2 weeks
2012-02-23 21:08:21 +00:00
Dag-Erling Smørgrav
c04743dac1 It turns out that truss also used kdump's mkioctls script, and expected
ioctlname() to return a pointer to the name rather than print it.  This did
not show up in testing because truss had its own prototype for ioctlname(),
so it would build fine and run fine as long as the program being traced did
not issue an ioctl.

Teach mkioctls to generate different versions of ioctlname() based on its
first command-line argument.

Pointed out by:	Garrett Cooper <yanegomi@gmail.com>
2011-10-21 11:08:25 +00:00
Dag-Erling Smørgrav
60e45df8ed Fix copy-pasto in CAPFAIL_INCREASE case.
Noticed by:	pjd
2011-10-18 09:39:41 +00:00
Dag-Erling Smørgrav
e141be6f79 Revisit the capability failure trace points. The initial implementation
only logged instances where an operation on a file descriptor required
capabilities which the file descriptor did not have.  By adding a type enum
to struct ktr_cap_fail, we can catch other types of capability failures as
well, such as disallowed system calls or attempts to wrap a file descriptor
with more capabilities than it had to begin with.
2011-10-18 07:28:58 +00:00
Dag-Erling Smørgrav
51b6c61f98 Clean up mkioctls a bit, and fix cross-building by checking ${MACHINE}
instead of $(uname -m).

Pointed out by:	nyan@
2011-10-13 16:29:24 +00:00
Dag-Erling Smørgrav
81a3139422 Make kdump compile cleanly at WARNS level 6, with one exception: the
ipfilter headers contain a duplicated function declaration.  Turn off
-Werror to allow kdump to compile in spite of this.

It would be neat to be able to turn off -Werror on a file-by-file basis...

PR:		bin/161478
Submitted by:	Garrett Cooper <yanegomi@gmail.com>
2011-10-12 21:45:12 +00:00
Dag-Erling Smørgrav
c601ad8eeb Add a new trace point, KTRFAC_CAPFAIL, which traces capability check
failures.  It is included in the default set for ktrace(1) and kdump(1).
2011-10-11 20:37:10 +00:00
Dag-Erling Smørgrav
661522f5f3 The previous commit did not fix the issue since it did not prevent sign
extension.  Cast to u_register_t first, then to uintmax_t.

Submitted by:	bde@
2011-10-11 15:04:58 +00:00
Dag-Erling Smørgrav
63a896e49b Cast to unsigned for %#jx.
Noticed by:	jh@
2011-10-11 07:46:45 +00:00
Dag-Erling Smørgrav
95bb676aee Address some of bde@'s concerns with the new code. 2011-10-08 21:02:08 +00:00
Dag-Erling Smørgrav
515dfc239d Teach kdump(1) to decode capability bitmasks.
MFC after:	3 weeks
2011-10-08 13:01:38 +00:00
Dag-Erling Smørgrav
6eaa54110b Fix the dependency issue properly by a) moving kdump_subr.c to the front
of the SRCS list and b) listing kdump_subr.h in DPSRCS.
2011-10-08 12:59:41 +00:00
Dag-Erling Smørgrav
d09e66be12 Bring ioctlname() in line with all the other *name() functions, which
actually print the name (or the numeric value, if they can't figure out
the correct name) instead of just returning a pointer to it.  Also, since
ioctl numbers are not and probably never will be unique, drop support for
using a switch statement instead of an if/else chain.
2011-10-08 12:47:00 +00:00
Dag-Erling Smørgrav
09307b2547 I appreciate the logic behind using a (void) cast to indicate that the
return value is intentionally ignored, but frankly, all it does is
get in the way of the code.

Also fix a few other incorrect casts, such as (void *)malloc(foo) and
passing signed values to %x.
2011-10-08 12:28:06 +00:00
Dag-Erling Smørgrav
e4bb45b1ce Fix casting. 2011-10-08 12:21:51 +00:00
Dag-Erling Smørgrav
c02541ee80 Whitespace. 2011-10-08 12:10:16 +00:00
Dag-Erling Smørgrav
73430055e6 C has had swicth statements for 40 years or so. It's about time we
started using them.
2011-10-08 11:51:48 +00:00
Dag-Erling Smørgrav
77e23dbe07 Sort and line up. 2011-10-08 11:39:00 +00:00
Dag-Erling Smørgrav
34bb8e6d12 1) Some of the #defines or enums for which we auto-generate naming
functions may be wider than int, so use intmax_t throughout.  Also
   add missing casts in printf() calls.

2) Clean up some of the auto-generated code to improve readability.

3) Auto-generate kdump_subr.h.  Note that this requires a semi-ugly hack
   in the Makefile to make sure it is generated before make(1) tries to
   build kdump.c, or preprocess it for 'make depend'.

MFC after:	3 weeks
2011-10-08 09:57:29 +00:00
Alexander Leidinger
b66e74b695 Add 2-clause BSD license.
Approved by:	David Kirchner <dpk@dpk.net> (initial author)
Requested by:	Otto Moerbeek <otto@drijf.net>
MFC after:	1 week
2011-06-17 06:12:28 +00:00
Dmitry Chagin
27242311a3 Fix regex for ptraceopname().
PR:		bin/157663
Submitted by:	jason wright <jason@thought.net>
MFC after:	10 days
2011-06-06 19:00:38 +00:00
Jilles Tjoelker
a4a1c5b11e kdump: Show code for signals where the default action was taken.
This information is available as of kernel r220740. Trace files from older
kernels will always have 0.

MFC after:	1 week
2011-04-17 21:11:55 +00:00
Dmitry Chagin
dde5f9b938 Teach kdump to decode linux syscalls names too.
Fix bug introduced in my previous commit: the kernel always dump native
signal numbers, so no need to check the ABI in ktrpsig().

Suggested by:	jhb
MFC after:	1 Month.
2011-03-01 16:42:28 +00:00
Dmitry Chagin
a30c325c64 Update manual page to reflect latest changes of ABI description support.
MFC after:	1 Month.
2011-02-25 22:14:12 +00:00
Dmitry Chagin
7144d36fab Teach kdump to understand sv_flags records in the trace files.
MFC after:	1 Month.
2011-02-25 22:07:23 +00:00
Joel Dahl
da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Xin LI
706d26a4a4 Decode IPC_CREAT and IPC_EXCL for semget(2).
PR:		bin/152781
Submitted by:	Anton Yuzhaninov <citrin citrin ru>
MFC after:	2 weeks
2010-12-02 18:24:22 +00:00
John Baldwin
c23d84a86b Correct the abbreviations for general I/O and signal traces.
PR:		docs/151854
Submitted by:	Stephen Veiss  stephen of brokenbottle net
MFC after:	3 days
2010-11-01 15:18:57 +00:00
Alexander Leidinger
57db56459a Fix regex for some socket- and acl-related syscall values.
Submitted by:	Mikhail <hidden.node@gmail.com>
PR:		149295
MFC-after:	2 weeks
2010-10-06 12:41:42 +00:00
Rui Paulo
bd0f1ee24f Fix indenting of the previous commit. 2010-09-16 11:40:41 +00:00
Rui Paulo
836450ab23 When generating functions to print the arguments of system calls with
bitwise parameters (e.g. mmap), print the syscall parameter value first.
The resulting output looks like the %b specifier of printf(9).

Before:
mmap(0,0x8000,PROT_READ|PROT_WRITE,...
After:
mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,...

Submitted by:	Norberto Lopes <nlopes.ml at gmail.com>
Idea from:	freebsd-arch/2006-April/005116.html
2010-09-16 11:33:31 +00:00
Ed Schouten
99742a231f Change all our own code to use st_*tim instead of st_*timespec.
Also remove some local patches to diff(1) which are now unneeded.
2010-03-28 13:16:08 +00:00
Warner Losh
30c1278f14 The kdump data stream is an unaligned data stream for stat and
sockaddr structures.  As such, we have top copy the data structure
into a local buffer before we can reference it, otherwise we have
unaligned references (these are fixed up automatically on some CPUs,
but not on others).  We do this unconditionally to make the code
easier to read and understand.

Submitted by:	Grzegorz Bernacki
2010-02-18 16:05:09 +00:00
Jaakko Heinonen
c065c0b8e1 - Cast intptr_t, pid_t and time_t values to intmax_t and use %jd with
printf.
- Cast the system call return value to long and use %ld in a printf in
  ktrsysret().

PR:		bin/123774
MFC after:	2 weeks
2010-02-06 16:01:38 +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
Colin Percival
22ce05c97c Update malloc utrace structure parsing to reflect the change (r199265)
in how malloc_init is logged from (0, 0, 0) to (-1, 0, 0).

While we're here, simplify the logic.

Reviewed by:	jhb (earlier version)
2009-11-14 09:33:51 +00:00
Attilio Rao
48f6dd8a8c Use a safety belt for cases where corrupted narg can be passed to the
ktrsyscall(). print_number() does decrement the number of arguments,
leading to infinite loops for negative values.

Reported by:	Patrick Lamaiziere <patpr at davenulle dot org>,
		Jonathan Pascal <jkpyvxmzsa at mailinator dot com>
Submitted by:	jh
PR:		bin/120055, kern/119564
MFC:		1 week
2009-11-07 21:46:34 +00:00
Bjoern A. Zeeb
da1b35844b Remove no longer needed #include after removing the legacy
vimage API in r195741.

Reviewed by:	rwatson
Approved by:	re (kib)
2009-07-18 10:36:18 +00:00
Marko Zec
1f7fcb28e6 Unbreak buildworld.
(not waiting for an approval from mentor (julian) due to emergency)
2009-05-31 15:41:46 +00:00
Andrew Thompson
11c63ede84 Delete the old USB stack. The new stack has settled in and has all the
drivers/functionality and then some.
2009-05-27 16:16:56 +00:00
Ed Schouten
4b54fa116c Fix kdump build when building it by hand.
I don't entirely like this approach, but it will only be temporarily,
namely until we get rid of COMPAT_43TTY. I do want <sys/ioctl_compat.h>
to cause a compiler error when included, because it's just there for
binary compatibility.

Reported by:	Andrzej Tobola <ato iem pw edu pl>
2009-05-25 20:07:41 +00:00
Ed Schouten
f31b4b6a80 Add support for old TTY ioctls to kdump.
At first I allowed ioctl_compat.h to be included, but it just returned
an empty file. I had to do this, to keep kdump happy. I really want to
raise a compiler error when including this header, so now it will just
throw an error if you don't set COMPAT_43TTY.
2009-05-09 15:09:40 +00:00
Xin LI
1a604cfa07 Add two missing include files and prototype for sockfamilyname()
which is generated by mksubr.
2009-03-20 18:29:52 +00:00
John Baldwin
a56be37e68 Add a new type of KTRACE record for sysctl(3) invocations. It uses the
internal sysctl_sysctl_name() handler to map the MIB array to a string
name and logs this name in the trace log.  This can be useful to see
exactly which sysctls a thread is invoking.

MFC after:	1 month
2009-03-11 21:48:36 +00:00