struct lttng_ust_filter_bytecode bc;
};
+/*
+ * Filter return value masks.
+ */
+enum lttng_filter_ret {
+ LTTNG_FILTER_DISCARD = 0,
+ LTTNG_FILTER_RECORD_FLAG = (1ULL << 0),
+ /* Other bits are kept for future use. */
+};
+
struct lttng_bytecode_runtime {
/* Associated bytecode */
struct lttng_ust_filter_bytecode_node *bc;
- int (*filter)(void *filter_data, const char *filter_stack_data);
+ uint64_t (*filter)(void *filter_data, const char *filter_stack_data);
int link_failed;
struct cds_list_head node; /* list of bytecode runtime in event */
};
return; \
if (caa_unlikely(!cds_list_empty(&__event->bytecode_runtime_head))) { \
struct lttng_bytecode_runtime *bc_runtime; \
- int __filter_result = 0; \
+ int __filter_record = 0; \
\
__event_prepare_filter_stack__##_provider##___##_name(__stackvar.__filter_stack_data, \
_TP_ARGS_DATA_VAR(_args)); \
cds_list_for_each_entry_rcu(bc_runtime, &__event->bytecode_runtime_head, node) { \
if (caa_unlikely(bc_runtime->filter(bc_runtime, \
- __stackvar.__filter_stack_data))) \
- __filter_result = 1; \
+ __stackvar.__filter_stack_data) & LTTNG_FILTER_RECORD_FLAG)) \
+ __filter_record = 1; \
} \
- if (caa_likely(!__filter_result)) \
+ if (caa_likely(!__filter_record)) \
return; \
} \
__event_len = __event_get_size__##_provider##___##_name(__stackvar.__dynamic_len, \
return diff;
}
-int lttng_filter_false(void *filter_data,
+uint64_t lttng_filter_false(void *filter_data,
const char *filter_stack_data)
{
return 0;
#endif
-int lttng_filter_interpret_bytecode(void *filter_data,
+/*
+ * Return 0 (discard), or raise the 0x1 flag (log event).
+ * Currently, other flags are kept for future extensions and have no
+ * effect.
+ */
+uint64_t lttng_filter_interpret_bytecode(void *filter_data,
const char *filter_stack_data)
{
struct bytecode_runtime *bytecode = filter_data;
goto end;
OP(FILTER_OP_RETURN):
+ /* LTTNG_FILTER_DISCARD or LTTNG_FILTER_RECORD_FLAG */
retval = !!estack_ax_v;
ret = 0;
goto end;
int lttng_filter_validate_bytecode(struct bytecode_runtime *bytecode);
int lttng_filter_specialize_bytecode(struct bytecode_runtime *bytecode);
-int lttng_filter_false(void *filter_data,
+uint64_t lttng_filter_false(void *filter_data,
const char *filter_stack_data);
-int lttng_filter_interpret_bytecode(void *filter_data,
+uint64_t lttng_filter_interpret_bytecode(void *filter_data,
const char *filter_stack_data);
#endif /* _LTTNG_FILTER_H */