#include "ust-events-internal.h"
#include "wait.h"
#include "../libringbuffer/shm.h"
+#include "../libringbuffer/frontend_types.h"
#include "../libcounter/counter.h"
#include "jhash.h"
#include <lttng/ust-abi.h>
struct lttng_ust_shm_handle *handle;
cds_list_del(<tng_chan->priv->node);
- lttng_destroy_context(lttng_chan->ctx);
- chan = lttng_chan->chan;
- handle = lttng_chan->handle;
+ lttng_destroy_context(lttng_chan->priv->ctx);
+ chan = lttng_chan->priv->rb_chan;
+ handle = chan->handle;
channel_destroy(chan, handle, 0);
free(lttng_chan->parent);
free(lttng_chan->priv);
/* don't change it if session stop/restart */
if (chan->header_type)
continue;
- ctx = chan->pub->ctx;
+ ctx = chan->ctx;
if (ctx) {
nr_fields = ctx->nr_fields;
fields = ctx->fields;
event_recorder->chan = chan;
/* Event will be enabled by enabler sync. */
+ event_recorder->parent->run_filter = lttng_ust_interpret_event_filter;
event_recorder->parent->enabled = 0;
event_recorder->parent->priv->registered = 0;
- CDS_INIT_LIST_HEAD(&event_recorder->parent->filter_bytecode_runtime_head);
+ CDS_INIT_LIST_HEAD(&event_recorder->parent->priv->filter_bytecode_runtime_head);
CDS_INIT_LIST_HEAD(&event_recorder->parent->priv->enablers_ref_head);
event_recorder->parent->priv->desc = desc;
event_notifier_priv->error_counter_index = error_counter_index;
/* Event notifier will be enabled by enabler sync. */
+ event_notifier->parent->run_filter = lttng_ust_interpret_event_filter;
event_notifier->parent->enabled = 0;
event_notifier_priv->parent.registered = 0;
- CDS_INIT_LIST_HEAD(&event_notifier->parent->filter_bytecode_runtime_head);
- CDS_INIT_LIST_HEAD(&event_notifier->capture_bytecode_runtime_head);
+ CDS_INIT_LIST_HEAD(&event_notifier->parent->priv->filter_bytecode_runtime_head);
+ CDS_INIT_LIST_HEAD(&event_notifier->priv->capture_bytecode_runtime_head);
CDS_INIT_LIST_HEAD(&event_notifier_priv->parent.enablers_ref_head);
event_notifier_priv->parent.desc = desc;
event_notifier->notification_send = lttng_event_notifier_notification_send;
*/
lttng_enabler_link_bytecode(event_recorder_priv->parent.desc,
&session->priv->ctx,
- &event_recorder_priv->pub->parent->filter_bytecode_runtime_head,
+ &event_recorder_priv->parent.filter_bytecode_runtime_head,
<tng_event_enabler_as_enabler(event_enabler)->filter_bytecode_head);
/* TODO: merge event context. */
/* Remove from event hash table. */
cds_hlist_del(&event_recorder->priv->hlist);
- lttng_destroy_context(event_recorder->ctx);
+ lttng_destroy_context(event_recorder->priv->ctx);
free(event_recorder->parent);
free(event_recorder->priv);
free(event_recorder);
cds_list_for_each_entry(event_recorder_priv, &session->priv->events_head, node) {
struct lttng_enabler_ref *enabler_ref;
struct lttng_ust_bytecode_runtime *runtime;
- int enabled = 0, has_enablers_without_bytecode = 0;
+ int enabled = 0, has_enablers_without_filter_bytecode = 0;
+ int nr_filters = 0;
/* Enable events */
cds_list_for_each_entry(enabler_ref,
&event_recorder_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled
&& cds_list_empty(&enabler_ref->ref->filter_bytecode_head)) {
- has_enablers_without_bytecode = 1;
+ has_enablers_without_filter_bytecode = 1;
break;
}
}
- event_recorder_priv->pub->parent->has_enablers_without_bytecode =
- has_enablers_without_bytecode;
+ event_recorder_priv->parent.has_enablers_without_filter_bytecode =
+ has_enablers_without_filter_bytecode;
/* Enable filters */
cds_list_for_each_entry(runtime,
- &event_recorder_priv->pub->parent->filter_bytecode_runtime_head, node) {
- lttng_bytecode_filter_sync_state(runtime);
+ &event_recorder_priv->parent.filter_bytecode_runtime_head, node) {
+ lttng_bytecode_sync_state(runtime);
+ nr_filters++;
}
+ CMM_STORE_SHARED(event_recorder_priv->parent.pub->eval_filter,
+ !(has_enablers_without_filter_bytecode || !nr_filters));
}
lttng_ust_tp_probe_prune_release_queue();
}
*/
lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
&event_notifier_group->ctx,
- &event_notifier_priv->pub->parent->filter_bytecode_runtime_head,
+ &event_notifier_priv->parent.filter_bytecode_runtime_head,
<tng_event_notifier_enabler_as_enabler(event_notifier_enabler)->filter_bytecode_head);
/*
* Link capture bytecodes if not linked yet.
*/
lttng_enabler_link_bytecode(event_notifier_priv->parent.desc,
- &event_notifier_group->ctx, &event_notifier_priv->pub->capture_bytecode_runtime_head,
+ &event_notifier_group->ctx, &event_notifier_priv->capture_bytecode_runtime_head,
&event_notifier_enabler->capture_bytecode_head);
event_notifier_priv->num_captures = event_notifier_enabler->num_captures;
cds_list_for_each_entry(event_notifier_priv, &event_notifier_group->event_notifiers_head, node) {
struct lttng_enabler_ref *enabler_ref;
struct lttng_ust_bytecode_runtime *runtime;
- int enabled = 0, has_enablers_without_bytecode = 0;
+ int enabled = 0, has_enablers_without_filter_bytecode = 0;
+ int nr_filters = 0, nr_captures = 0;
/* Enable event_notifiers */
cds_list_for_each_entry(enabler_ref,
&event_notifier_priv->parent.enablers_ref_head, node) {
if (enabler_ref->ref->enabled
&& cds_list_empty(&enabler_ref->ref->filter_bytecode_head)) {
- has_enablers_without_bytecode = 1;
+ has_enablers_without_filter_bytecode = 1;
break;
}
}
- event_notifier_priv->pub->parent->has_enablers_without_bytecode =
- has_enablers_without_bytecode;
+ event_notifier_priv->parent.has_enablers_without_filter_bytecode =
+ has_enablers_without_filter_bytecode;
/* Enable filters */
cds_list_for_each_entry(runtime,
- &event_notifier_priv->pub->parent->filter_bytecode_runtime_head, node) {
- lttng_bytecode_filter_sync_state(runtime);
+ &event_notifier_priv->parent.filter_bytecode_runtime_head, node) {
+ lttng_bytecode_sync_state(runtime);
+ nr_filters++;
}
+ CMM_STORE_SHARED(event_notifier_priv->parent.pub->eval_filter,
+ !(has_enablers_without_filter_bytecode || !nr_filters));
/* Enable captures. */
cds_list_for_each_entry(runtime,
- &event_notifier_priv->pub->capture_bytecode_runtime_head, node) {
- lttng_bytecode_capture_sync_state(runtime);
+ &event_notifier_priv->capture_bytecode_runtime_head, node) {
+ lttng_bytecode_sync_state(runtime);
+ nr_captures++;
}
+ CMM_STORE_SHARED(event_notifier_priv->pub->eval_capture,
+ !!nr_captures);
}
lttng_ust_tp_probe_prune_release_queue();
}
if (ret)
abort();
cds_list_for_each_entry(chan, &session_priv->chan_head, node) {
- ret = lttng_ust_context_set_provider_rcu(&chan->pub->ctx,
+ ret = lttng_ust_context_set_provider_rcu(&chan->ctx,
name, get_size, record, get_value);
if (ret)
abort();
}
cds_list_for_each_entry(event_recorder_priv, &session_priv->events_head, node) {
- ret = lttng_ust_context_set_provider_rcu(&event_recorder_priv->pub->ctx,
+ ret = lttng_ust_context_set_provider_rcu(&event_recorder_priv->ctx,
name, get_size, record, get_value);
if (ret)
abort();
abort();
}
}
+
+int lttng_ust_session_uuid_validate(struct lttng_ust_session *session,
+ unsigned char *uuid)
+{
+ if (!session)
+ return 0;
+ /* Compare UUID with session. */
+ if (session->priv->uuid_set) {
+ if (memcmp(session->priv->uuid, uuid, LTTNG_UST_UUID_LEN)) {
+ return -1;
+ }
+ } else {
+ memcpy(session->priv->uuid, uuid, LTTNG_UST_UUID_LEN);
+ session->priv->uuid_set = true;
+ }
+ return 0;
+
+}