int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream)
{
int ret = 0;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot(infd);
/*
int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
{
int ret;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot_get_produced(infd, pos);
if (ret != 0) {
int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
{
int ret;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot_get_consumed(infd, pos);
if (ret != 0) {
/* Prevent channel modifications while we perform the snapshot.*/
pthread_mutex_lock(&channel->lock);
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
/* Splice is not supported yet for channel snapshot. */
if (channel->output != CONSUMER_CHANNEL_MMAP) {
DBG("Kernel consumer snapshot metadata with key %" PRIu64 " at path %s", key, path);
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
metadata_stream = metadata_channel->metadata_stream;
LTTNG_ASSERT(metadata_stream);
health_code_update();
/* relayd needs RCU read-side protection */
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
switch (msg.cmd_type) {
case LTTNG_CONSUMER_ADD_RELAYD_SOCKET:
{
- uint32_t major = msg.u.relayd_sock.major;
- uint32_t minor = msg.u.relayd_sock.minor;
- enum lttcomm_sock_proto protocol =
+ const uint32_t major = msg.u.relayd_sock.major;
+ const uint32_t minor = msg.u.relayd_sock.minor;
+ const lttcomm_sock_proto protocol =
(enum lttcomm_sock_proto) msg.u.relayd_sock.relayd_socket_protocol;
/* Session daemon status message are handled in the following call. */
health_code_update();
if (ctx->on_recv_channel != nullptr) {
- int ret_recv_channel = ctx->on_recv_channel(new_channel);
+ const int ret_recv_channel = ctx->on_recv_channel(new_channel);
if (ret_recv_channel == 0) {
ret_add_channel = consumer_add_channel(new_channel, ctx);
} else if (ret_recv_channel < 0) {
pthread_mutex_lock(&new_stream->lock);
if (ctx->on_recv_stream) {
- int ret_recv_stream = ctx->on_recv_stream(new_stream);
+ const int ret_recv_stream = ctx->on_recv_stream(new_stream);
if (ret_recv_stream < 0) {
pthread_mutex_unlock(&new_stream->lock);
pthread_mutex_unlock(&channel->lock);
}
case LTTNG_CONSUMER_DESTROY_RELAYD:
{
- uint64_t index = msg.u.destroy_relayd.net_seq_idx;
+ const uint64_t index = msg.u.destroy_relayd.net_seq_idx;
struct consumer_relayd_sock_pair *relayd;
int ret_send_status;
case LTTNG_CONSUMER_DATA_PENDING:
{
int32_t ret_data_pending;
- uint64_t id = msg.u.data_pending.session_id;
+ const uint64_t id = msg.u.data_pending.session_id;
ssize_t ret_send;
DBG("Kernel consumer data pending command for id %" PRIu64, id);
case LTTNG_CONSUMER_SNAPSHOT_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.snapshot_channel.key;
+ const uint64_t key = msg.u.snapshot_channel.key;
int ret_send_status;
channel = consumer_find_channel(key);
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
- uint64_t key = msg.u.destroy_channel.key;
+ const uint64_t key = msg.u.destroy_channel.key;
struct lttng_consumer_channel *channel;
int ret_send_status;
ssize_t ret;
uint64_t count;
struct lttng_consumer_channel *channel;
- uint64_t id = msg.u.discarded_events.session_id;
- uint64_t key = msg.u.discarded_events.channel_key;
+ const uint64_t id = msg.u.discarded_events.session_id;
+ const uint64_t key = msg.u.discarded_events.channel_key;
DBG("Kernel consumer discarded events command for session id %" PRIu64
", channel key %" PRIu64,
ssize_t ret;
uint64_t count;
struct lttng_consumer_channel *channel;
- uint64_t id = msg.u.lost_packets.session_id;
- uint64_t key = msg.u.lost_packets.channel_key;
+ const uint64_t id = msg.u.lost_packets.session_id;
+ const uint64_t key = msg.u.lost_packets.channel_key;
DBG("Kernel consumer lost packets command for session id %" PRIu64
", channel key %" PRIu64,
case LTTNG_CONSUMER_ROTATE_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.rotate_channel.key;
+ const uint64_t key = msg.u.rotate_channel.key;
int ret_send_status;
DBG("Consumer rotate channel %" PRIu64, key);
case LTTNG_CONSUMER_CLEAR_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.clear_channel.key;
+ const uint64_t key = msg.u.clear_channel.key;
int ret_send_status;
channel = consumer_find_channel(key);