History log of /freebsd-head/lib/libsysdecode/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cf999c6e103dff5af8e1c6d655dfc47635fdbc23 09-Oct-2020 gbe <gbe@FreeBSD.org> Fix a few mandoc issues

- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format
ysdecode_mask.3
c6fdb04db881c824139425ff2b3a66e7e8ff82f2 09-Sep-2020 kib <kib@FreeBSD.org> Fix compilation of libsysdecode after r365522, should have been part of it.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D24652
kioctls
66e4739fa49c54748927776d04e15682255663a6 20-Aug-2020 rmacklem <rmacklem@FreeBSD.org> Add MSG_TLSAPPDATA to lib/libsysdecode/mktables.

I have no idea what this does (and until now that it even existed), but
apparently it needs this entry changed for the MSG_TLSAPPDATA, since
it is kernel only.
ktables
efd93357ab78846fb426a7d9dda6f986d9680281 01-Apr-2020 jhb <jhb@FreeBSD.org> Retire procfs-based process debugging.

Modern debuggers and process tracers use ptrace() rather than procfs
for debugging. ptrace() has a supserset of functionality available
via procfs and new debugging features are only added to ptrace().
While the two debugging services share some fields in struct proc,
they each use dedicated fields and separate code. This results in
extra complexity to support a feature that hasn't been enabled in the
default install for several years.

