HomeFreeBSD

dtrace: Add the 'oformat' libdtrace option

Description

dtrace: Add the 'oformat' libdtrace option

This option can be used to specify a format to use in DTrace output.
The following formats are supported:

  • json
  • xml
  • html
  • none (default DTrace output)

This is implemented using libxo and integrated into libdtrace. Client
code only works with the following API:

  • dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting.
  • dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished
  • dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled.
  • dtrace_set_outfp(FILE *) -- sets the output file for oformat.
  • Ensure that oformat is correctly checked in the drop handler and record processing callbacks.

This commit also adds tests which check if the generated output is
valid (JSON, XML) and extends the dtrace(1) describing the structured output.

Reviewed by: markj
Discussed with: phil
MFC after: 2 months
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D41745

(cherry picked from commit 93f27766a7e1af009c5b1e4ca538632857c91aa1)

Details

Provenance
domagoj.stolfa_gmail.comAuthored on Jan 3 2024, 2:58 PM
markjCommitted on Apr 15 2024, 2:05 PM
Reviewer
markj
Differential Revision
D41745: dtrace: Add the 'oformat' libdtrace option.
Parents
rG342a51f11018: which: Use size_t instead of ssize_t for pathlen
Branches
Unknown
Tags
Unknown