#include <unistd.h>
#include <inttypes.h>
-#include <common/common.h>
-#include <common/defaults.h>
-#include <common/uri.h>
-#include <common/relayd/relayd.h>
-#include <common/string-utils/format.h>
-
-#include "consumer.h"
-#include "health-sessiond.h"
-#include "ust-app.h"
-#include "utils.h"
-#include "lttng-sessiond.h"
+#include <common/common.hpp>
+#include <common/defaults.hpp>
+#include <common/uri.hpp>
+#include <common/relayd/relayd.hpp>
+#include <common/string-utils/format.hpp>
+
+#include "consumer.hpp"
+#include "health-sessiond.hpp"
+#include "ust-app.hpp"
+#include "utils.hpp"
+#include "lttng-sessiond.hpp"
/*
* Return allocated full pathname of the session using the consumer trace path
* Allocate the string ourself to make sure we never exceed
* LTTNG_PATH_MAX.
*/
- pathname = (char *) zmalloc(LTTNG_PATH_MAX);
+ pathname = calloc<char>(LTTNG_PATH_MAX);
if (!pathname) {
goto error;
}
&iter);
node = lttng_ht_iter_get_node_ulong(&iter);
if (node != NULL) {
- socket = caa_container_of(node, struct consumer_socket, node);
+ socket = lttng::utils::container_of(node, &consumer_socket::node);
}
return socket;
LTTNG_ASSERT(fd);
- socket = (consumer_socket *) zmalloc(sizeof(struct consumer_socket));
+ socket = zmalloc<consumer_socket>();
if (socket == NULL) {
PERROR("zmalloc consumer socket");
goto error;
static void destroy_socket_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 consumer_socket *socket =
- caa_container_of(node, struct consumer_socket, node);
+ lttng::utils::container_of(node, &consumer_socket::node);
free(socket);
}
{
struct consumer_output *output = NULL;
- output = (consumer_output *) zmalloc(sizeof(struct consumer_output));
+ output = zmalloc<consumer_output>();
if (output == NULL) {
PERROR("zmalloc consumer_output");
goto error;
static void consumer_release_output(struct urcu_ref *ref)
{
struct consumer_output *obj =
- caa_container_of(ref, struct consumer_output, ref);
+ lttng::utils::container_of(ref, &consumer_output::ref);
consumer_destroy_output_sockets(obj);
const char *name,
uint64_t relayd_id,
uint64_t key,
- unsigned char *uuid,
+ const lttng_uuid& uuid,
uint32_t chan_id,
uint64_t tracefile_size,
uint64_t tracefile_count,
msg->u.ask_channel.ust_app_uid = ust_app_uid;
msg->u.ask_channel.blocking_timeout = blocking_timeout;
- memcpy(msg->u.ask_channel.uuid, uuid, sizeof(msg->u.ask_channel.uuid));
+ std::copy(uuid.begin(), uuid.end(), msg->u.ask_channel.uuid);
if (pathname) {
strncpy(msg->u.ask_channel.pathname, pathname,
int ret;
lttcomm_consumer_msg msg = {
.cmd_type = LTTNG_CONSUMER_OPEN_CHANNEL_PACKETS,
+ .u = {},
};
msg.u.open_channel_packets.key = key;
}
int consumer_init(struct consumer_socket *socket,
- const lttng_uuid sessiond_uuid)
+ const lttng_uuid& sessiond_uuid)
{
int ret;
struct lttcomm_consumer_msg msg = {
.cmd_type = LTTNG_CONSUMER_INIT,
+ .u = {},
};
LTTNG_ASSERT(socket);
DBG("Sending consumer initialization command");
- lttng_uuid_copy(msg.u.init.sessiond_uuid, sessiond_uuid);
+ std::copy(sessiond_uuid.begin(), sessiond_uuid.end(), msg.u.init.sessiond_uuid);
health_code_update();
ret = consumer_send_msg(socket, &msg);
enum lttng_trace_chunk_status tc_status;
struct lttcomm_consumer_msg msg = {
.cmd_type = LTTNG_CONSUMER_CREATE_TRACE_CHUNK,
+ .u = {},
};
msg.u.create_trace_chunk.session_id = session_id;
enum lttng_trace_chunk_status chunk_status;
lttcomm_consumer_msg msg = {
.cmd_type = LTTNG_CONSUMER_CLOSE_TRACE_CHUNK,
+ .u = {},
};
msg.u.close_trace_chunk.session_id = session_id;
enum lttng_trace_chunk_status chunk_status;
lttcomm_consumer_msg msg = {
.cmd_type = LTTNG_CONSUMER_TRACE_CHUNK_EXISTS,
+ .u = {},
};
msg.u.trace_chunk_exists.session_id = session_id;