extern int lttng_list_events(struct lttng_handle *handle,
const char *channel_name, struct lttng_event **events);
+/*
+ * Get the filter string of a specific LTTng event.
+ *
+ * If the call is successful, then the filter string's address is put
+ * in *filter_string. If the event has no filter string, *filter_string
+ * is set to NULL. The caller does NOT own *filter_string.
+ *
+ * Returns 0 on success, or a negative LTTng error code on error.
+ */
+extern int lttng_event_get_filter_string(struct lttng_event *event,
+ const char **filter_string);
+
/*
* List the available tracepoints of a specific lttng domain.
*
node = lttng_ht_iter_get_node_str(&iter);
if (node == NULL) {
ret = LTTNG_ERR_UST_CHAN_NOT_FOUND;
- goto error;
+ goto end;
}
uchan = caa_container_of(&node->node, struct ltt_ust_channel, node.node);
if (nb_event == 0) {
ret = nb_event;
*total_size = 0;
- goto error;
+ goto end;
}
DBG3("Listing UST global %d events", nb_event);
increment_extended_len(uevent->filter_expression,
&extended_len);
}
+ if (nb_event == 0) {
+ /* All events are internal, skip. */
+ ret = 0;
+ *total_size = 0;
+ goto end;
+ }
*total_size = nb_event * sizeof(struct lttng_event) + extended_len;
tmp = zmalloc(*total_size);
ret = nb_event;
*events = tmp;
-
-error:
+end:
rcu_read_unlock();
return ret;
}
return ret;
}
+int lttng_event_get_filter_string(struct lttng_event *event,
+ const char **filter_string)
+{
+ int ret = 0;
+ struct lttcomm_event_extended_header *ext_header;
+
+ if (!event || !filter_string) {
+ ret = -LTTNG_ERR_INVALID;
+ goto end;
+ }
+
+ ext_header = event->extended.ptr;
+
+ if (!ext_header) {
+ /*
+ * This can happen since the lttng_event structure is
+ * used for other tasks where this pointer is never set.
+ */
+ *filter_string = NULL;
+ goto end;
+ }
+
+ if (ext_header->filter_len) {
+ *filter_string = ((const char *) (ext_header)) +
+ sizeof(*ext_header);
+ } else {
+ *filter_string = NULL;
+ }
+
+end:
+ return ret;
+}
/*
* Sets the tracing_group variable with name.