This is a series of three commits (and I'll probably split them up
for committing) whose log messages are below, but it might be easier
to view the entire idea to get a sense of if it is the right direction
or not. A couple of issues / questions I have:
- Is KTR_STRUCT_ARRAY a better approach than having the kevent() just do a bunch of separate KTR_STRUCT records for each event? Note that if we do the latter we don't currently have a way to distinguish "in" events from "out" events, though perhaps we could use separate structure names like "kevent-in" and "kevent-out". Another use case in the future might be to log the 'struct pollfd' array passed to poll() for example.
- Does this need to be more explicit about logging "in" vs "out" structures? In the existing GENIO records, the in/out direction is used to indicate which set of kevent structures are being logged, but that is now only communicated implicitly as documented in the first commit log below. We could add another 'flag' field in the KTR_STRUCT_ARRAY header that could include "in" vs "out" perhaps?
Add a new KTR_STRUCT_ARRAY 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
Use the new sysdecode_kevent_* functions when printing kevent structures.