Commit Graph

57 Commits

Author SHA1 Message Date
Michael Tuexen
80098bb1fb Bump date, which I missed in r328014. Thanks to jhb@ for reporting. 2018-01-15 23:12:54 +00:00
Michael Tuexen
0faae8b922 Add support for decoding the nxt_flags, rcv_flags, and snd_flags of
SCTP level cmsgs.
2018-01-15 20:37:11 +00:00
Michael Tuexen
a826eb5a41 Add support for decoding the type of a cmsg. 2018-01-15 10:59:04 +00:00
Michael Tuexen
c1f0d826d6 Simplify table generation. 2018-01-15 08:32:49 +00:00
Michael Tuexen
1e6455d870 Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo. 2018-01-14 14:27:42 +00:00
Michael Tuexen
a62bf68d3d Add suppor for the supported PR-SCTP policies. 2018-01-14 12:08:41 +00:00
Ed Schouten
87f69beea3 libsysdecode: Add a new ABI type, SYSDECODE_ABI_CLOUDABI32.
In order to let truss(8) support tracing of 32-bit CloudABI
applications, we need to add a new ABI type to libsysdecode. We can
reuse the existing errno mapping table. Also link in the cloudabi32
system call table to translate system call names.

While there, remove all of the architecture ifdefs. There are not
needed, as the CloudABI data types and system call tables build fine on
any architecture. Building this unconditionally will make it easier to
do tracing for different compat modes, emulation, etc.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D13516
2017-12-16 19:37:55 +00:00
Fedor Uporov
bf7fa6b4ca Sync bsd_to_linux_errno[] table with i386 and amd64 tables in the sys directory.
Additional fix for r326282.

