error_rotate_channel:
goto end_nosignal;
}
+ case LTTNG_CONSUMER_CLEAR_CHANNEL:
+ {
+ struct lttng_consumer_channel *channel;
+ uint64_t key = msg.u.clear_channel.key;
+
+ channel = consumer_find_channel(key);
+ if (!channel) {
+ DBG("Channel %" PRIu64 " not found", key);
+ ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
+ } else {
+ ret = lttng_consumer_clear_channel(channel);
+ if (ret) {
+ ERR("Clear channel failed");
+ ret_code = ret;
+ }
+
+ health_code_update();
+ }
+ ret = consumer_send_status_msg(sock, ret_code);
+ if (ret < 0) {
+ /* Somehow, the session daemon is not responding anymore. */
+ goto end_nosignal;
+ }
+
+ break;
+ }
case LTTNG_CONSUMER_INIT:
{
ret_code = lttng_consumer_init_command(ctx,
*msg.u.create_trace_chunk.override_name ?
msg.u.create_trace_chunk.override_name :
NULL;
- LTTNG_OPTIONAL(struct lttng_directory_handle) chunk_directory_handle =
- LTTNG_OPTIONAL_INIT;
+ struct lttng_directory_handle *chunk_directory_handle = NULL;
/*
* The session daemon will only provide a chunk directory file
DBG("Received trace chunk directory fd (%d)",
chunk_dirfd);
- ret = lttng_directory_handle_init_from_dirfd(
- &chunk_directory_handle.value,
+ chunk_directory_handle = lttng_directory_handle_create_from_dirfd(
chunk_dirfd);
- if (ret) {
+ if (!chunk_directory_handle) {
ERR("Failed to initialize chunk directory handle from directory file descriptor");
if (close(chunk_dirfd)) {
PERROR("Failed to close chunk directory file descriptor");
}
goto error_fatal;
}
- chunk_directory_handle.is_set = true;
}
ret_code = lttng_consumer_create_trace_chunk(
msg.u.create_trace_chunk.credentials.is_set ?
&credentials :
NULL,
- chunk_directory_handle.is_set ?
- &chunk_directory_handle.value :
- NULL);
-
- if (chunk_directory_handle.is_set) {
- lttng_directory_handle_fini(
- &chunk_directory_handle.value);
- }
+ chunk_directory_handle);
+ lttng_directory_handle_put(chunk_directory_handle);
goto end_msg_sessiond;
}
case LTTNG_CONSUMER_CLOSE_TRACE_CHUNK:
if (ret == -ENOTTY) {
/* Command not implemented by lttng-modules. */
seq = -1ULL;
+ stream->sequence_number_unavailable = true;
} else {
PERROR("kernctl_get_sequence_number");
goto end;
int err, write_index = 1, rotation_ret;
ssize_t ret = 0;
int infd = stream->wait_fd;
- struct ctf_packet_index index;
+ struct ctf_packet_index index = {};
DBG("In read_subbuffer (infd : %d)", infd);