/* Init node */
lttng_ht_node_init_str(&luc->node, luc->name);
+ CDS_INIT_LIST_HEAD(&luc->ctx_list);
+
/* Alloc hash tables */
luc->events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
luc->ctx = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
uctx->ctx.ctx = utype;
lttng_ht_node_init_ulong(&uctx->node, (unsigned long) uctx->ctx.ctx);
+ CDS_INIT_LIST_HEAD(&uctx->list);
return uctx;
int ret;
struct lttng_ht_node_ulong *node;
struct lttng_ht_iter iter;
+ struct ltt_ust_context *ctx;
assert(ht);
rcu_read_lock();
cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
+ /* Remove from ordered list. */
+ ctx = caa_container_of(node, struct ltt_ust_context, node);
+ cds_list_del(&ctx->list);
+ /* Remove from channel's hash table. */
ret = lttng_ht_del(ht, &iter);
if (!ret) {
call_rcu(&node->head, destroy_context_rcu);
/* Wipe context */
cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
+ cds_list_del(&ua_ctx->list);
ret = lttng_ht_del(ua_chan->ctx, &iter);
assert(!ret);
delete_ust_app_ctx(sock, ua_ctx);
lttng_ht_node_init_str(&ua_chan->node, ua_chan->name);
CDS_INIT_LIST_HEAD(&ua_chan->streams.head);
+ CDS_INIT_LIST_HEAD(&ua_chan->ctx_list);
/* Copy attributes */
if (attr) {
goto error;
}
+ CDS_INIT_LIST_HEAD(&ua_ctx->list);
+
if (uctx) {
memcpy(&ua_ctx->ctx, uctx, sizeof(ua_ctx->ctx));
}
ua_chan->enabled = uchan->enabled;
ua_chan->tracing_channel_id = uchan->id;
- cds_lfht_for_each_entry(uchan->ctx->ht, &iter.iter, uctx, node.node) {
+ cds_list_for_each_entry(uctx, &uchan->ctx_list, list) {
ua_ctx = alloc_ust_app_ctx(&uctx->ctx);
if (ua_ctx == NULL) {
continue;
lttng_ht_node_init_ulong(&ua_ctx->node,
(unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
+ cds_list_add_tail(&ua_ctx->list, &ua_chan->ctx_list);
}
/* Copy all events from ltt ust channel to ust app channel */
lttng_ht_node_init_ulong(&ua_ctx->node, (unsigned long) ua_ctx->ctx.ctx);
lttng_ht_add_unique_ulong(ua_chan->ctx, &ua_ctx->node);
+ cds_list_add_tail(&ua_ctx->list, &ua_chan->ctx_list);
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
void ust_app_global_update(struct ltt_ust_session *usess, int sock)
{
int ret = 0;
- struct lttng_ht_iter iter, uiter, iter_ctx;
+ struct lttng_ht_iter iter, uiter;
struct ust_app *app;
struct ust_app_session *ua_sess = NULL;
struct ust_app_channel *ua_chan;
}
}
- cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter_ctx.iter, ua_ctx,
- node.node) {
+ /*
+ * Add context using the list so they are enabled in the same order the
+ * user added them.
+ */
+ cds_list_for_each_entry(ua_ctx, &ua_chan->ctx_list, list) {
ret = create_ust_channel_context(ua_chan, ua_ctx, app);
if (ret < 0) {
goto error_unlock;
struct lttng_ust_context ctx;
struct lttng_ust_object_data *obj;
struct lttng_ht_node_ulong node;
+ struct cds_list_head list;
};
struct ust_app_event {
struct ust_app_stream_list streams;
/* Session pointer that owns this object. */
struct ust_app_session *session;
+ /*
+ * Contexts are kept in a hash table for fast lookup and in an ordered list
+ * so we are able to enable them on the tracer side in the same order the
+ * user added them.
+ */
struct lttng_ht *ctx;
+ struct cds_list_head ctx_list;
+
struct lttng_ht *events;
uint64_t tracefile_size;
uint64_t tracefile_count;