#include "ust-app.hpp"
#include "agent.hpp"
+namespace lsu = lttng::sessiond::ust;
+
/*
* Match function for the events hash table lookup.
*
DBG2("Trace UST channel %s found by name", name);
- return caa_container_of(node, struct ltt_ust_channel, node);
+ return lttng::utils::container_of(node, <t_ust_channel::node);
error:
DBG2("Trace UST channel %s not found by name", name);
DBG2("Trace UST event %s found", key.name);
- return caa_container_of(node, struct ltt_ust_event, node);
+ return lttng::utils::container_of(node, <t_ust_event::node);
error:
DBG2("Trace UST event %s NOT found", key.name);
if (!node) {
goto end;
}
- agt = caa_container_of(node, struct agent, node);
+ agt = lttng::utils::container_of(node, &agent::node);
end:
return agt;
struct ltt_ust_session *lus;
/* Allocate a new ltt ust session */
- lus = (ltt_ust_session *) zmalloc(sizeof(struct ltt_ust_session));
+ lus = zmalloc<ltt_ust_session>();
if (lus == NULL) {
PERROR("create ust session zmalloc");
goto error_alloc;
LTTNG_ASSERT(chan);
- luc = (ltt_ust_channel *) zmalloc(sizeof(struct ltt_ust_channel));
+ luc = zmalloc<ltt_ust_channel>();
if (luc == NULL) {
PERROR("ltt_ust_channel zmalloc");
goto error;
goto error;
}
- local_ust_event = (ltt_ust_event *) zmalloc(sizeof(struct ltt_ust_event));
+ local_ust_event = zmalloc<ltt_ust_event>();
if (local_ust_event == NULL) {
PERROR("ust event zmalloc");
ret = LTTNG_ERR_NOMEM;
goto end;
}
- uctx = (ltt_ust_context *) zmalloc(sizeof(struct ltt_ust_context));
+ uctx = zmalloc<ltt_ust_context>();
if (!uctx) {
PERROR("zmalloc ltt_ust_context");
goto end;
lttng_ht_lookup(id_tracker->ht, (void *) _id, iter);
node = lttng_ht_iter_get_node_ulong(iter);
if (node) {
- return caa_container_of(node, struct ust_id_tracker_node, node);
+ return lttng::utils::container_of(node, &ust_id_tracker_node::node);
} else {
return NULL;
}
retval = LTTNG_ERR_PROCESS_ATTR_EXISTS;
goto end;
}
- tracker_node = (ust_id_tracker_node *) zmalloc(sizeof(*tracker_node));
+ tracker_node = zmalloc<ust_id_tracker_node>();
if (!tracker_node) {
retval = LTTNG_ERR_NOMEM;
goto end;
static void destroy_context_rcu(struct rcu_head *head)
{
struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
+ lttng::utils::container_of(head, <tng_ht_node_ulong::head);
struct ltt_ust_context *ctx =
- caa_container_of(node, struct ltt_ust_context, node);
+ lttng::utils::container_of(node, <t_ust_context::node);
trace_ust_destroy_context(ctx);
}
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);
+ ctx = lttng::utils::container_of(node, <t_ust_context::node);
cds_list_del(&ctx->list);
/* Remove from channel's hash table. */
ret = lttng_ht_del(ht, &iter);
static void destroy_event_rcu(struct rcu_head *head)
{
struct lttng_ht_node_str *node =
- caa_container_of(head, struct lttng_ht_node_str, head);
+ lttng::utils::container_of(head, <tng_ht_node_str::head);
struct ltt_ust_event *event =
- caa_container_of(node, struct ltt_ust_event, node);
+ lttng::utils::container_of(node, <t_ust_event::node);
trace_ust_destroy_event(event);
}
static void destroy_channel_rcu(struct rcu_head *head)
{
struct lttng_ht_node_str *node =
- caa_container_of(head, struct lttng_ht_node_str, head);
+ lttng::utils::container_of(head, <tng_ht_node_str::head);
struct ltt_ust_channel *channel =
- caa_container_of(node, struct ltt_ust_channel, node);
+ lttng::utils::container_of(node, <t_ust_channel::node);
_trace_ust_destroy_channel(channel);
}
LTTNG_ASSERT(!ret);
}
+int trace_ust_regenerate_metadata(struct ltt_ust_session *usess)
+{
+ int ret = 0;
+ struct buffer_reg_uid *uid_reg = NULL;
+ struct buffer_reg_session *session_reg = NULL;
+
+ rcu_read_lock();
+ cds_list_for_each_entry(uid_reg, &usess->buffer_reg_uid_list, lnode) {
+ lsu::registry_session *registry;
+
+ session_reg = uid_reg->registry;
+ registry = session_reg->reg.ust;
+
+ try {
+ registry->regenerate_metadata();
+ } catch (const std::exception& ex) {
+ ERR("Failed to regenerate user space session metadata: %s", ex.what());
+ ret = -1;
+ goto end;
+ }
+ }
+
+end:
+ rcu_read_unlock();
+ return ret;
+}
+
/*
* Iterate over a hash table containing channels and cleanup safely.
*/
rcu_read_lock();
cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
struct ltt_ust_channel *chan =
- caa_container_of(node, struct ltt_ust_channel, node);
+ lttng::utils::container_of(node, <t_ust_channel::node);
trace_ust_delete_channel(channels, chan);
trace_ust_destroy_channel(chan);