PR: 244939 (exp-run)
Reviewed by: kib, mjg (earlier version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D23837
akefile
bc1ffb39ec822cce1dd37826bd655787fafba1a0 17-Mar-2020 jhb <jhb@FreeBSD.org> Fix the workaround to ignore the #warning for GCC.

clang and gcc use different warning flags for #warning preprocessor
directives.

Reported by: Jenkins
MFC after: 1 week
akefile
b11a503cbc7db1b9dd40b01ce3751af9e5bde4b7 17-Mar-2020 jhb <jhb@FreeBSD.org> Mark procfs-based process debugging as deprecated for FreeBSD 13.

Attempting to use ioctls on /proc/<pid>/mem to control a process will
trigger warnings on the console. The <sys/pioctl.h> include file will
also now emit a compile-time warning when used from userland.

Reviewed by: emaste
MFC after: 1 week
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D23822
akefile
66a791667c93978f89cd93b2e2f0dcb31d489c92 19-Feb-2020 kevans <kevans@FreeBSD.org> libsysdecode: grab shmflags from sys/mman.h, add decode method

Any SHM_* flag here is (and likely will continue to be) a shmflag that may
be passed to shm_open2(), with exception to SHM_ANON. This is a prereq to
adding appropriate support to truss/kdump.

Reviewed by: kaktus (slightly earlier version)
Differential Revision: https://reviews.freebsd.org/D23733
lags.c
ktables
ysdecode.h
6dfa5c6de2d71327010745d2281a85927f932191 06-Jan-2020 kevans <kevans@FreeBSD.org> Update libssp paths in various Makefile.depend* files

I've been advised that the model that uses these are fairly resilient, but
we do know the proper path to use (or remove, in the case of ^/targets/...),
so go ahead and update them to reflect that.
akefile.depend
16923f2426747207f66ba4329b6ede7418cf4adb 11-Dec-2019 sjg <sjg@FreeBSD.org> Update Makefile.depend files

Update a bunch of Makefile.depend files as
a result of adding Makefile.depend.options files

Reviewed by: bdrewery
MFC after: 1 week
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D22494
akefile.depend
613101d06e3ac07b954733b864c88c91c00e4845 30-Sep-2019 kaktus <kaktus@FreeBSD.org> libsysdecode: decode PROT_MAX flags

Extend libsysdecode to pretty-print PROT_MAX flags and fix decoding of regular protection flags broken since r349240.

before:
truss:
mmap(0x0,40960,0x30000,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax CALL mmap(0,0xa000,0x30000<><invalid>196608,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

after:
truss:
mmap(0x0,40960,PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
kdump:
11439 protmax CALL mmap(0,0xa000,0x30000<PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)

Reviewed by: kib (mentor)
Approved by: kib (mentor)
Differential Revision: https://reviews.freebsd.org/D21706
lags.c
a77ce411ec44b589afb25ba3ac77b9568cfcc25d 05-Sep-2019 manu <manu@FreeBSD.org> pkgbase: Create a FreeBSD-utilities package and make it the default one

The default package use to be FreeBSD-runtime but it should only contain
binaries and libs enough to boot to single user and repair the system, it
is also very handy to have a package that can be tranform to a small mfsroot.
So create a new package named FreeBSD-utilities and make it the default one.
Also move a few binaries and lib into this package when it make sense.
Reviewed by: bapt, gjb
Differential Revision: https://reviews.freebsd.org/D21506
akefile
5b684f35cef92565c3896848f505b74a1246a017 16-Aug-2019 bdrewery <bdrewery@FreeBSD.org> Rework r339635 to fix .depend.tables.h handling.

Avoid touching the tables.h file unless it has changed to avoid unneeded
rebuilds.

Also revert r350301's explicit dependencies.

Reviewed by: emaste
MFC after: 2 weeks
X-MFC-With: r339635 (kevans request)
PR: 238828
Sponsored by: DellEMC
Differential Revision: https://reviews.freebsd.org/D21295
akefile
ktables
8d915c144caa777e437e90b3ce3472544732f805 25-Jul-2019 emaste <emaste@FreeBSD.org> libsysdecode: use the proper include directory

Reported by: cy
Reviewed by: lwhsu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21068
akefile
00d3513e61b2119600c214512d1de89cb210391e 24-Jul-2019 emaste <emaste@FreeBSD.org> libsysdecode: add explicit dependencies on recently changed headers

r349369 removed IP_MIN_MEMBERSHIPS and IPV6_MIN_MEMBERSHIPS, and r349893
removed TCP_RACK_SESS_CWV. libsysdecode lacked dependencies to trigger a
rebuild of tables.h.

Add explicit dependencies as a workaround to address these specific
cases; a holistic solution is still needed.

Sponsored by: The FreeBSD Foundation
akefile
ae6222b0c3494c3ec754ff9dd42367f813087472 06-Mar-2019 jhb <jhb@FreeBSD.org> Drop "All rights reserved" from my copyright statements.

Reviewed by: rgrimes
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D19485
rrno.c
ignal.c
yscallnames.c
ysdecode.3
ysdecode.h
ysdecode_abi_to_freebsd_errno.3
ysdecode_cap_rights.3
ysdecode_enum.3
ysdecode_fcntl_arg.3
ysdecode_ioctlname.3
ysdecode_kevent.3
ysdecode_mask.3
ysdecode_quotactl_cmd.3
ysdecode_sigcode.3
ysdecode_socket_protocol.3
ysdecode_sockopt_name.3
ysdecode_syscallnames.3
ysdecode_utrace.3
c3a5a53eb872996b2e456ce78cdbf95c1d7909fb 04-Feb-2019 tuexen <tuexen@FreeBSD.org> Add missing SCTP_EOR entry.

MFC after: 3 days
lags.c
67062957639f050eeee4f17fec1076c2873e856f 23-Oct-2018 arichardson <arichardson@FreeBSD.org> Fix regex for extracting SHM_* values for libsysdecode

There was an additional + after the {6} which is apparently ignored by the
FreeBSD regex implementation but was giving me an error when compiling on
MacOS.

While changing this also make sure that tables.h is not created if mktables
fails. The current rule would create a partial tables.h which causes following
incremental builds to use that broken file and fail with an unrelated
compilation error or even succeed even though they shouldn't.

Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D17069
akefile
ktables
c7f1f595d8b25c1fd13746b380a909ee6a39db3f 20-Aug-2018 arichardson <arichardson@FreeBSD.org> Don't rebuild ioctl.c and relink libsysdecode if there are no changes

Instead generate a temporary file and only overwrite ioctl.c if the
files are actually different.

Approved By: jhb (mentor)
akefile
068abe053659bf09ea13a7a503d71b3f0a844321 20-Aug-2018 arichardson <arichardson@FreeBSD.org> Make mkioctls script work on Linux and MacOS

Using find -s will not work with the Linux or MacOS find command. We pipe
to sort instead since the only real requirement here is that the order
stays the same. While I am touching this file I also fixed a `==` construct
which is not supported by POSIX sh but appears to work on FreeBSD.

Reviewed By: imp
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D14246
kioctls
a3eb1e9afbd9e9cdac24e60782823ba570b54726 01-May-2018 emaste <emaste@FreeBSD.org> Retire lmc(4)

This driver supports legacy, 32-bit PCI devices, and had an ambiguous
license. Supported devices were already reported to be rare in 2003
(when an earlier version of the driver was removed in r123201).

Reviewed by: rgrimes
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D15245
akefile
ee7ec2c7d842c10a3abe0bec99e3b1e478d2f5a9 26-Apr-2018 emaste <emaste@FreeBSD.org> libsysdecode: support errno and syscalls for arm64 Linux

Sponsored by: Turing Robotic Industries Inc.
rrno.c
yscallnames.c
ysdecode.3
289be8516c5ec21ec34390cfce6c92e014e9efcf 22-Mar-2018 emaste <emaste@FreeBSD.org> Share Linux errno table with libsysdecode

Requested by: jhb
Reviewed by: jhb
Sponsored by: Turing Robotic Industries Inc.
rrno.c
524a505de6527905055bf2fe6f53e9b185528a71 16-Mar-2018 emaste <emaste@FreeBSD.org> Chase r331057 in libsysdecode erno table
rrno.c
6e1eb27048681df61a3d53972a84f06cd5bcb578 12-Mar-2018 bz <bz@FreeBSD.org> The vmresult table was missing most of the values apart from two due to
extra "_" in the names we grep for. Add the "_" to the pattern.

Reviewed by: jhb
MFC after: 3 days
Sponsored by: iXsystems, Inc.
ktables
b86a65dcd0cfb8327bacc130b4efe7185321c3ad 15-Jan-2018 tuexen <tuexen@FreeBSD.org> Bump date, which I missed in r328014. Thanks to jhb@ for reporting.
ysdecode_mask.3
9db463347151d8955a9d58ec0d62535906947a69 15-Jan-2018 tuexen <tuexen@FreeBSD.org> Add support for decoding the nxt_flags, rcv_flags, and snd_flags of
SCTP level cmsgs.
akefile
lags.c
ysdecode.h
ysdecode_mask.3
aab0289ab1e1680ac2abeee8477c3e97f43ce1d4 15-Jan-2018 tuexen <tuexen@FreeBSD.org> Add support for decoding the type of a cmsg.
akefile
lags.c
ktables
ysdecode.3
ysdecode.h
ysdecode_cmsg_type.3
96e66998d9effec6587a3e40a7602f1bbed1ecf8 15-Jan-2018 tuexen <tuexen@FreeBSD.org> Simplify table generation.
ktables
dc1ea661c79a876985c0680fb5106f731164e051 14-Jan-2018 tuexen <tuexen@FreeBSD.org> Add a function is decode the sinfo_flags of struct sctp_sndrcvinfo.
akefile
lags.c
ysdecode.3
ysdecode.h
ysdecode_enum.3
ysdecode_sctp_sinfo_flags.3
5c419e6ba67c099eea625e9a7509265916fe7657 14-Jan-2018 tuexen <tuexen@FreeBSD.org> Add suppor for the supported PR-SCTP policies.
akefile
lags.c
ktables
ysdecode.h
ysdecode_enum.3
118522df7e441e11f6914286a976da2675501935 16-Dec-2017 ed <ed@FreeBSD.org> 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
rrno.c
yscallnames.c
ysdecode.3
ysdecode.h
bcca10fed18fc7ea24a4214fcdb42166ee29ba0c 28-Nov-2017 fsu <fsu@FreeBSD.org> 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
rrno.c
bac78aa2a49020f1e67b0d1b05e5daf2213879ae 25-Nov-2017 jhb <jhb@FreeBSD.org> 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
akefile
lags.c
ktables
ysdecode.3
ysdecode.h
ysdecode_kevent.3
da95c18cf4a4cf3b3276256ab8f967d616940914 25-Nov-2017 jhb <jhb@FreeBSD.org> Add stdio.h to the synopsis for sysdecode functions that take a FILE *.
ysdecode_cap_rights.3
ysdecode_fcntl_arg.3
ysdecode_mask.3
ysdecode_quotactl_cmd.3
ysdecode_utrace.3
ccb52dc3ef3076e40000a51cba89978beae827d5 07-Nov-2017 jhb <jhb@FreeBSD.org> Wrap to 80 columns. No functional change.
lags.c
a598c4b809a73772d7452991213407cdac302156 31-Oct-2017 bdrewery <bdrewery@FreeBSD.org> DIRDEPS_BUILD: Update dependencies.

Sponsored by: Dell EMC Isilon
akefile.depend
409e046ace92eabfbf861c01fec4b0351c2b0578 25-Oct-2017 imp <imp@FreeBSD.org> RB_POWERCYCLE needs to be handled like RB_POWEROFF for decoding.

Sponsored by: Netflix
lags.c
007c856ab0914c7d9a223dda66f827a8b10dd6b0 17-Sep-2017 emaste <emaste@FreeBSD.org> 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
lags.c
7735433fd2ccb5c0830fe81d129704dbf132b445 04-Sep-2017 jhb <jhb@FreeBSD.org> 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.
akefile
lags.c
ktables
ysdecode.h
ysdecode_enum.3
ysdecode_mask.3
112fb3abf7e83b24bd853914fc45d3eb22fb5092 22-Jul-2017 kp <kp@FreeBSD.org> 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
akefile
kioctls
ee50ae24a6554838282bb3a1b91568e8d7e575fa 18-Jul-2017 jhb <jhb@FreeBSD.org> 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>.
kioctls
a1aacd79ffc5933cfba415dc56b5169885b058c7 11-Jul-2017 bdrewery <bdrewery@FreeBSD.org> DIRDEPS_BUILD: Connect more libraries.

Sponsored by: Dell EMC Isilon
akefile.depend
a4cc310916995d3ce93eee1101a1f4e0a7f3520d 21-Jun-2017 bdrewery <bdrewery@FreeBSD.org> 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
ktables
18a2c7c74b5600d4de0f17a464533245cf366003 21-Jun-2017 bdrewery <bdrewery@FreeBSD.org> 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
ktables
6c4b8e235bbf2d6f17b83b33c58ac99aced520c3 19-Jun-2017 bdrewery <bdrewery@FreeBSD.org> 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
akefile
57cd391d21ff8ad805c6d7bd1fbc9d5b37943fe9 10-Jun-2017 jhb <jhb@FreeBSD.org> 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.
lags.c
48d2ad88bbdc6dc2db7ca4f9a2897bdd79463590 03-Jun-2017 jhb <jhb@FreeBSD.org> 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
akefile
lags.c
ktables
ysdecode.h
ysdecode_enum.3
f26dbec8ca1c7ccd572505a060176c168c9a5908 03-Jun-2017 jhb <jhb@FreeBSD.org> Add a cross-reference to sysdecode_socket_protocol(3).
ysdecode.3
a947803dbc3232b117b16e13465849d64f5f9ab0 25-May-2017 tuexen <tuexen@FreeBSD.org> 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.
akefile
lags.c
ysdecode.h
ysdecode_socket_protocol.3
f7f629338143238628a4cde999509c7b921c686b 09-May-2017 bdrewery <bdrewery@FreeBSD.org> DIRDEPS_BUILD: Update dependencies.

Sponsored by: Dell EMC Isilon
akefile.depend
89fb1dd8eadbb7b7a460dba98a32788c33f72b4a 04-May-2017 tuexen <tuexen@FreeBSD.org> Add support for socket option names related to the level IPPROTO_UDPLITE.
lags.c
ktables
e222d355a05f2fa56287a33e785f427d46fdd945 03-May-2017 tuexen <tuexen@FreeBSD.org> Add support for socket option names related to the IPPROTO_IPV6 level.
lags.c
ktables
59713b3e8cc22aee2336a10c12da4026b9624544 03-May-2017 tuexen <tuexen@FreeBSD.org> Add support for socket option names related to the IPPROTO_SCTP level.
lags.c
ktables
a8429c675016730a11cea73afad8801086df9905 16-Mar-2017 smh <smh@FreeBSD.org> 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
lags.c
ktables
fa7de52206ac19b48fd8dbeac672315a7797022c 15-Mar-2017 maxim <maxim@FreeBSD.org> Spell "const" properly.

PR: 217797
Submitted by: tobik
ysdecode_ioctlname.3
1d24ae662536652977bf21b89ce2d360549968db 14-Mar-2017 tobik <tobik@FreeBSD.org> Fix sysdecode_cap_rights which currently prints bogus capability rights

PR: 217787
Reviewed by: jhb, emaste
Approved by: jhb
lags.c
7e6cabd06e6caa6a02eeb86308dc0cb3f27e10da 28-Feb-2017 imp <imp@FreeBSD.org> 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
trace.c
75bd6a140dc9529d4914f48da886dda13a19610f 30-Jan-2017 peterj <peterj@FreeBSD.org> 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
trace.c
259480b6de42080f4d3f1e3072e52d3acee596b3 28-Jan-2017 nyan <nyan@FreeBSD.org> Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes: yes
akefile
kioctls
43944ac3e01be4b6405e4a782d1c50f80fb8d2e4 20-Jan-2017 ngie <ngie@FreeBSD.org> 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
akefile
ac969b1c223b25d63e66e5eadada3c7be5bfbe90 07-Jan-2017 ngie <ngie@FreeBSD.org> 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
ktables
c49d6e5b66c9f0116a49b9e2240482979c64a973 03-Jan-2017 jhb <jhb@FreeBSD.org> 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.
akefile
lags.c
ktables
ysdecode.h
ysdecode_enum.3
ysdecode_mask.3
834de7c836fda5b11464d4349b6aa8e65ff33712 13-Nov-2016 bdrewery <bdrewery@FreeBSD.org> 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
akefile
bc54153a0f25bbcb38bdc6cb16997ef7719a2f74 13-Nov-2016 bdrewery <bdrewery@FreeBSD.org> Generate and use a proper .depend file for tables.h.

Reported by: jhb
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
akefile
ktables
f57d15e36b0253e6742db0045de96885c56760c0 25-Oct-2016 jhb <jhb@FreeBSD.org> Use binary and (&) instead of logical to extract the mask of a capability.

CID: 1365227
Submitted by: cem
lags.c
27ec61a4375f38949fd0636093b5d362ddd043a8 17-Oct-2016 jhb <jhb@FreeBSD.org> 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
akefile
rrno.c
lags.c
kioctls
ktables
ignal.c
yscallnames.c
ysdecode.3
ysdecode.h
ysdecode_abi_to_freebsd_errno.3
ysdecode_cap_rights.3
ysdecode_enum.3
ysdecode_fcntl_arg.3
ysdecode_ioctlname.3
ysdecode_mask.3
ysdecode_quotactl_cmd.3
ysdecode_sigcode.3
ysdecode_sockopt_name.3
ysdecode_syscallnames.3
ysdecode_utrace.3
trace.c
ca7630f47dec37d58b2266103da5bd2122968553 12-Aug-2016 kib <kib@FreeBSD.org> 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
akefile
trace.c
89f788c62121f0debbc68f993ed5249166c3e25b 12-Aug-2016 kib <kib@FreeBSD.org> 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
trace.c
1dc4c40e3b35564cb2e787ad968e6b4a9fb7eb0f 04-Apr-2016 gjb <gjb@FreeBSD.org> MFH

Sponsored by: The FreeBSD Foundation
dfa2acdc8249aebdb00d24a0bd149b416b407320 24-Mar-2016 ed <ed@FreeBSD.org> 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.
rrno.c
955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d 02-Mar-2016 gjb <gjb@FreeBSD.org> MFH

Sponsored by: The FreeBSD Foundation
5f758d0d5b191cd87877dd9669210ba46c2fe6ba 29-Feb-2016 trasz <trasz@FreeBSD.org> errno(3) -> errno(2)

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
ysdecode_abi_to_freebsd_errno.3
2a891f1feb2e67ab5fdbb473405797c2efc34caf 24-Feb-2016 bdrewery <bdrewery@FreeBSD.org> 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
akefile.depend
4719e40f5bedd0f88591120e071741635f07993b 24-Feb-2016 gjb <gjb@FreeBSD.org> MFH

Sponsored by: The FreeBSD Foundation
ca284988772507a1b799a619df4b7041a4dc9369 23-Feb-2016 jhb <jhb@FreeBSD.org> Add handling for non-native error values to libsysdecode.

Add two new functions, sysdecode_abi_to_freebsd_errno() and
sysdecode_freebsd_to_abi_errno(), which convert errno values between
the native FreeBSD ABI and other supported ABIs. Note that the
mappings are not necessarily perfect meaning in some cases multiple
errors in one ABI might map to a single error in another ABI. In that
case, the reverse mapping will return one of the errors that maps, but
which error is non-deterministic.

Change truss to always report the raw error value to the user but
use libsysdecode to map it to a native errno value that can be used
with strerror() to generate a description. Previously truss reported
the "converted" error value. Now the user will always see the exact
error value that the application sees.

Change kdump to report the truly raw error value to the user. Previously
kdump would report the absolute value of the raw error value (so for
Linux binaries it didn't output the FreeBSD error value, but the positive
value of the Linux error). Now it reports the real (i.e. negative) error
value for Linux binaries. Also, use libsysdecode to convert the native
FreeBSD error reported in the ktrace record to the raw error used by the
ABI. This means that the Linux ABI can now be handled directly in
ktrsysret() and removes the need for linux_ktrsysret().

Reviewed by: bdrewery, kib
Helpful notes: wblock (manpage)
Differential Revision: https://reviews.freebsd.org/D5314
akefile
rrno.c
ysdecode.3
ysdecode.h
ysdecode_abi_to_freebsd_errno.3
ysdecode_syscallnames.3
fef2698edfa99e7a2c6cc18a04b5261c08130f45 04-Feb-2016 gjb <gjb@FreeBSD.org> First pass through library packaging.

Sponsored by: The FreeBSD Foundation
akefile
377cdb0ab1f7d246659c637faafe7c54af0665e5 30-Jan-2016 jhb <jhb@FreeBSD.org> Add a SYSDECODE_ABI_ prefix to the ABI enums to avoid potential collisions.

Suggested by: jmallett
Reviewed by: bdrewery, jmallett
Differential Revision: https://reviews.freebsd.org/D5123
yscallnames.c
ysdecode.3
ysdecode.h
cd4a0ee266068abaf08833b8d76b0ad8b0cea721 26-Jan-2016 jhb <jhb@FreeBSD.org> Add support to libsysdecode for decoding system call names.

A new sysdecode_syscallname() function accepts a system call code and
returns a string of the corresponding name (or NULL if the code is
unknown). To support different process ABIs, the new function accepts a
value from a new sysdecode_abi enum as its first argument to select the
ABI in use. Current ABIs supported include FREEBSD (native binaries),
FREEBSD32, LINUX, LINUX32, and CLOUDABI64. Note that not all ABIs are
supported by all platforms. In general, a given ABI is only supported
if a platform can execute binaries for that ABI.

To simplify the implementation, libsysdecode's build reuses the
existing pre-generated files from the kernel source tree rather than
duplicating new copies of said files during the build.

kdump(1) and truss(1) now use these functions to map system call
identifiers to names. For kdump(1), a new 'syscallname()' function
consolidates duplicated code from ktrsyscall() and ktrsyscallret().
The Linux ABI no longer requires custom handling for ktrsyscall() and
linux_ktrsyscall() has been removed as a result.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D4823
akefile
yscallnames.c
ysdecode.3
ysdecode.h
ysdecode_syscallnames.3
0e634907c1421239606d5cfe5ba99f6e8298d900 07-Jan-2016 bdrewery <bdrewery@FreeBSD.org> Add in DIRDEPS_BUILD support.

Sponsored by: EMC / Isilon Storage Division
akefile.depend
b665ac07581ab1fbd0d71db29a027b4a39734789 22-Dec-2015 jhb <jhb@FreeBSD.org> Move the mkioctls script to libsysdecode and use it to generate a
sysdecode_ioctlname() function. This function matches the behavior
of the truss variant in that it returns a pointer to a string description
for known ioctls. The caller is responsible for displaying unknown
ioctl requests. For kdump this meant moving the logic to handle unknown
ioctl requests out of the generated function and into an ioctlname()
function in kdump.c instead.

Differential Revision: https://reviews.freebsd.org/D4610
akefile
kioctls
ysdecode.3
ysdecode.h
ysdecode_ioctlname.3
fea0add70e97d3866543fe397202ecc6d1413e65 15-Dec-2015 jhb <jhb@FreeBSD.org> Start on a new library (libsysdecode) that provides routines for decoding
system call information such as system call arguments. Initially this
will consist of pulling duplicated code out of truss and kdump though it
may prove useful for other utilities in the future.

This commit moves the shared utrace(2) record parser out of kdump into
the library and updates kdump and truss to use it. One difference from
the previous version is that the library version treats unknown events
that start with the "RTLD" signature as unknown events. This simplifies
the interface and allows the consumer to decide how to handle all
non-recognized events. Instead, this function only generates a string
description for known malloc() and RTLD records.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D4537
akefile
ysdecode.3
ysdecode.h
ysdecode_utrace.3
trace.c