*
* The consumer socket lock must be held by the caller.
*/
-int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd)
+int consumer_send_fds(struct consumer_socket *sock, const int *fds,
+ size_t nb_fd)
{
int ret;
/*
* Init channel communication message structure.
*/
-void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg,
- enum lttng_consumer_command cmd,
+void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
uint64_t channel_key,
uint64_t session_id,
const char *pathname,
memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
/* Send channel */
- msg->cmd_type = cmd;
+ msg->cmd_type = LTTNG_CONSUMER_ADD_CHANNEL;
msg->u.channel.channel_key = channel_key;
msg->u.channel.session_id = session_id;
msg->u.channel.uid = uid;
*/
int consumer_send_stream(struct consumer_socket *sock,
struct consumer_output *dst, struct lttcomm_consumer_msg *msg,
- int *fds, size_t nb_fd)
+ const int *fds, size_t nb_fd)
{
int ret;
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
goto error;
+ } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) {
+ ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s/%s-%s-%" PRIu64 "%s\"",
+ sizeof(msg.u.snapshot_channel.pathname),
+ ret, output->consumer->dst.net.base_dir,
+ output->consumer->subdir,
+ output->name, output->datetime,
+ output->nb_snapshot,
+ session_path);
+ ret = -LTTNG_ERR_SNAPSHOT_FAIL;
+ goto error;
}
} else {
ret = snprintf(msg.u.snapshot_channel.pathname,
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
goto error;
+ } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) {
+ ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s-%s-%" PRIu64 "%s\"",
+ sizeof(msg.u.snapshot_channel.pathname),
+ ret, output->consumer->dst.session_root_path,
+ output->name, output->datetime, output->nb_snapshot,
+ session_path);
+ ret = -LTTNG_ERR_SNAPSHOT_FAIL;
+ goto error;
}
+
msg.u.snapshot_channel.relayd_id = (uint64_t) -1ULL;
/* Create directory. Ignore if exist. */