Commit Graph

145 Commits

Author SHA1 Message Date
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
Andrew Thompson
8b446f57a8 Install the old usb headers under /usr/include/legacy/dev/usb as they are
needed by the hal port. This will be removed before 8.0.

Add an exclusion to kdump as some structs will be redefined.

Requested by:	marcus
2009-02-24 00:53:10 +00:00
Robert Watson
e4372ceba0 Remove netatm from HEAD as it is not MPSAFE and relies on the now removed
NET_NEEDS_GIANT.  netatm has been disconnected from the build for ten
months in HEAD/RELENG_7.  Specifics:

- netatm include files
- netatm command line management tools
- libatm
- ATM parts in rescue and sysinstall
- sample configuration files and documents
- kernel support as a module or in NOTES
- netgraph wrapper nodes for netatm
- ctags data for netatm.
- netatm-specific device drivers.

MFC after:	3 weeks
Reviewed by:	bz
Discussed with:	bms, bz, harti
2008-05-25 22:11:40 +00:00
Ruslan Ermilov
da647ae946 Spell -t option's argument by name. 2008-04-02 09:41:29 +00:00
Jeff Roberson
0f33b907d5 - Remove ksethrcmdname. 2008-03-12 11:51:01 +00:00
Dag-Erling Smørgrav
60e15db992 This patch adds a new ktrace(2) record type, KTR_STRUCT, whose payload
consists of the null-terminated name and the contents of any structure
you wish to record.  A new ktrstruct() function constructs and emits a
KTR_STRUCT record.  It is accompanied by convenience macros for struct
stat and struct sockaddr.

In kdump(1), KTR_STRUCT records are handled by a dispatcher function
that runs stringent sanity checks on its contents before handing it
over to individual decoding funtions for each type of structure.
Currently supported structures are struct stat and struct sockaddr for
the AF_INET, AF_INET6 and AF_UNIX families; support for AF_APPLETALK
and AF_IPX is present but disabled, as I am unable to test it properly.

Since 's' was already taken, the letter 't' is used by ktrace(1) to
enable KTR_STRUCT trace points, and in kdump(1) to enable their
decoding.

Derived from patches by Andrew Li <andrew2.li@citi.com>.

PR:		kern/117836
MFC after:	3 weeks
2008-02-23 01:01:49 +00:00
Dag-Erling Smørgrav
5fb6bed92c Revert CLEANDEPFILES commit per ru@'s request; it does not really solve
the problem.  The correct fix will follow.
2008-02-05 08:52:36 +00:00
Dag-Erling Smørgrav
0d7cc1d0eb Normally, when a header file is removed from the build (as i4b headers
were recently), a simple 'make cleandepend; make depend' is sufficient
to keep the tree buildable after a cvs update when doing incremental
builds.

However, kdump and truss use a script which searches for header files
that define ioctls, and generates C code that includes them.  This
script will usually not need updating when a header file is removed,
so the normal dependency mechanism will not realize that it needs to
be re-run.  One is therefore left with code that references dead files
but will only be removed by a full 'make clean', which defeats the
purpose of incremental builds.

To work around this, modify the cleandepend target in bsd.dep.mk to
also remove any files listed in a new variable named CLEANDEPFILES,
and modify kdump's and truss's Makefiles accordingly.

MFC after:	2 weeks
2008-02-03 11:34:56 +00:00
Dag-Erling Smørgrav
72d1e737b5 These are files are shell scripts; give smart editors a chance to figure
it out by adding the usual shebang.

MFC after:	2 weeks
2008-02-03 11:33:27 +00:00
John Baldwin
0460d3516d Only use sockoptname() to parse socket option names for SOL_SOCKET
requests.

MFC after:	3 days
Reported by:	Michiel Boland  michiel boland.org
2008-01-07 18:50:25 +00:00
John Baldwin
b850a685ce Add several missing comma's in the fancy syscall parsing case before
some arguments that are parsed (e.g., semctl command names).

MFC after:	3 days
2007-12-06 08:49:43 +00:00