libtraceevent plugins: Add plugin_net to handle byte swap during print
Traced data my be stored in the network order and transformed to the
host order at print time by ntohs() or similar functions. These
functions end up being implemented by one of __builtin_bswapXX()
or by a combination of __builtin_constant_p() and __fswapXX().
Support them in the print format string.
The __builtin_constant_p() is used in conditionals, which have an
optimized version for constant argument like this:
__builtin_constant_p(X) ? constant_expression(X) : func(X)
Always assume __builtin_constant_p() is false, as the false branch
should be generic and work even with constant.
Link: https://lore.kernel.org/20250417144126.702609-1-oss@malat.biz
Signed-off-by: Petr Malat <oss@malat.biz>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 files changed