MFC after: 1 week
Approved by: pfg
2017-11-28 16:25:46 +00:00
John Baldwin
ffb6607984 Decode kevent structures logged via ktrace(2) in kdump.
- Add a new KTR_STRUCT_ARRAY ktrace record type which dumps an array of
  structures.

  The structure name in the record payload is preceded by a size_t
  containing the size of the individual structures.  Use this to
  replace the previous code that dumped the kevent arrays dumped for
  kevent().  kdump is now able to decode the kevent structures rather
  than dumping their contents via a hexdump.

  One change from before is that the 'changes' and 'events' arrays are
  not marked with separate 'read' and 'write' annotations in kdump
  output.  Instead, the first array is the 'changes' array, and the
  second array (only present if kevent doesn't fail with an error) is
  the 'events' array.  For kevent(), empty arrays are denoted by an
  entry with an array containing zero entries rather than no record.

- Move kevent decoding tables from truss to libsysdecode.

  This adds three new functions to decode members of struct kevent:
  sysdecode_kevent_filter, sysdecode_kevent_flags, and
  sysdecode_kevent_fflags.

  kdump uses these helper functions to pretty-print kevent fields.

- Move structure definitions for freebsd11 and freebsd32 kevent
  structures to <sys/event.h> so that they can be shared with userland.
  The 32-bit structures are only exposed if _WANT_KEVENT32 is defined.
  The freebsd11 structures are only exposed if _WANT_FREEBSD11_KEVENT is
  defined.  The 32-bit freebsd11 structure requires both.

- Decode freebsd11 kevent structures in truss for the compat11.kevent()
  system call.

- Log 32-bit kevent structures via ktrace for 32-bit compat kevent()
  system calls.

- While here, constify the 'void *data' argument to ktrstruct().

Reviewed by:	kib (earlier version)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D12470
2017-11-25 04:49:12 +00:00
John Baldwin
2edb60b9d5 Add stdio.h to the synopsis for sysdecode functions that take a FILE *. 2017-11-25 03:59:36 +00:00
John Baldwin
2b6e6d8500 Wrap to 80 columns. No functional change. 2017-11-07 17:45:39 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh
dae8f61f5b RB_POWERCYCLE needs to be handled like RB_POWEROFF for decoding.
Sponsored by: Netflix
2017-10-25 15:30:25 +00:00
Ed Maste
c9c69ebad7 libsysdecode: report invalid cap_rights_t
Previously we'd have an assertion failure in cap_rights_is_set if
sysdecode_cap_rights is called with an invalid cap_rights_t, so test for
validity first.

PR:		222258
Reviewed by:	cem
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12391
2017-09-17 14:03:54 +00:00
John Baldwin
39a3a4386a Decode pathconf() names, *at() flags, and sysarch() numbers in libsysdecode.
Move tables that were previously in truss over to libsysdecode.  truss
output is unchanged, but kdump has been updated to decode these fields.
In addition, sysdecode_sysarch_number() should support all platforms
whereas the old table in truss only supported x86.
2017-09-04 05:34:36 +00:00
Kristof Provost
a342f43571 Handle WITH/WITHOUT_PF in libsysdecode
Only filter out the PF ioctls if we're building without pf support.
Until now those were always filtered out, so truss did not show symbolic
names for pf ioctls.

Differential Revision:	https://reviews.freebsd.org/D11629
2017-07-22 12:51:19 +00:00
John Baldwin
ad6b4a346f Remove special handling for 'disk*.h'
This was originally added so that only one of diskmbr.h or diskpc98.h
was chosen and is no longer needed after PC98's removal.  However, the
special handling was also broken as it effectively prevented the decoding
of ioctls declared in other headers such as <sys/disk.h> or
<sys/disklabel.h>.
2017-07-18 21:09:29 +00:00
Bryan Drewery
1671f70652 DIRDEPS_BUILD: Connect more libraries.
Sponsored by:	Dell EMC Isilon
2017-07-11 00:32:48 +00:00
Bryan Drewery
f944e9e208 Tweak r320206: Still create the TABLE but not the .depend entry for missing headers.
X-MFC-With:	r320206
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-06-21 23:28:24 +00:00
Bryan Drewery
87d18efc7b Follow-up r308602: Don't add missing headers to .depend.tables.h.
This also avoids an error from egrep when a header is missing.  This can happen
with something like WITHOUT_BLUETOOTH set when searching for
$include_dir/netgraph/bluetooth/include/ng_btsocket.h.  The warning was
not an error (from set -e) due to being on the left side of a pipe.  Now the
all_headers list is only filled with existing headers.

Reviewed by:	ngie
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-06-21 23:01:18 +00:00
Bryan Drewery
c99b67a794 Utilize SYSROOT from r320119 in places where DESTDIR may be wanting WORLDTMP.
Since buildenv exports SYSROOT all of these uses will now look in
WORLDTMP by default.

sys/boot/efi/loader/Makefile
        A LIBSTAND hack is no longer required for buildenv.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-06-19 20:47:24 +00:00
John Baldwin
30b94d0cf4 Improve decoding of RB_AUTOBOOT in the 'howto' argument to reboot().
The reboot() system call accepts a mode (RB_AUTOBOOT, RB_HALT, RB_POWEROFF,
or RB_REROOT) as well as zero or more optional flags in 'howto'.
However, RB_AUTOBOOT was only displayed if 'howto' was exactly 0.
Combinations like 'RB_AUTOBOOT | RB_DUMP' were decoded as 'RB_DUMP'.
Instead, imply that RB_AUTOBOOT was specified if none of the other "mode"
flags were specified.
2017-06-10 01:20:08 +00:00
John Baldwin
ee8aa41dca Decode the 'who' argument passed to getrusage().
Add a new sysdecode_getrusage_who() which decodes the RUSAGE_* constant
passed as the first argument to getrusage().  Use this function in both
kdump and truss to decode the first argument to getrusage().

PR:		215448
Submitted by:	Anton Yuzhaninov <citrin+pr@citrin.ru>
MFC after:	1 month
2017-06-03 14:22:15 +00:00
John Baldwin
2bdd2e7e61 Add a cross-reference to sysdecode_socket_protocol(3). 2017-06-03 14:10:09 +00:00
Michael Tuexen
738a93a461 Improve the decoding of the third argument of the socket() call.
Decoding of the third argument depends on the first one. For doing this,
add a corresponding function to libsysdecode.

Thanks to jhb@ for suggesting this.
2017-05-25 14:27:54 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Michael Tuexen
ed466c3404 Add support for socket option names related to the level IPPROTO_UDPLITE. 2017-05-04 07:44:07 +00:00
Michael Tuexen
702eb303ff Add support for socket option names related to the IPPROTO_IPV6 level. 2017-05-03 15:20:40 +00:00
Michael Tuexen
472e80099d Add support for socket option names related to the IPPROTO_SCTP level. 2017-05-03 15:03:00 +00:00
Steven Hartland
aa9bddf0a8 Fix libsysdecode vmprot flag decoding
Fix the regex used to find vmprot table entries and add the missing include.

This fixes kdumps output of PFLT arguments which would previously look like:
5202 101546 ktrace   PFLT  0x5ae000 0x2<><invalid>2

They now display correctly:
5202 101546 ktrace   PFLT  0x5ac000 0x2<VM_PROT_WRITE>

MFC after:	1 week
2017-03-16 20:55:00 +00:00
Maxim Konovalov
aeccc5c944 Spell "const" properly.
PR:		217797
Submitted by:	tobik
2017-03-15 16:13:52 +00:00
Tobias Kortkamp
3c04774023 Fix sysdecode_cap_rights which currently prints bogus capability rights
PR:		217787
Reviewed by:	jhb, emaste
Approved by:	jhb
2017-03-14 20:31:10 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Peter Jeremy
8787928589 Extend LD_UTRACE by also generating utrace(2) log events for runtime linker
errors.

Reviewed by:	kib, jhb
Approved by:	jhb(mentor)
MFC after:	1 week
Differential Revision:	 D9347
2017-01-30 08:38:32 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
Enji Cooper
914108c810 Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones
This implifies pathing in make/displayed output

MFC after:    3 weeks
Sponsored by: Dell EMC Isilon
2017-01-20 04:33:20 +00:00
Enji Cooper
73f14b50b2 Unbreak lib/libsysdecode after r311568 by decoding MSG_MORETOCOME flag
in msgflags

MFC after:	1 month
X-MFC with:	r311568
Pointyhat to:	jhb
Reported by:	cy
Submitted by:	Michael Butler <imb@protected-networks.net>
Sponsored by:	Dell EMC Isilon
2017-01-07 07:54:23 +00:00
John Baldwin
48f7957436 Update libsysdecode for getfsstat() 'flags' argument changing to 'mode'.
As a followup to r310638, update libsysdecode (and kdump) to decode the
'mode' argument to getfsstat().  sysdecode_getfsstat_flags() has been
renamed to sysdecode_getfsstat_mode() and now treats the argument as an
enumerated value rather than a mask of flags.
2017-01-03 01:39:05 +00:00
Bryan Drewery
7c6d0bb1a0 Move libsysdecode-specific hack out of buildworld.
This should fix the lib32 build since it was not removing the generated
ioctl.c.  This file is generated by a find(1) call, so cannot use normal
dependency tracking methods.

Reported by:	jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:15 +00:00
Bryan Drewery
5e1eb60d94 Generate and use a proper .depend file for tables.h.
Reported by:	jhb
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:12 +00:00
John Baldwin
8368d90bfc Use binary and (&) instead of logical to extract the mask of a capability.
CID:		1365227
Submitted by:	cem
2016-10-25 18:45:14 +00:00
John Baldwin
9289f547a2 Move mksubr from kdump into libsysdecode.
Restructure this script so that it generates a header of tables instead
of a source file.  The tables are included in a flags.c source file which
provides functions to decode various system call arguments.

For functions that decode an enumeration, the function returns a pointer
to a string for known values and NULL for unknown values.

For functions that do more complex decoding (typically of a bitmask), the
function accepts a pointer to a FILE object (open_memstream() can be used
as a string builder) to which decoded values are written.  If the
function operates on a bitmask, the function returns true if any bits
were decoded or false if the entire value was valid.  Additionally, the
third argument accepts a pointer to a value to which any undecoded bits
are stored.  This pointer can be NULL if the caller doesn't care about
remaining bits.

Convert kdump over to using decoder functions from libsysdecode instead of
mksubr.  truss also uses decoders from libsysdecode instead of private
lookup tables, though lookup tables for objects not decoded by kdump remain
in truss for now.  Eventually most of these tables should move into
libsysdecode as the automated table generation approach from mksubr is
less stale than the static tables in truss.

Some changes have been made to truss and kdump output:
- The flags passed to open() are now properly decoded in that one of
  O_RDONLY, O_RDWR, O_WRONLY, or O_EXEC is always included in a decoded
  mask.
- Optional arguments to open(), openat(), and fcntl() are only printed
  in kdump if they exist (e.g. the mode is only printed for open() if
  O_CREAT is set in the flags).
- Print argument to F_GETLK/SETLK/SETLKW in kdump as a pointer, not int.
- Include all procctl() commands.
- Correctly decode pipe2() flags in truss by not assuming full
  open()-like flags with O_RDONLY, etc.
- Decode file flags passed to *chflags() as file flags (UF_* and SF_*)
  rather than as a file mode.
- Fix decoding of quotactl() commands by splitting out the two command
  components instead of assuming the raw command value matches the
  primary command component.

In addition, truss and kdump now build without triggering any warnings.
All of the sysdecode manpages now include the required headers in the
synopsis.

Reviewed by:	kib (several older versions), wblock (manpages)
MFC after:	2 months
Differential Revision:	https://reviews.freebsd.org/D7847
2016-10-17 22:37:07 +00:00
Konstantin Belousov
f214036e99 Move defines common between rtld and libsysdecode into the header,
instead of copying inline into sources.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 19:31:41 +00:00
Konstantin Belousov
68e9b1e8e1 Decode 32bit utrace records on the 64bit host.
Suppose that ktrace is performed on 32bit binary running on 64bit
host.  In this case, the kernel records are 64bit, while utrace
records from rtld and malloc are 32bit.  Make kdump useful to see
decoded utrace data in that case.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-12 07:54:59 +00:00
Glen Barber
d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Ed Schouten
1f3bbfd875 Replace the CloudABI system call table by a machine generated version.
The type definitions and constants that were used by COMPAT_CLOUDABI64
are a literal copy of some headers stored inside of CloudABI's C
library, cloudlibc. What is annoying is that we can't make use of
cloudlibc's system call list, as the format is completely different and
doesn't provide enough information. It had to be synced in manually.

We recently decided to solve this (and some other problems) by moving
the ABI definitions into a separate file:

	https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt

This file is processed by a pile of Python scripts to generate the
header files like before, documentation (markdown), but in our case more
importantly: a FreeBSD system call table.

This change discards the old files in sys/contrib/cloudabi and replaces
them by the latest copies, which requires some minor changes here and
there. Because cloudabi.txt also enforces consistent names of the system
call arguments, we have to patch up a small number of system call
implementations to use the new argument names.

The new header files can also be included directly in FreeBSD kernel
space without needing any includes/defines, so we can now remove
cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the
sources to include the definitions directly from sys/contrib/cloudabi
instead.
2016-03-24 21:47:15 +00:00
Glen Barber
52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Edward Tomasz Napierala
be9430ef05 errno(3) -> errno(2)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-29 17:34:54 +00:00
Bryan Drewery
bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Glen Barber
aef2f6ad2e MFH
Sponsored by:	The FreeBSD Foundation
2016-02-24 03:08:58 +00:00