/*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
* Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
* Copyright (C) 2013 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
#include <pthread.h>
#include <signal.h>
#include <stddef.h>
+#include <stdint.h>
#include <sys/stat.h>
#include "client.h"
int ret = LTTNG_OK;
int need_tracing_session = 1;
int need_domain;
+ struct lttng_dynamic_buffer payload;
+
+ lttng_dynamic_buffer_init(&payload);
DBG("Processing client command %d", cmd_ctx->lsm->cmd_type);
}
case LTTNG_ENABLE_CHANNEL:
{
- cmd_ctx->lsm->u.channel.chan.attr.extended.ptr =
- (struct lttng_channel_extended *) &cmd_ctx->lsm->u.channel.extended;
- ret = cmd_enable_channel(cmd_ctx->session,
- ALIGNED_CONST_PTR(cmd_ctx->lsm->domain),
- ALIGNED_CONST_PTR(cmd_ctx->lsm->u.channel.chan),
- kernel_poll_pipe[1]);
+ ret = cmd_enable_channel(cmd_ctx, *sock, kernel_poll_pipe[1]);
break;
}
case LTTNG_PROCESS_ATTR_TRACKER_ADD_INCLUDE_VALUE:
}
case LTTNG_LIST_CHANNELS:
{
- ssize_t payload_size;
- struct lttng_channel *channels = NULL;
+ uint32_t nb_channel;
+ enum lttng_error_code ret_code;
+ struct lttcomm_list_command_header cmd_header = { 0 };
- payload_size = cmd_list_channels(cmd_ctx->lsm->domain.type,
- cmd_ctx->session, &channels);
- if (payload_size < 0) {
- /* Return value is a negative lttng_error_code. */
- ret = -payload_size;
+ ret_code = cmd_list_channels(cmd_ctx->lsm->domain.type,
+ cmd_ctx->session, &payload, &nb_channel);
+ if (ret_code != LTTNG_OK) {
+ ret = (int) ret_code;
goto error;
}
- ret = setup_lttng_msg_no_cmd_header(cmd_ctx, channels,
- payload_size);
- free(channels);
+ cmd_header.count = nb_channel;
+ ret = setup_lttng_msg(cmd_ctx, payload.data, payload.size,
+ &cmd_header, sizeof(cmd_header));
if (ret < 0) {
goto setup_error;
}
init_setup_error:
assert(!rcu_read_ongoing());
+ lttng_dynamic_buffer_reset(&payload);
return ret;
}