)
#endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
+#ifdef LTTNG_CREATE_FIELD_METADATA
#ifndef ONCE_LTTNG_TRACE_POLL_H
#define ONCE_LTTNG_TRACE_POLL_H
#define POLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \
ilog2(LTTNG_POLL_NRFLAGS - 1)
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
/*
* Only extract the values specified by iBCS2 for now.
*/
false, false, false),
};
+static_assert(((ARRAY_SIZE(lttng_pollfd_flag_fields) - 1) + POLL_FLAGS_PADDING_SIZE) == sizeof(uint8_t) * BITS_PER_BYTE);
+
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_pollfd_flag_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init( ARRAY_SIZE(lttng_pollfd_flag_fields), lttng_pollfd_flag_fields, 0)))
+
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
static const struct lttng_kernel_event_field *lttng_pollfd_fields[] = {
[0] = lttng_kernel_static_event_field("fd", lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
false, false, false),
[1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint16_t, __BYTE_ORDER, 16),
false, false, false),
[2] = lttng_kernel_static_event_field("events",
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_flag_fields),
- lttng_pollfd_flag_fields, 0),
+ (const struct lttng_kernel_type_common *) <tng_pollfd_flag_fields_struct,
false, false, false),
};
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_pollfd_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0)))
#endif /* ONCE_LTTNG_TRACE_POLL_H */
+#endif /* LTTNG_CREATE_FIELD_METADATA */
#define LTTNG_SYSCALL_POLL_locvar \
unsigned int fds_length, fds_max_len, alloc_fds; \
uint8_t overflow;
#define LTTNG_SYSCALL_POLL_code_pre \
- BUILD_BUG_ON(((ARRAY_SIZE(lttng_pollfd_flag_fields) - 1) + \
- POLL_FLAGS_PADDING_SIZE) != \
- sizeof(uint8_t) * BITS_PER_BYTE); \
tp_locvar->fds = NULL; \
tp_locvar->overflow = 0; \
\
ctf_custom_field( \
ctf_custom_type( \
lttng_kernel_static_type_sequence("fds_length", \
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0), \
+ (const struct lttng_kernel_type_common *) <tng_pollfd_fields_struct, \
0, \
none) \
), \
ctf_custom_field( \
ctf_custom_type( \
lttng_kernel_static_type_sequence("fds_length", \
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_pollfd_fields), lttng_pollfd_fields, 0), \
+ (const struct lttng_kernel_type_common *) <tng_pollfd_fields_struct, \
0, \
none) \
), \
)
)
+#ifdef LTTNG_CREATE_FIELD_METADATA
+
#ifndef ONCE_LTTNG_TRACE_EPOLL_CTL_H
#define ONCE_LTTNG_TRACE_EPOLL_CTL_H
#define EPOLL_FLAGS_PADDING_SIZE (sizeof(uint8_t) * BITS_PER_BYTE) - \
ilog2(LTTNG_EPOLL_NRFLAGS - 1)
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
/*
* Only extract the values specified by iBCS2 for now.
*/
lttng_kernel_static_type_integer(EPOLL_FLAGS_PADDING_SIZE, 1, 0, __LITTLE_ENDIAN, 10),
false, false, false),
};
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_ctl_events_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_ctl_events_fields), lttng_epoll_ctl_events_fields, 0)))
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
static const struct lttng_kernel_event_field *lttng_epoll_data_fields[] = {
[0] = lttng_kernel_static_event_field("u64",
lttng_kernel_static_type_integer_from_type(uint64_t, __BYTE_ORDER, 16),
lttng_kernel_static_type_integer_from_type(int, __BYTE_ORDER, 10),
false, false, false),
};
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_data_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_data_fields), lttng_epoll_data_fields, 0)))
+
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
static const struct lttng_kernel_event_field *epoll_ctl_fields[] = {
[0] = lttng_kernel_static_event_field("data_union",
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_data_fields),
- lttng_epoll_data_fields,
- 0),
+ (const struct lttng_kernel_type_common *) <tng_epoll_data_fields_struct,
false, false, false),
[1] = lttng_kernel_static_event_field("raw_events",
lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16),
false, false, false),
[2] = lttng_kernel_static_event_field("events",
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_ctl_events_fields),
- lttng_epoll_ctl_events_fields,
- 0),
+ (const struct lttng_kernel_type_common *) <tng_epoll_ctl_events_fields_struct,
false, false, false),
};
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct epoll_ctl_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(epoll_ctl_fields), epoll_ctl_fields, 0)))
+
#endif /* ONCE_LTTNG_TRACE_EPOLL_CTL_H */
+#endif /* LTTNG_CREATE_FIELD_METADATA */
#if defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM)
#define OVERRIDE_32_epoll_ctl
)
#endif /* defined(CONFIG_X86_32) || defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || defined(CONFIG_ARM) */
+#ifdef LTTNG_CREATE_FIELD_METADATA
#ifndef ONCE_LTTNG_TRACE_EPOLL_H
#define ONCE_LTTNG_TRACE_EPOLL_H
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
static const struct lttng_kernel_event_field *lttng_epoll_wait_fields[] = lttng_kernel_static_event_field_array(
[0] = lttng_kernel_static_event_field("data_union",
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_data_fields), lttng_epoll_data_fields, 0),
+ (const struct lttng_kernel_type_common *) <tng_epoll_data_fields_struct,
false, false, false),
[1] = lttng_kernel_static_event_field("raw_events", lttng_kernel_static_type_integer_from_type(uint32_t, __BYTE_ORDER, 16),
false, false, false),
[2] = lttng_kernel_static_event_field("events",
- lttng_kernel_static_type_struct(ARRAY_SIZE(lttng_epoll_ctl_events_fields), lttng_epoll_ctl_events_fields, 0),
+ (const struct lttng_kernel_type_common *) <tng_epoll_ctl_events_fields_struct,
false, false, false),
);
+static_assert(((ARRAY_SIZE(lttng_epoll_ctl_events_fields) - 1) + EPOLL_FLAGS_PADDING_SIZE) == sizeof(uint8_t) * BITS_PER_BYTE);
+
+#endif /* LTTNG_TRACEPOINT_TYPE_EXTERN */
+
+LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_type_struct lttng_epoll_wait_fields_struct),
+ PARAMS(lttng_kernel_static_type_struct_init(ARRAY_SIZE(lttng_epoll_wait_fields), lttng_epoll_wait_fields, 0)))
+
#endif /* ONCE_LTTNG_TRACE_EPOLL_H */
+#endif /* LTTNG_CREATE_FIELD_METADATA */
#define LTTNG_SYSCALL_EPOLL_WAIT_locvar \
sc_out( \
)
#define LTTNG_SYSCALL_EPOLL_WAIT_code_pre \
- BUILD_BUG_ON(((ARRAY_SIZE(lttng_epoll_ctl_events_fields) - 1) + \
- EPOLL_FLAGS_PADDING_SIZE) != \
- sizeof(uint8_t) * BITS_PER_BYTE); \
sc_out({ \
int err; \
unsigned long maxalloc; \
nofilter:1; /* do not consider for filter */
};
+#ifndef PARAMS
+#define PARAMS(args...) args
+#endif
+
#define lttng_kernel_static_type_integer(_size, _alignment, _signedness, _byte_order, _base) \
((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_integer, { \
.parent = { \
.encoding = lttng_kernel_string_encoding_##_encoding, \
}))
-#define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \
- ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, { \
+#define lttng_kernel_static_type_struct_init(_nr_fields, _fields, _alignment) \
+ { \
.parent = { \
.type = lttng_kernel_type_struct, \
}, \
.nr_fields = (_nr_fields), \
.fields = _fields, \
.alignment = (_alignment), \
- }))
+ }
+
+#define lttng_kernel_static_type_struct(_nr_fields, _fields, _alignment) \
+ ((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_struct, \
+ lttng_kernel_static_type_struct_init(_nr_fields, PARAMS(_fields), _alignment) \
+ ))
#define lttng_kernel_static_type_variant(_nr_choices, _choices, _tag_name, _alignment) \
((const struct lttng_kernel_type_common *) __LTTNG_COMPOUND_LITERAL(const struct lttng_kernel_type_variant, { \
#define TP_ENUM_VALUES(...) \
__VA_ARGS__
-#undef LTTNG_TRACEPOINT_ENUM
-#define LTTNG_TRACEPOINT_ENUM(_name, _values) \
+#ifndef LTTNG_TRACEPOINT_TYPE_EXTERN
+# undef LTTNG_TRACEPOINT_ENUM
+# define LTTNG_TRACEPOINT_ENUM(_name, _values) \
static const struct lttng_kernel_enum_entry *__enum_values__##_name[] = { \
_values \
};
+#endif
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#define LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post) \
LTTNG_TRACEPOINT_EVENT_CLASS_CODE_NOARGS(_name, _locvar, _code_pre, PARAMS(_fields), _code_post)
-#undef LTTNG_TRACEPOINT_ENUM
-#define LTTNG_TRACEPOINT_ENUM(_name, _values) \
- static const struct lttng_kernel_enum_desc __enum_##_name = { \
- .name = #_name, \
- .entries = __enum_values__##_name, \
- .nr_entries = ARRAY_SIZE(__enum_values__##_name), \
- };
+#ifdef LTTNG_TRACEPOINT_TYPE_EXTERN
+# undef LTTNG_TRACEPOINT_TYPE
+# define LTTNG_TRACEPOINT_TYPE(_prototype, _init) \
+ extern _prototype;
+#elif defined (LTTNG_TRACEPOINT_TYPE_DEFINE_EXPORT)
+# define LTTNG_TRACEPOINT_TYPE_VISIBILITY __attribute__((visibility("hidden")))
+#else
+# define LTTNG_TRACEPOINT_TYPE_VISIBILITY static
+#endif
+
+#ifdef LTTNG_TRACEPOINT_TYPE_VISIBILITY
+# undef LTTNG_TRACEPOINT_TYPE
+# define LTTNG_TRACEPOINT_TYPE(_prototype, _init) \
+ LTTNG_TRACEPOINT_TYPE_VISIBILITY _prototype = _init;
+#endif
+
+# undef LTTNG_TRACEPOINT_ENUM
+# define LTTNG_TRACEPOINT_ENUM(_name, _values) \
+ LTTNG_TRACEPOINT_TYPE(PARAMS(const struct lttng_kernel_enum_desc __enum_##_name), \
+ PARAMS({ \
+ .name = #_name, \
+ .entries = __enum_values__##_name, \
+ .nr_entries = ARRAY_SIZE(__enum_values__##_name), \
+ }))
#define LTTNG_CREATE_FIELD_METADATA
#include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
#undef LTTNG_CREATE_FIELD_METADATA
+#undef LTTNG_TRACEPOINT_TYPE_VISIBILITY
+
/*
* Stage 3 of the trace events.
*
--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-syscalls-enum.c
+ *
+ * LTTng syscall enum types
+ *
+ * Copyright (C) 2021 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
+ */
+
+#include <lttng/events.h>
+
+#define LTTNG_PACKAGE_BUILD
+#define CREATE_TRACE_POINTS
+#define TP_MODULE_NOINIT
+#define TRACE_INCLUDE_PATH instrumentation/syscalls/headers
+
+#define PARAMS(args...) args
+
+#undef sc_exit
+#define sc_exit(...)
+#undef sc_in
+#define sc_in(...) __VA_ARGS__
+#undef sc_out
+#define sc_out(...)
+#undef sc_inout
+#define sc_inout(...) __VA_ARGS__
+
+#define TP_PROBE_CB(_template)
+#define SC_LTTNG_TRACEPOINT_EVENT(_name, _proto, _args, _fields)
+#define SC_LTTNG_TRACEPOINT_EVENT_CODE(_name, _proto, _args, _locvar, _code_pre, _fields, _code_post)
+#define SC_LTTNG_TRACEPOINT_EVENT_CLASS_NOARGS(_name, _fields)
+#define SC_LTTNG_TRACEPOINT_EVENT_INSTANCE_NOARGS(_template, _name)
+
+#define LTTNG_TRACEPOINT_TYPE_DEFINE_EXPORT
+
+#define SC_LTTNG_TRACEPOINT_ENUM(_name, _values) \
+ LTTNG_TRACEPOINT_ENUM(_name, PARAMS(_values))
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM syscall_entry_integers
+#define TRACE_INCLUDE_FILE syscalls_integers
+#include <instrumentation/syscalls/headers/syscalls_integers.h>
+#undef TRACE_INCLUDE_FILE
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM syscall_entry_pointers
+#define TRACE_INCLUDE_FILE syscalls_pointers
+#include <instrumentation/syscalls/headers/syscalls_pointers.h>
+#undef TRACE_INCLUDE_FILE
+#undef TRACE_SYSTEM
+#undef SC_LTTNG_TRACEPOINT_ENUM