Commit [4d4c9c]  Maximize  Restore  History

tracing: Add __field_struct macro for TRACE_EVENT()

Currently the __field() macro in TRACE_EVENT is only good for primitive
values, such as integers and pointers, but it fails on complex data types
such as structures or unions. This is because the __field() macro
determines if the variable is signed or not with the test of:

(((type)(-1)) < (type)1)

Unfortunately, that fails when type is a structure.

Since trace events should support structures as fields a new macro
is created for such a case called __field_struct() which acts exactly
the same as __field() does but it does not do the signed type check
and just uses a constant false for that answer.

Cc: Tony Luck <>
Signed-off-by: Steven Rostedt <>

Steven Rostedt Steven Rostedt 2014-06-17

changed include/trace/ftrace.h
changed samples/trace_events/trace-events-sample.h
include/trace/ftrace.h Diff Switch to side-by-side view
samples/trace_events/trace-events-sample.h Diff Switch to side-by-side view

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks