Re: [PATCH] libtraceevent plugins: Add plugin_net to handle bswap during print

Petr Malat <[email protected]> Thu, 17 Apr 2025 05:06:44 -0400
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <CANMuvJmtk8bbQnT1FgnLzidQ_L1uGrdYypTRoyvLkJhUFVUi=g@mail.gmail.com>
Hi,
On Mon, Apr 14, 2025 at 11:41:17AM -0400, Steven Rostedt wrote:
> On Wed, 9 Apr 2025 22:56:08 -0400
> Steven Rostedt <[email protected]> wrote:
>
> > As the else block will have args[0] already swapped wrt to host that's
> > reading the information. libtraceevent does a byte swap on values read when
> > the host and file do not match endianess.
>
> Does this patch work for you?
>
> I only compiled it, I haven't tested it against real functions.

Sorry for the late reply, I tested my patch on mips, arm, arm64 and x86 and
it works everywhere, but for arm64 I had to add extra functions, because
it doesn't use the GCC __builin for swapping bytes. I have extended the
plugin and will send a new version.

On mips using network order ntohs (and similar) expands to a cast only, so
the call to swap is not present.
BR,
  Petr