clang-tidy: apply suggested fixes
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 20 Jun 2024 17:31:20 +0000 (17:31 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 5 Jul 2024 16:49:27 +0000 (12:49 -0400)
Apply FixIts proposed by clang-tidy (mostly missing 'const' qualifiers).

Change-Id: Ic616ddf6e826ee787c048de3f18aec18f9481532
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
132 files changed:
.clang-format
doc/examples/trigger-condition-event-matches/notification-client.cpp
include/lttng/channel.h
include/lttng/domain.h
include/lttng/event.h
include/lttng/health-internal.hpp
src/bin/lttng-crash/lttng-crash.cpp
src/bin/lttng-relayd/connection.cpp
src/bin/lttng-relayd/ctf-trace.cpp
src/bin/lttng-relayd/health-relayd.cpp
src/bin/lttng-relayd/index.cpp
src/bin/lttng-relayd/live.cpp
src/bin/lttng-relayd/main.cpp
src/bin/lttng-relayd/session.cpp
src/bin/lttng-relayd/sessiond-trace-chunks.cpp
src/bin/lttng-relayd/stream.cpp
src/bin/lttng-relayd/viewer-session.cpp
src/bin/lttng-relayd/viewer-stream.cpp
src/bin/lttng-sessiond/action-executor.cpp
src/bin/lttng-sessiond/agent-thread.cpp
src/bin/lttng-sessiond/agent.cpp
src/bin/lttng-sessiond/buffer-registry.cpp
src/bin/lttng-sessiond/channel.cpp
src/bin/lttng-sessiond/clear.cpp
src/bin/lttng-sessiond/client.cpp
src/bin/lttng-sessiond/cmd.cpp
src/bin/lttng-sessiond/condition-internal.cpp
src/bin/lttng-sessiond/consumer.cpp
src/bin/lttng-sessiond/context.cpp
src/bin/lttng-sessiond/ctf2-trace-class-visitor.cpp
src/bin/lttng-sessiond/ctl-utils.hpp
src/bin/lttng-sessiond/dispatch.cpp
src/bin/lttng-sessiond/event-notifier-error-accounting.cpp
src/bin/lttng-sessiond/event.cpp
src/bin/lttng-sessiond/kernel-consumer.cpp
src/bin/lttng-sessiond/kernel.cpp
src/bin/lttng-sessiond/lttng-syscall.cpp
src/bin/lttng-sessiond/manage-kernel.cpp
src/bin/lttng-sessiond/modprobe.cpp
src/bin/lttng-sessiond/notification-thread-events.cpp
src/bin/lttng-sessiond/notification-thread.cpp
src/bin/lttng-sessiond/rotation-thread.cpp
src/bin/lttng-sessiond/save.cpp
src/bin/lttng-sessiond/session.cpp
src/bin/lttng-sessiond/sessiond-config.cpp
src/bin/lttng-sessiond/snapshot.cpp
src/bin/lttng-sessiond/trace-ust.cpp
src/bin/lttng-sessiond/tracker.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/bin/lttng-sessiond/ust-app.cpp
src/bin/lttng-sessiond/ust-consumer.cpp
src/bin/lttng-sessiond/ust-registry-channel.cpp
src/bin/lttng-sessiond/ust-registry-session-pid.cpp
src/bin/lttng-sessiond/ust-registry-session-uid.cpp
src/bin/lttng-sessiond/ust-registry-session.cpp
src/bin/lttng/commands/add_trigger.cpp
src/bin/lttng/commands/create.cpp
src/bin/lttng/commands/destroy.cpp
src/bin/lttng/commands/list_triggers.cpp
src/bin/lttng/loglevel.cpp
src/bin/lttng/utils.cpp
src/common/argpar-utils/argpar-utils.cpp
src/common/bytecode/bytecode.cpp
src/common/compat/directory-handle.cpp
src/common/conditions/buffer-usage.cpp
src/common/conditions/event-rule-matches.cpp
src/common/conditions/session-consumed-size.cpp
src/common/conditions/session-rotation.cpp
src/common/consumer/consumer-stream.cpp
src/common/consumer/consumer-timer.cpp
src/common/consumer/consumer.cpp
src/common/dynamic-buffer.cpp
src/common/error-query.cpp
src/common/evaluation.cpp
src/common/event-rule/event-rule.cpp
src/common/event-rule/kernel-kprobe.cpp
src/common/event.cpp
src/common/fd-tracker/fd-tracker.cpp
src/common/fd-tracker/inode.cpp
src/common/filter/filter-ast.hpp
src/common/hashtable/hashtable.cpp
src/common/index/index.cpp
src/common/ini-config/ini-config.cpp
src/common/ini-config/ini.cpp
src/common/kernel-consumer/kernel-consumer.cpp
src/common/log-level-rule.cpp
src/common/lttng-elf.cpp
src/common/pthread-lock.hpp
src/common/reference.hpp
src/common/runas.cpp
src/common/sessiond-comm/inet.cpp
src/common/sessiond-comm/inet6.cpp
src/common/sessiond-comm/sessiond-comm.cpp
src/common/string-utils/string-utils.cpp
src/common/time.cpp
src/common/trace-chunk.cpp
src/common/unix.cpp
src/common/urcu.hpp
src/common/userspace-probe.cpp
src/common/ust-consumer/ust-consumer.cpp
src/common/utils.cpp
src/common/utils.hpp
src/lib/lttng-ctl/clear.cpp
src/lib/lttng-ctl/destruction-handle.cpp
src/lib/lttng-ctl/lttng-ctl.cpp
src/vendor/fmt/core.h
tests/regression/kernel/select_poll_epoll.cpp
tests/regression/tools/trigger/name/trigger_name.cpp
tests/regression/tools/trigger/utils/notification-client.cpp
tests/unit/test_action.cpp
tests/unit/test_buffer_view.cpp
tests/unit/test_fd_tracker.cpp
tests/unit/test_log_level_rule.cpp
tests/unit/test_payload.cpp
tests/unit/test_rate_policy.cpp
tests/unit/test_relayd_backward_compat_group_by_session.cpp
tests/unit/test_unix_socket.cpp
tests/unit/test_utils_expand_path.cpp
tests/utils/bt2_plugins/event_name/event_name.cpp
tests/utils/bt2_plugins/field_stats/field_stats.cpp
tests/utils/testapp/gen-ust-events-constructor/01-tp-before-define.cpp
tests/utils/testapp/gen-ust-events-constructor/02-define-tp.cpp
tests/utils/testapp/gen-ust-events-constructor/03-tp-after-define.cpp
tests/utils/testapp/gen-ust-events-constructor/04-tp-provider.cpp
tests/utils/testapp/gen-ust-events-constructor/05-tp-after-provider.cpp
tests/utils/testapp/gen-ust-events-constructor/main-a.cpp
tests/utils/testapp/gen-ust-events-constructor/main.cpp
tests/utils/testapp/gen-ust-events-constructor/obj-a.h
tests/utils/testapp/gen-ust-events-constructor/obj.h
tests/utils/testapp/gen-ust-events/gen-ust-events.cpp
tests/utils/testapp/gen-ust-nevents/gen-ust-nevents.cpp
tests/utils/xml-utils/extract_xml.cpp

index 8fcee64f873254026f520850185a7b610cb5a1c8..604c57d0cf7e622524a632fa5baba7f444f89ce8 100644 (file)
@@ -103,4 +103,5 @@ SpacesInSquareBrackets: false
 Standard: Cpp11
 TabWidth: 8
 UseTab: Always
+QualifierAlignment: Left
 ...
index 05c7387c2417e850f9be61a1517bea50a01a4cb2..f92e1e21f796ff6c2e5c5f8d8ea7b10ade2c4919 100644 (file)
@@ -101,7 +101,7 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
 static bool action_group_contains_notify(const struct lttng_action *action_group)
 {
        unsigned int i, count;
-       enum lttng_action_status status = lttng_action_list_get_count(action_group, &count);
+       const lttng_action_status status = lttng_action_list_get_count(action_group, &count);
 
        if (status != LTTNG_ACTION_STATUS_OK) {
                printf("Failed to get action count from action group\n");
@@ -434,9 +434,9 @@ int main(int argc, char **argv)
                        continue;
                }
 
-               if (!((action_type == LTTNG_ACTION_TYPE_LIST &&
-                      action_group_contains_notify(action)) ||
-                     action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
+               if ((action_type != LTTNG_ACTION_TYPE_LIST ||
+                    !action_group_contains_notify(action)) &&
+                   action_type != LTTNG_ACTION_TYPE_NOTIFY) {
                        printf("The action of trigger \"%s\" is not \"notify\", skipping.\n",
                               trigger_name);
                        continue;
index a6a6f04fcb185cec5b412ea31401897aef84634b..58917ae045ccec627fe467f28708a6120b31bd97 100644 (file)
@@ -23,7 +23,7 @@ extern "C" {
  *
  * The structures should be initialized to zero before use.
  */
-#define LTTNG_CHANNEL_ATTR_PADDING1 LTTNG_SYMBOL_NAME_LEN + 12
+#define LTTNG_CHANNEL_ATTR_PADDING1 (LTTNG_SYMBOL_NAME_LEN + 12)
 
 /*!
 @brief
index 26e9da93206ec2128a64f81688210c21425c14c4..da19ebf1c4d37f4fac8a2c0d8fab5adc90bed5d4 100644 (file)
@@ -65,7 +65,7 @@ enum lttng_buffer_type {
  * The structures should be initialized to zero before use.
  */
 #define LTTNG_DOMAIN_PADDING1 12
-#define LTTNG_DOMAIN_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_DOMAIN_PADDING2 (LTTNG_SYMBOL_NAME_LEN + 32)
 
 /*!
 @brief
index e4ee28988712300d513f9f9a23ddc925b09cb216..64bd2ad23f32ca4c6f8cfa8c605ca0f2d7931e90 100644 (file)
@@ -994,7 +994,7 @@ struct lttng_event_perf_counter_ctx {
 };
 
 #define LTTNG_EVENT_CONTEXT_PADDING1 16
-#define LTTNG_EVENT_CONTEXT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_CONTEXT_PADDING2 (LTTNG_SYMBOL_NAME_LEN + 32)
 
 /*!
 @brief
@@ -1155,7 +1155,7 @@ struct lttng_event_function_attr {
  * The structures should be initialized to zero before use.
  */
 #define LTTNG_EVENT_PADDING1 12
-#define LTTNG_EVENT_PADDING2 LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_PADDING2 (LTTNG_SYMBOL_NAME_LEN + 32)
 
 /*!
 @brief
@@ -1393,7 +1393,7 @@ struct lttng_event {
        attr;
 };
 
-#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_FIELD_PADDING (LTTNG_SYMBOL_NAME_LEN + 32)
 
 /*!
 @brief
index eee164cb141d4b86ed009d52d31c8ccfa9f5508e..ac260dcf81be70b882f56b0e12342d298b8081d2 100644 (file)
@@ -26,7 +26,7 @@
 #define HEALTH_POLL_VALUE (1UL << 0)
 #define HEALTH_CODE_VALUE (1UL << 1)
 
-#define HEALTH_IS_IN_POLL(x) ((x) &HEALTH_POLL_VALUE)
+#define HEALTH_IS_IN_POLL(x) ((x) & HEALTH_POLL_VALUE)
 
 struct health_app;
 
index d4e41e0336fe95ace3fb532885f954e2397b99fb..51b970e439cf0719bcb69ff0060e3f0a3359784c 100644 (file)
@@ -72,7 +72,7 @@ enum lttng_crash_type {
 
 /* LTTng ring buffer defines (copied) */
 
-#define HALF_ULONG_BITS(wl) (((wl) *CHAR_BIT) >> 1)
+#define HALF_ULONG_BITS(wl) (((wl) * CHAR_BIT) >> 1)
 
 #define SB_ID_OFFSET_SHIFT(wl) (HALF_ULONG_BITS(wl) + 1)
 #define SB_ID_OFFSET_COUNT(wl) (1UL << SB_ID_OFFSET_SHIFT(wl))
@@ -197,7 +197,7 @@ static struct option long_options[] = {
 
 static void usage()
 {
-       int ret = utils_show_help(1, "lttng-crash", help_msg);
+       const int ret = utils_show_help(1, "lttng-crash", help_msg);
 
        if (ret) {
                ERR("Cannot show --help for `lttng-crash`");
index 2de3abe2d8cacd92684f51e05b0bcde645adacba..9a3dc1dc8787160816246788a4a27ebc343c3ddd 100644 (file)
@@ -30,7 +30,7 @@ struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connectio
 
        LTTNG_ASSERT(sock >= 0);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(relay_connections_ht, (void *) ((unsigned long) sock), &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_ulong>(&iter);
        if (!node) {
@@ -150,7 +150,7 @@ static void connection_release(struct urcu_ref *ref)
 
 void connection_put(struct relay_connection *conn)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        urcu_ref_put(&conn->ref, connection_release);
 }
 
index 81c5a770719a4c1f0fbe85f19fcc03c950d73534..f6a4b2dcd76930d59ae00b2fac0cec49e9aa4ee6 100644 (file)
@@ -150,7 +150,7 @@ struct ctf_trace *ctf_trace_get_by_path_or_create(struct relay_session *session,
        struct lttng_ht_iter iter;
        struct ctf_trace *trace = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(session->ctf_traces_ht, subpath, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_str>(&iter);
        if (!node) {
@@ -171,7 +171,7 @@ end:
 
 void ctf_trace_put(struct ctf_trace *trace)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        urcu_ref_put(&trace->ref, ctf_trace_release);
 }
 
@@ -179,7 +179,7 @@ int ctf_trace_close(struct ctf_trace *trace)
 {
        struct relay_stream *stream;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_list_for_each_entry_rcu(stream, &trace->stream_list, stream_node)
        {
                /*
@@ -199,7 +199,7 @@ struct relay_viewer_stream *ctf_trace_get_viewer_metadata_stream(struct ctf_trac
 {
        struct relay_viewer_stream *vstream;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        vstream = rcu_dereference(trace->viewer_metadata_stream);
        if (!vstream) {
                goto end;
index d1b619d3972d9f0a21d30adb2cd164a990fe4c6c..614c7f7d9c2bb9283f072553ca54abe02dbdcbab 100644 (file)
@@ -76,7 +76,7 @@ static int create_lttng_rundir_with_perm(const char *rundir)
                        ret = 0;
                }
        } else if (ret == 0) {
-               int is_root = !getuid();
+               const int is_root = !getuid();
 
                if (is_root) {
                        gid_t gid;
@@ -210,7 +210,7 @@ end:
 static int accept_unix_socket(void *data, int *out_fd)
 {
        int ret;
-       int accepting_sock = *((int *) data);
+       const int accepting_sock = *((int *) data);
 
        ret = lttcomm_accept_unix_sock(accepting_sock);
        if (ret < 0) {
index 7fd94ac43c8d79831ca8f064f62303fca8e597dc..e47f647f16b0249210f937c257f649512fbf616e 100644 (file)
@@ -120,7 +120,7 @@ struct relay_index *relay_index_get_by_id_or_create(struct relay_stream *stream,
             stream->stream_handle,
             net_seq_num);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(stream->indexes_ht, &net_seq_num, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
        if (node) {
@@ -249,7 +249,7 @@ void relay_index_put(struct relay_index *index)
        /*
         * Ensure existence of index->lock for index unlock.
         */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        /*
         * Index lock ensures that concurrent test and update of stream
         * ref is atomic.
@@ -305,7 +305,7 @@ void relay_index_close_all(struct relay_stream *stream)
        struct lttng_ht_iter iter;
        struct relay_index *index;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                /* Put self-ref from index. */
@@ -318,7 +318,7 @@ void relay_index_close_partial_fd(struct relay_stream *stream)
        struct lttng_ht_iter iter;
        struct relay_index *index;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                if (!index->index_file) {
@@ -339,7 +339,7 @@ uint64_t relay_index_find_last(struct relay_stream *stream)
        struct relay_index *index;
        uint64_t net_seq_num = -1ULL;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                if (net_seq_num == -1ULL || index->index_n.key > net_seq_num) {
@@ -390,7 +390,7 @@ int relay_index_switch_all_files(struct relay_stream *stream)
        struct relay_index *index;
        int ret = 0;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                ret = relay_index_switch_file(
@@ -424,7 +424,7 @@ int relay_index_set_control_data(struct relay_index *index,
                index->index_data.stream_instance_id = htobe64(data->stream_instance_id);
                index->index_data.packet_seq_num = htobe64(data->packet_seq_num);
        } else {
-               uint64_t unset_value = -1ULL;
+               const uint64_t unset_value = -1ULL;
 
                index->index_data.stream_instance_id = htobe64(unset_value);
                index->index_data.packet_seq_num = htobe64(unset_value);
index 699778d0e4ef2c144e4bcaba390387750b2f7606..a100433b47c9ddae6ff50f9d03a653b2adfd5fa4 100644 (file)
@@ -245,7 +245,7 @@ static int check_new_streams(struct relay_connection *conn)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_list_for_each_entry_rcu(
                        session, &conn->viewer_session->session_list, viewer_session_node)
                {
@@ -282,7 +282,7 @@ send_viewer_streams(struct lttcomm_sock *sock, uint64_t session_id, unsigned int
        struct relay_viewer_stream *vstream;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
@@ -379,7 +379,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
         * used for a the given session id only.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        relay_session->ctf_traces_ht->ht, &iter.iter, ctf_trace, node.node) {
@@ -1061,7 +1061,7 @@ static int viewer_list_sessions(struct relay_connection *conn)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (sessions_ht->ht, &iter.iter, session, session_n.node) {
                        struct lttng_viewer_session *send_session;
@@ -1076,7 +1076,7 @@ static int viewer_list_sessions(struct relay_connection *conn)
 
                        if (count >= buf_count) {
                                struct lttng_viewer_session *newbuf;
-                               uint32_t new_buf_count = buf_count << 1;
+                               const uint32_t new_buf_count = buf_count << 1;
 
                                newbuf = (lttng_viewer_session *) realloc(
                                        send_session_buf,
@@ -2531,7 +2531,7 @@ static void live_relay_unknown_command(struct relay_connection *conn)
 static int process_control(struct lttng_viewer_cmd *recv_hdr, struct relay_connection *conn)
 {
        int ret = 0;
-       lttng_viewer_command cmd = (lttng_viewer_command) be32toh(recv_hdr->cmd);
+       const lttng_viewer_command cmd = (lttng_viewer_command) be32toh(recv_hdr->cmd);
 
        /*
         * Make sure we've done the version check before any command other then
@@ -2763,7 +2763,7 @@ error:
 
        /* Cleanup remaining connection object. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        viewer_connections_ht->ht, &iter.iter, destroy_conn, sock_n.node) {
index ea0ed2119b5237684b35695038658fa2ed4ea5b6..87b6238955a0afc1ed695bffd831753abcf3dc36 100644 (file)
@@ -1519,7 +1519,7 @@ static void publish_connection_local_streams(struct relay_connection *conn)
         * session lock.
         */
        pthread_mutex_lock(&session->lock);
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_list_for_each_entry_rcu(stream, &session->recv_list, recv_node)
        {
                stream_publish(stream);
@@ -2227,7 +2227,7 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
         * the right session_id.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                        if (!stream_get(stream)) {
@@ -2306,7 +2306,7 @@ static int relay_end_data_pending(const struct lttcomm_relayd_hdr *recv_hdr __at
         * flag is set.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                        if (!stream_get(stream)) {
@@ -4079,7 +4079,7 @@ restart:
 
                if (last_seen_data_fd >= 0) {
                        for (i = 0; i < nb_fd; i++) {
-                               int pollfd = LTTNG_POLL_GETFD(&events, i);
+                               const int pollfd = LTTNG_POLL_GETFD(&events, i);
 
                                health_code_update();
 
@@ -4093,8 +4093,8 @@ restart:
                /* Process data connection. */
                for (i = idx + 1; i < nb_fd; i++) {
                        /* Fetch the poll data. */
-                       uint32_t revents = LTTNG_POLL_GETEV(&events, i);
-                       int pollfd = LTTNG_POLL_GETFD(&events, i);
+                       const uint32_t revents = LTTNG_POLL_GETEV(&events, i);
+                       const int pollfd = LTTNG_POLL_GETFD(&events, i);
                        struct relay_connection *data_conn;
 
                        health_code_update();
@@ -4174,7 +4174,7 @@ exit:
 error:
        /* Cleanup remaining connection object. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        relay_connections_ht->ht, &iter.iter, destroy_conn, sock_n.node) {
index 19f1936f229684f3a6f7a6c1e81a787bab346e4f..c199efcd1055214405c1dbb3b242879e91b31223 100644 (file)
@@ -455,7 +455,7 @@ struct relay_session *session_get_by_id(uint64_t id)
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(sessions_ht, &id, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
        if (!node) {
@@ -503,7 +503,7 @@ bool session_has_ongoing_rotation(const struct relay_session *session)
         * originate from the same session daemon session.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        sessions_ht->ht, &iter.iter, iterated_session, session_n.node) {
@@ -614,7 +614,7 @@ void session_put(struct relay_session *session)
        if (!session) {
                return;
        }
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        urcu_ref_put(&session->ref, session_release);
 }
 
@@ -633,7 +633,7 @@ int session_close(struct relay_session *session)
        pthread_mutex_unlock(&session->lock);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (session->ctf_traces_ht->ht, &iter.iter, trace, node.node) {
                        ret = ctf_trace_close(trace);
@@ -661,7 +661,7 @@ end:
 
 int session_abort(struct relay_session *session)
 {
-       int ret = 0;
+       const int ret = 0;
 
        if (!session) {
                return 0;
@@ -684,7 +684,7 @@ void print_sessions()
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (sessions_ht->ht, &iter.iter, session, session_n.node) {
                        if (!session_get(session)) {
index 2326878fb9fd6a9dd2f9d6dfd8dc8dd4504243f1..cf2cfe60139a4681c25f341d671433c2e9b82560 100644 (file)
@@ -113,7 +113,7 @@ static void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
        DBG("Destroying trace chunk registry associated to sessiond {%s}", uuid_str);
        if (element->sessiond_trace_chunk_registry) {
                /* Unpublish. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_del(element->sessiond_trace_chunk_registry->ht, &element->ht_node);
                element->sessiond_trace_chunk_registry = nullptr;
        }
@@ -146,7 +146,7 @@ trace_chunk_registry_ht_element_find(struct sessiond_trace_chunk_registry *sessi
        struct cds_lfht_node *node;
        struct cds_lfht_iter iter;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(sessiond_registry->ht,
                        trace_chunk_registry_ht_key_hash(key),
                        trace_chunk_registry_ht_key_match,
@@ -202,7 +202,7 @@ trace_chunk_registry_ht_element_create(struct sessiond_trace_chunk_registry *ses
                 * Keep the rcu read lock is held accross all attempts
                 * purely for efficiency reasons.
                 */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                while (true) {
                        struct cds_lfht_node *published_node;
                        struct trace_chunk_registry_ht_element *published_element;
@@ -274,7 +274,7 @@ error:
 
 void sessiond_trace_chunk_registry_destroy(struct sessiond_trace_chunk_registry *sessiond_registry)
 {
-       int ret = cds_lfht_destroy(sessiond_registry->ht, nullptr);
+       const int ret = cds_lfht_destroy(sessiond_registry->ht, nullptr);
 
        LTTNG_ASSERT(!ret);
        free(sessiond_registry);
index 5390c49bb6d59523fb999b9c1c6b543107733b55..9b592b8e0ec2869753717a8cb5358cb328464a01 100644 (file)
@@ -48,7 +48,7 @@ struct relay_stream *stream_get_by_id(uint64_t stream_id)
        struct lttng_ht_iter iter;
        struct relay_stream *stream = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(relay_streams_ht, &stream_id, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
        if (!node) {
@@ -473,7 +473,7 @@ end:
  */
 static int try_rotate_stream_index(struct relay_stream *stream)
 {
-       int ret = 0;
+       const int ret = 0;
 
        if (!stream->ongoing_rotation.is_set) {
                /* No rotation expected. */
@@ -807,7 +807,7 @@ static void stream_release(struct urcu_ref *ref)
 
 void stream_put(struct relay_stream *stream)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        LTTNG_ASSERT(stream->ref.refcount != 0);
        /*
         * Wait until we have processed all the stream packets before
@@ -1312,7 +1312,7 @@ static void print_stream_indexes(struct relay_stream *stream)
        struct relay_index *index;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (stream->indexes_ht->ht, &iter.iter, index, index_n.node) {
                        DBG("index %p net_seq_num %" PRIu64 " refcount %ld"
@@ -1368,7 +1368,7 @@ void print_relay_streams()
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (relay_streams_ht->ht, &iter.iter, stream, node.node) {
                        if (!stream_get(stream)) {
index 45fa2dcacafff947a43de2945c948bf994694cd1..176cdc525ad38c235c7d5f1ea5090de5f40ebdcb 100644 (file)
@@ -151,7 +151,7 @@ void viewer_session_close_one_session(struct relay_viewer_session *vsession,
         * vstream per session.
         */
        {
-               lttng::urcu::read_lock_guard read_guard;
+               const lttng::urcu::read_lock_guard read_guard;
 
                cds_lfht_for_each_entry (
                        viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
@@ -183,7 +183,7 @@ void viewer_session_close(struct relay_viewer_session *vsession)
        struct relay_session *session;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_list_for_each_entry_rcu(session, &vsession->session_list, viewer_session_node)
                {
@@ -210,7 +210,7 @@ int viewer_session_is_attached(struct relay_viewer_session *vsession, struct rel
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_list_for_each_entry_rcu(iter, &vsession->session_list, viewer_session_node)
                {
                        if (session == iter) {
index 8830dae7aabe547637b757b30914abb063012e15..6ea7d88982571f053e804be3cd03d07701102edc 100644 (file)
@@ -263,7 +263,7 @@ struct relay_viewer_stream *viewer_stream_get_by_id(uint64_t id)
        struct lttng_ht_iter iter;
        struct relay_viewer_stream *vstream = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_lookup(viewer_streams_ht, &id, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
        if (!node) {
@@ -280,7 +280,7 @@ end:
 
 void viewer_stream_put(struct relay_viewer_stream *vstream)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        urcu_ref_put(&vstream->ref, viewer_stream_release);
 }
 
@@ -348,7 +348,7 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream)
        if (tracefile_array_seq_in_file(stream->tfa, new_id, vstream->index_sent_seqcount)) {
                vstream->current_tracefile_id = new_id;
        } else {
-               uint64_t seq_tail = tracefile_array_get_seq_tail(stream->tfa);
+               const uint64_t seq_tail = tracefile_array_get_seq_tail(stream->tfa);
 
                /*
                 * This can only be reached on overwrite, which implies there
@@ -378,7 +378,7 @@ void print_viewer_streams()
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        viewer_streams_ht->ht, &iter.iter, vstream, stream_n.node) {
index aa8be1fcf037b34d162c6282c7c687a829b3ab17..6f75b07b46ec00ffca1602f83c2e62dd8236b795 100644 (file)
@@ -289,7 +289,7 @@ static int action_executor_start_session_handler(struct action_executor *executo
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        action_status = lttng_action_start_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
@@ -379,7 +379,7 @@ static int action_executor_stop_session_handler(struct action_executor *executor
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        action_status = lttng_action_stop_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
@@ -470,7 +470,7 @@ static int action_executor_rotate_session_handler(struct action_executor *execut
        enum lttng_error_code cmd_ret;
        struct lttng_action *action = item->action;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        action_status = lttng_action_rotate_session_get_session_name(action, &session_name);
        if (action_status != LTTNG_ACTION_STATUS_OK) {
@@ -572,7 +572,7 @@ static int action_executor_snapshot_session_handler(struct action_executor *exec
 
        default_snapshot_output.max_size = UINT64_MAX;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * Validate if, at the moment the action was queued, the target session
@@ -979,7 +979,7 @@ static int add_action_to_subitem_array(struct lttng_action *action,
                                       struct lttng_dynamic_array *subitems)
 {
        int ret = 0;
-       enum lttng_action_type type = lttng_action_get_type(action);
+       const lttng_action_type type = lttng_action_get_type(action);
        const char *session_name = nullptr;
        enum lttng_action_status status;
        struct action_work_subitem subitem = {
index 036b3dc60e3a89fe50f277d32fa360f80c15cdd7..8925db4f9875f388b90da8466adf43b915da96d1 100644 (file)
@@ -76,7 +76,7 @@ static void update_agent_app(const struct agent_app *app)
                if (session->ust_session) {
                        const struct agent *agt;
 
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        agt = trace_ust_find_agent(session->ust_session, app->domain);
                        if (agt) {
                                agent_update(agt, app);
@@ -91,7 +91,7 @@ static void update_agent_app(const struct agent_app *app)
                 * We are protected against the addition of new events by the session
                 * list lock being held.
                 */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_trigger_agents_ht_by_domain->ht, &iter.iter, trigger_agent, node.node) {
index 5c080ca51d8c3eb9c713e4f3133d46201da71a3a..48968c44bc47ac1b7cbae23ac41a6239dbcf1baa 100644 (file)
@@ -684,7 +684,7 @@ int agent_enable_event(struct agent_event *event, enum lttng_domain_type domain)
        LTTNG_ASSERT(event);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
@@ -757,7 +757,7 @@ int agent_enable_context(const struct lttng_event_context *ctx, enum lttng_domai
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
@@ -817,7 +817,7 @@ int agent_disable_event(struct agent_event *event, enum lttng_domain_type domain
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
@@ -857,7 +857,7 @@ static int disable_context(struct agent_app_ctx *ctx, enum lttng_domain_type dom
        DBG2("Disabling agent application context %s:%s", ctx->provider_name, ctx->ctx_name);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
@@ -902,7 +902,7 @@ int agent_list_events(struct lttng_event **events, enum lttng_domain_type domain
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_agent_apps_ht_by_sock->ht, &iter.iter, app, node.node) {
@@ -1424,7 +1424,7 @@ void agent_destroy(struct agent *agt)
        DBG3("Agent destroy");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agt->events->ht, &iter.iter, node, node) {
                        int ret;
@@ -1479,7 +1479,7 @@ void agent_destroy_app_by_sock(int sock)
         * happen. The hash table deletion is ONLY done through this call when the
         * main sessiond thread is torn down.
         */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        app = agent_find_app_by_sock(sock);
        LTTNG_ASSERT(app);
 
@@ -1503,7 +1503,7 @@ void agent_app_ht_clean()
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (the_agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
                        struct agent_app *app;
@@ -1539,7 +1539,7 @@ void agent_update(const struct agent *agt, const struct agent_app *app)
         * there is a serious code flow error.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agt->events->ht, &iter.iter, event, node.node) {
                        /* Skip event if disabled. */
@@ -1596,7 +1596,7 @@ void agent_by_event_notifier_domain_ht_destroy()
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_trigger_agents_ht_by_domain->ht, &iter.iter, node, node) {
index 8e241feb626b89b8667221011ca17fcbbe6df706..9885ed6c8990b61e46839798b38379fdbdb784fe 100644 (file)
@@ -172,7 +172,7 @@ void buffer_reg_uid_add(struct buffer_reg_uid *reg)
        DBG3("Buffer registry per UID adding to global registry with id: %" PRIu64,
             reg->session_id);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        nodep = cds_lfht_add_unique(
                ht->ht, ht->hash_fct(reg, lttng_ht_seed), ht->match_fct, reg, &reg->node.node);
        LTTNG_ASSERT(nodep == &reg->node.node);
@@ -298,7 +298,7 @@ void buffer_reg_pid_add(struct buffer_reg_pid *reg)
        DBG3("Buffer registry per PID adding to global registry with id: %" PRIu64,
             reg->session_id);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_add_unique_u64(buffer_registry_pid, &reg->node);
 }
 
@@ -344,7 +344,7 @@ int buffer_reg_uid_consumer_channel_key(struct cds_list_head *buffer_reg_uid_lis
        int ret = -1;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /*
                 * For the per-uid registry, we have to iterate since we don't have the
@@ -443,7 +443,7 @@ void buffer_reg_channel_add(struct buffer_reg_session *session, struct buffer_re
        LTTNG_ASSERT(session);
        LTTNG_ASSERT(channel);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_add_unique_u64(session->channels, &channel->node);
 }
 
@@ -591,7 +591,7 @@ static void buffer_reg_session_destroy(struct buffer_reg_session *regp,
 
        /* Destroy all channels. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (regp->channels->ht, &iter.iter, reg_chan, node.node) {
                        ret = lttng_ht_del(regp->channels, &iter);
@@ -624,7 +624,7 @@ void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
 
        LTTNG_ASSERT(regp);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        iter.iter.node = &regp->node.node;
        ret = lttng_ht_del(buffer_registry_uid, &iter);
        LTTNG_ASSERT(!ret);
@@ -671,7 +671,7 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp, struct consumer_output
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                /* Get the right socket from the consumer object. */
                socket = consumer_find_socket_by_bitness(regp->bits_per_long, consumer);
                if (!socket) {
index 4e5401295ed43f9d36d87b2e29a78b4f2ca52b72..77c073e2c5a774d6c06c70a7f078751ea546cfaa 100644 (file)
@@ -325,7 +325,7 @@ enum lttng_error_code channel_ust_create(struct ltt_ust_session *usess,
        struct lttng_channel *defattr = nullptr;
        enum lttng_domain_type domain = LTTNG_DOMAIN_UST;
        bool chan_published = false;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        LTTNG_ASSERT(usess);
 
index b08cc8791ac2bf2a28297fae667389f0e833c82a..2e26c880ab6d4ad9290356666fe650b8eae70708 100644 (file)
@@ -182,7 +182,7 @@ int cmd_clear_session(const ltt_session::locked_ref& session, int *sock_fd)
 
                /* Flag session that trace should start automatically */
                if (usess) {
-                       int int_ret = ust_app_start_trace_all(usess);
+                       const int int_ret = ust_app_start_trace_all(usess);
 
                        if (int_ret < 0) {
                                ret = LTTNG_ERR_UST_START_FAIL;
index 89989f377a5d8c2dcc30ca377b2dcdebf38969b7..9052546c4042f9b668709d406234bb9d240c6808 100644 (file)
@@ -1284,7 +1284,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock, int *sock_
                if (need_tracing_session) {
                        /* Create UST session if none exist. */
                        if ((*target_session)->ust_session == nullptr) {
-                               lttng_domain domain = cmd_ctx->lsm.domain;
+                               const lttng_domain domain = cmd_ctx->lsm.domain;
                                ret = create_ust_session(*target_session, &domain);
                                if (ret != LTTNG_OK) {
                                        goto error;
@@ -1975,7 +1975,7 @@ skip_domain:
        {
                uint32_t snapshot_id;
                struct lttcomm_lttng_output_id reply;
-               lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output;
+               const lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output;
 
                ret = cmd_snapshot_add_output(*target_session, &output, &snapshot_id);
                if (ret != LTTNG_OK) {
@@ -1991,7 +1991,7 @@ skip_domain:
        }
        case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_DEL_OUTPUT:
        {
-               lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output;
+               const lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_output.output;
                ret = cmd_snapshot_del_output(*target_session, &output);
                break;
        }
@@ -2016,7 +2016,7 @@ skip_domain:
        }
        case LTTCOMM_SESSIOND_COMMAND_SNAPSHOT_RECORD:
        {
-               lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_record.output;
+               const lttng_snapshot_output output = cmd_ctx->lsm.u.snapshot_record.output;
                ret = cmd_snapshot_record(*target_session, &output, 0); // RFC: set to zero
                                                                        // since it's ignored
                                                                        // by
@@ -2029,7 +2029,7 @@ skip_domain:
 
                lttng_dynamic_buffer_init(&payload);
 
-               lttng::ctl::session_descriptor reply_session_descriptor = [cmd_ctx, sock]() {
+               const lttng::ctl::session_descriptor reply_session_descriptor = [cmd_ctx, sock]() {
                        lttng_session_descriptor *raw_descriptor;
                        const auto create_ret = cmd_create_session(cmd_ctx, *sock, &raw_descriptor);
                        if (create_ret != LTTNG_OK) {
index 6aa9c9402f29c5384f5b24ea23502be5aad4e550..a0e9c49e62e7a0ae1eb39c22bc16e12e093a5ba4 100644 (file)
@@ -340,7 +340,7 @@ static enum lttng_error_code list_lttng_agent_events(struct agent *agt,
        local_nb_events = (unsigned int) agent_event_count;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agt->events->ht, &iter.iter, event, node.node) {
                        struct lttng_event *tmp_event = lttng_event_create();
@@ -404,7 +404,7 @@ static enum lttng_error_code list_lttng_ust_global_events(char *channel_name,
 
        DBG("Listing UST global events for channel %s", channel_name);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        lttng_ht_lookup(ust_global->channels, (void *) channel_name, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_str>(&iter);
@@ -754,7 +754,7 @@ static int init_kernel_tracing(struct ltt_kernel_session *session)
        LTTNG_ASSERT(session);
 
        if (session->consumer_fds_sent == 0 && session->consumer != nullptr) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        session->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -1029,7 +1029,7 @@ int cmd_setup_relayd(const ltt_session::locked_ref& session)
        DBG("Setting relayd for session %s", session->name);
 
        if (session->current_trace_chunk) {
-               enum lttng_trace_chunk_status status = lttng_trace_chunk_get_id(
+               const lttng_trace_chunk_status status = lttng_trace_chunk_get_id(
                        session->current_trace_chunk, &current_chunk_id.value);
 
                if (status == LTTNG_TRACE_CHUNK_STATUS_OK) {
@@ -1044,7 +1044,7 @@ int cmd_setup_relayd(const ltt_session::locked_ref& session)
        if (usess && usess->consumer && usess->consumer->type == CONSUMER_DST_NET &&
            usess->consumer->enabled) {
                /* For each consumer socket, send relayd sockets */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        usess->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -1075,7 +1075,7 @@ int cmd_setup_relayd(const ltt_session::locked_ref& session)
 
        if (ksess && ksess->consumer && ksess->consumer->type == CONSUMER_DST_NET &&
            ksess->consumer->enabled) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -1232,7 +1232,7 @@ int cmd_disable_channel(const ltt_session::locked_ref& session,
 
        usess = session->ust_session;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
@@ -1339,7 +1339,7 @@ static enum lttng_error_code cmd_enable_channel_internal(ltt_session::locked_ref
        LTTNG_ASSERT(_attr);
        LTTNG_ASSERT(domain);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        attr = lttng_channel_copy(_attr);
        if (!attr) {
@@ -1741,7 +1741,7 @@ int cmd_disable_event(struct command_ctx *cmd_ctx,
 
        event_name = event->name;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Error out on unhandled search criteria */
        if (event->loglevel_type || event->loglevel != -1 || event->enabled || event->pid ||
@@ -2074,7 +2074,7 @@ static int _cmd_enable_event(ltt_session::locked_ref& locked_session,
 {
        int ret = 0, channel_created = 0;
        struct lttng_channel *attr = nullptr;
-       ltt_session& session = *locked_session;
+       const ltt_session& session = *locked_session;
 
        LTTNG_ASSERT(event);
        LTTNG_ASSERT(channel_name);
@@ -2096,7 +2096,7 @@ static int _cmd_enable_event(ltt_session::locked_ref& locked_session,
                }
        }
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        switch (domain->type) {
        case LTTNG_DOMAIN_KERNEL:
@@ -2821,7 +2821,7 @@ int cmd_start_trace(const ltt_session::locked_ref& session)
 
        /* Flag session that trace should start automatically */
        if (usess) {
-               int int_ret = ust_app_start_trace_all(usess);
+               const int int_ret = ust_app_start_trace_all(usess);
 
                if (int_ret < 0) {
                        ret = LTTNG_ERR_UST_START_FAIL;
@@ -2846,7 +2846,7 @@ int cmd_start_trace(const ltt_session::locked_ref& session)
        session->rotated_after_last_stop = false;
 
        if (session->rotate_timer_period && !session->rotation_schedule_timer_enabled) {
-               int int_ret = timer_session_rotation_schedule_timer_start(
+               const int int_ret = timer_session_rotation_schedule_timer_start(
                        session, session->rotate_timer_period);
 
                if (int_ret < 0) {
@@ -3044,9 +3044,9 @@ set_session_output_from_descriptor(const ltt_session::locked_ref& session,
 {
        int ret;
        enum lttng_error_code ret_code = LTTNG_OK;
-       enum lttng_session_descriptor_type session_type =
+       const lttng_session_descriptor_type session_type =
                lttng_session_descriptor_get_type(descriptor);
-       enum lttng_session_descriptor_output_type output_type =
+       const lttng_session_descriptor_output_type output_type =
                lttng_session_descriptor_get_output_type(descriptor);
        struct lttng_uri uris[2] = {};
        size_t uri_count = 0;
@@ -3631,7 +3631,7 @@ int cmd_register_consumer(const ltt_session::locked_ref& session,
                pthread_mutex_init(socket->lock, nullptr);
                socket->registered = 1;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                consumer_add_socket(socket, ksess->consumer);
 
                pthread_mutex_lock(&cdata->pid_mutex);
@@ -3674,7 +3674,7 @@ ssize_t cmd_list_domains(const ltt_session::locked_ref& session, struct lttng_do
                DBG3("Listing domains found UST global domain");
                nb_dom++;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        session->ust_session->agents->ht, &iter.iter, agt, node.node) {
@@ -3709,7 +3709,7 @@ ssize_t cmd_list_domains(const ltt_session::locked_ref& session, struct lttng_do
                index++;
 
                {
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        cds_lfht_for_each_entry (
                                session->ust_session->agents->ht, &iter.iter, agt, node.node) {
@@ -3804,7 +3804,7 @@ enum lttng_error_code cmd_list_channels(enum lttng_domain_type domain,
                struct ltt_ust_channel *uchan;
 
                {
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        cds_lfht_for_each_entry (session->ust_session->domain_global.channels->ht,
                                                 &iter.iter,
@@ -3922,7 +3922,7 @@ enum lttng_error_code cmd_list_events(enum lttng_domain_type domain,
                        struct lttng_ht_iter iter;
                        struct agent *agt;
 
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        cds_lfht_for_each_entry (
                                session->ust_session->agents->ht, &iter.iter, agt, node.node) {
@@ -4180,7 +4180,7 @@ int cmd_snapshot_del_output(const ltt_session::locked_ref& session,
 
        LTTNG_ASSERT(output);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * Permission denied to create an output if the session is not
@@ -4254,7 +4254,7 @@ ssize_t cmd_snapshot_list_outputs(const ltt_session::locked_ref& session,
 
        /* Copy list from session to the new list object. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        session->snapshot.output_ht->ht, &iter.iter, output, node.node) {
@@ -4944,7 +4944,7 @@ static enum lttng_error_code set_relayd_for_snapshot(struct consumer_output *out
        DBG2("Set relayd object from snapshot output");
 
        if (session->current_trace_chunk) {
-               enum lttng_trace_chunk_status chunk_status = lttng_trace_chunk_get_id(
+               const lttng_trace_chunk_status chunk_status = lttng_trace_chunk_get_id(
                        session->current_trace_chunk, &current_chunk_id.value);
 
                if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK) {
@@ -4976,7 +4976,7 @@ static enum lttng_error_code set_relayd_for_snapshot(struct consumer_output *out
         * snapshot output.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
@@ -5362,7 +5362,7 @@ int cmd_snapshot_record(const ltt_session::locked_ref& session,
                struct snapshot_output *sout;
                struct lttng_ht_iter iter;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        session->snapshot.output_ht->ht, &iter.iter, sout, node.node) {
index ee7b4305ad813172d23238a547efd0dc2c033ed6..5cae8677bd9e4e8aebcba60b0f70d1a995772ea6 100644 (file)
@@ -53,7 +53,8 @@ static unsigned long
 lttng_condition_session_consumed_size_hash(const struct lttng_condition *_condition)
 {
        unsigned long hash;
-       unsigned long condition_type = (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
+       const unsigned long condition_type =
+               (unsigned long) LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
        struct lttng_condition_session_consumed_size *condition;
        uint64_t val;
 
index 9629182bafc269c888d0a4cda15aba060ea51408..3a25cf5eb2c90515442c552532d0fe40122c9a16 100644 (file)
@@ -293,7 +293,7 @@ void consumer_output_send_destroy_relayd(struct consumer_output *consumer)
 
        /* Destroy any relayd connection */
        if (consumer->type == CONSUMER_DST_NET) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                        /* Send destroy relayd command. */
@@ -320,7 +320,7 @@ int consumer_create_socket(struct consumer_data *data, struct consumer_output *o
 
        LTTNG_ASSERT(data);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (output == nullptr || data->cmd_sock < 0) {
                /*
@@ -544,7 +544,7 @@ void consumer_destroy_output_sockets(struct consumer_output *obj)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (obj->socks->ht, &iter.iter, socket, node.node) {
                        consumer_del_socket(socket, obj);
@@ -638,7 +638,7 @@ int consumer_copy_sockets(struct consumer_output *dst, struct consumer_output *s
        LTTNG_ASSERT(src);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (src->socks->ht, &iter.iter, socket, node.node) {
                        /* Ignore socket that are already there. */
@@ -1272,7 +1272,7 @@ int consumer_is_data_pending(uint64_t session_id, struct consumer_output *consum
 
        {
                /* Send command for each consumer. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                        pthread_mutex_lock(socket->lock);
@@ -1585,7 +1585,7 @@ int consumer_get_discarded_events(uint64_t session_id,
 
        /* Send command for each consumer. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                        uint64_t consumer_discarded = 0;
@@ -1647,7 +1647,7 @@ int consumer_get_lost_packets(uint64_t session_id,
 
        /* Send command for each consumer. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (consumer->socks->ht, &iter.iter, socket, node.node) {
                        uint64_t consumer_lost = 0;
index 79c454809cdb3f65f97da0526130c635e16207a2..0e9e91f0e7f6d030feb91dd88eb29af43a07f115 100644 (file)
@@ -375,7 +375,7 @@ int context_ust_add(struct ltt_ust_session *usess,
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(channel_name);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        chan_ht = usess->domain_global.channels;
 
index 71a2e48d2190c29e0401c4876dda9322e815a456..1388aa5930de0db14c3b73aea6111c44a111ca82 100644 (file)
@@ -311,7 +311,7 @@ private:
                auto member_classes_value = json::json::array();
                for (const auto& field : type.fields_) {
                        ::ctf2::field_visitor member_visitor;
-                       json::json member_class;
+                       const json::json member_class;
 
                        field->accept(member_visitor);
                        member_classes_value.emplace_back(member_visitor.move_fragment());
index 13c21605a7d49ae602ba2a80b799121f479d6618..be694cfa97177ff065937b1c8cc3dc7b35198c1d 100644 (file)
@@ -29,7 +29,7 @@ using session_descriptor = std::unique_ptr<
  */
 using trigger = std::unique_ptr<
        lttng_trigger,
-       lttng::memory::create_deleter_class<lttng_trigger, lttng_trigger_put>::deleter>;
+       lttng::memory::create_deleter_class<lttng_trigger, lttng_trigger_destroy>::deleter>;
 
 } /* namespace ctl */
 } /* namespace lttng */
index 33e90a1a59aeb6b0ef8f39a8a65ac70741804af9..32d50a25eee38e5171879756438e923443f7b536 100644 (file)
@@ -48,7 +48,7 @@ static void update_ust_app(int app_sock)
                return;
        }
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        LTTNG_ASSERT(app_sock >= 0);
        app = ust_app_find_by_sock(app_sock);
        if (app == nullptr) {
@@ -133,8 +133,8 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
 
        for (i = 0; i < nb_fd; i++) {
                /* Get faulty FD. */
-               uint32_t revents = LTTNG_POLL_GETEV(&events, i);
-               int pollfd = LTTNG_POLL_GETFD(&events, i);
+               const uint32_t revents = LTTNG_POLL_GETEV(&events, i);
+               const int pollfd = LTTNG_POLL_GETFD(&events, i);
 
                cds_list_for_each_entry_safe (wait_node, tmp_wait_node, &wait_queue->head, head) {
                        if (pollfd == wait_node->app->sock && (revents & (LPOLLHUP | LPOLLERR))) {
@@ -379,7 +379,7 @@ static void *thread_dispatch_ust_registration(void *data)
                                 * and change its state.
                                 */
                                const auto list_lock = lttng::sessiond::lock_session_list();
-                               lttng::urcu::read_lock_guard read_lock;
+                               const lttng::urcu::read_lock_guard read_lock;
 
                                /*
                                 * Add application to the global hash table. This needs to be
index e22598223658b2a9c4ff4688b4ae5c90bb105191..f9f685176ba06bcdfbc607c1b3e44d56ad3c5f31 100644 (file)
@@ -155,7 +155,7 @@ static void ust_error_accounting_entry_release(struct urcu_ref *entry_ref)
        struct ust_error_accounting_entry *entry =
                lttng::utils::container_of(entry_ref, &ust_error_accounting_entry::ref);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_del(error_counter_uid_ht->ht, &entry->node.node);
        call_rcu(&entry->rcu_head, free_ust_error_accounting_entry);
 }
@@ -180,7 +180,7 @@ static void put_ref_all_ust_error_accounting_entry()
        ASSERT_LOCKED(the_event_notifier_counter.lock);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
@@ -200,7 +200,7 @@ static void get_ref_all_ust_error_accounting_entry()
        ASSERT_LOCKED(the_event_notifier_counter.lock);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        error_counter_uid_ht->ht, &iter.iter, uid_entry, node.node) {
@@ -304,7 +304,7 @@ static enum event_notifier_error_accounting_status get_error_counter_index_for_t
        struct lttng_ht_iter iter;
        const struct index_ht_entry *index_entry;
        enum event_notifier_error_accounting_status status;
-       lttng::urcu::read_lock_guard read_guard;
+       const lttng::urcu::read_lock_guard read_guard;
 
        lttng_ht_lookup(state->indices_ht, &tracer_token, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
@@ -594,7 +594,7 @@ event_notifier_error_accounting_register_app(struct ust_app *app)
        struct ust_error_accounting_entry *entry;
        enum event_notifier_error_accounting_status status;
        struct lttng_ust_abi_object_data **cpu_counters;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (!ust_app_supports_counters(app)) {
                status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED;
@@ -746,7 +746,7 @@ event_notifier_error_accounting_unregister_app(struct ust_app *app)
        struct ust_error_accounting_entry *entry;
        int i;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* If an error occurred during app registration no entry was created. */
        if (!app->event_notifier_group.counter) {
@@ -797,7 +797,7 @@ event_notifier_error_accounting_ust_get_count(const struct lttng_trigger *trigge
        uid_t trigger_owner_uid;
        const char *trigger_name;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        get_trigger_info_for_log(trigger, &trigger_name, &trigger_owner_uid);
 
@@ -870,7 +870,7 @@ event_notifier_error_accounting_ust_clear(const struct lttng_trigger *trigger)
        size_t dimension_index;
        const uint64_t tracer_token = lttng_trigger_get_tracer_token(trigger);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        status = get_error_counter_index_for_token(&ust_state, tracer_token, &error_counter_index);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
@@ -1261,7 +1261,7 @@ void event_notifier_error_accounting_unregister_event_notifier(const struct lttn
        enum event_notifier_error_accounting_status status;
        struct error_accounting_state *state;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        status = event_notifier_error_accounting_clear(trigger);
        if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
index c0b1aeebe75fc6df90e976d55205fe646bd7daff..bd28d948c533b76751fec7033a7ac0063f3ed2c1 100644 (file)
@@ -173,7 +173,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
        LTTNG_ASSERT(uchan);
        LTTNG_ASSERT(event);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        uevent = trace_ust_find_event(uchan->events,
                                      event->name,
@@ -263,7 +263,7 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
 
        ht = uchan->events;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * We use a custom lookup since we need the iterator for the next_duplicate
@@ -328,7 +328,7 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess, struct ltt_
 
        /* Disabling existing events */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (uchan->events->ht, &iter.iter, uevent, node.node) {
                        if (uevent->enabled) {
@@ -370,7 +370,7 @@ static void agent_enable_all(struct agent *agt)
 
        {
                /* Flag every event as enabled. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agt->events->ht, &iter.iter, aevent, node.node) {
                        aevent->enabled_count++;
@@ -482,7 +482,7 @@ static int agent_enable(struct agent *agt,
        LTTNG_ASSERT(event);
        LTTNG_ASSERT(agt);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        aevent = agent_find_event(
                event->name, event->loglevel_type, event->loglevel, filter_expression, agt);
        if (!aevent) {
@@ -837,7 +837,7 @@ int trigger_agent_disable(const struct lttng_trigger *trigger, struct agent *agt
 
        DBG("Event agent disabling for trigger %" PRIu64, lttng_trigger_get_tracer_token(trigger));
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        aevent = agent_find_event_by_trigger(trigger, agt);
 
        if (aevent == nullptr) {
@@ -875,7 +875,7 @@ int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt, const
 
        DBG("Event agent disabling %s (all loglevels) for session %" PRIu64, event_name, usess->id);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        agent_find_events_by_name(event_name, agt, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_str>(&iter);
 
@@ -925,7 +925,7 @@ int event_agent_disable_all(struct ltt_ust_session *usess, struct agent *agt)
 
        /* Disable every event. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agt->events->ht, &iter.iter, aevent, node.node) {
                        if (!AGENT_EVENT_IS_ENABLED(aevent)) {
index b813f0fe691a96d730cb9e8be5ef35d52a02b1ad..f0b1ae4f753799399c72d08ff4f9d0089f9752c3 100644 (file)
@@ -95,7 +95,7 @@ static int kernel_consumer_add_channel(struct consumer_socket *sock,
        struct lttng_channel_extended *channel_attr_extended;
        bool is_local_trace;
        size_t consumer_path_offset = 0;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Safety net */
        LTTNG_ASSERT(channel);
@@ -210,7 +210,7 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        struct lttcomm_consumer_msg lkm;
        struct consumer_output *consumer;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Safety net */
        LTTNG_ASSERT(ksession);
@@ -364,7 +364,7 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
        LTTNG_ASSERT(ksession->consumer);
        LTTNG_ASSERT(sock);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Bail out if consumer is disabled */
        if (!ksession->consumer->enabled) {
index e7626a85d41cbb411c3564321eb89068b58f89f0..2d60fdca06dd54426a6550856ace66333dd57a4e 100644 (file)
@@ -109,7 +109,7 @@ static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset)
        return raw_offset &= ~0b1;
 }
 #else /* defined(__arm__) || defined(__aarch64__) */
-static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset)
+inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset)
 {
        return raw_offset;
 }
@@ -848,7 +848,7 @@ static int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_r
 
        LTTNG_ASSERT(event);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_del(kernel_token_to_event_notifier_rule_ht, &event->ht_node);
 
        ret = kernctl_disable(event->fd);
@@ -1296,7 +1296,7 @@ error:
 void kernel_wait_quiescent()
 {
        int ret;
-       int fd = kernel_tracer_fd;
+       const int fd = kernel_tracer_fd;
 
        DBG("Kernel quiescent wait on %d", fd);
 
@@ -1641,7 +1641,7 @@ void kernel_destroy_session(struct ltt_kernel_session *ksess)
                struct lttng_ht_iter iter;
 
                /* For each consumer socket. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -1751,7 +1751,7 @@ enum lttng_error_code kernel_snapshot_record(struct ltt_kernel_session *ksess,
 
        {
                /* Send metadata to consumer and snapshot everything. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (output->socks->ht, &iter.iter, socket, node.node) {
                        struct ltt_kernel_channel *chan;
@@ -1914,7 +1914,7 @@ enum lttng_error_code kernel_rotate_session(const ltt_session::locked_ref& sessi
                 * Note that this loop will end after one iteration given that there is
                 * only one kernel consumer.
                 */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -1958,7 +1958,7 @@ enum lttng_error_code kernel_create_channel_subdirectories(const struct ltt_kern
        enum lttng_error_code ret = LTTNG_OK;
        enum lttng_trace_chunk_status chunk_status;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        LTTNG_ASSERT(ksess->current_trace_chunk);
 
        /*
@@ -2023,7 +2023,7 @@ void set_kernel_tracer_status_from_modules_ret(int code)
 int init_kernel_tracer()
 {
        int ret;
-       bool is_root = !getuid();
+       const bool is_root = !getuid();
 
        const auto log_status_on_exit = lttng::make_scope_exit([]() noexcept {
                DBG_FMT("Kernel tracer status set to `{}`",
@@ -2265,7 +2265,7 @@ enum lttng_error_code kernel_clear_session(const ltt_session::locked_ref& sessio
                 * Note that this loop will end after one iteration given that there is
                 * only one kernel consumer.
                 */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
@@ -2364,7 +2364,7 @@ error:
 enum lttng_error_code
 kernel_destroy_event_notifier_group_notification_fd(int event_notifier_group_notification_fd)
 {
-       enum lttng_error_code ret_code = LTTNG_OK;
+       const lttng_error_code ret_code = LTTNG_OK;
 
        DBG("Closing event notifier group notification file descriptor: fd = %d",
            event_notifier_group_notification_fd);
@@ -2547,7 +2547,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
 
        /* Add trigger to kernel token mapping in the hash table. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_add(kernel_token_to_event_notifier_rule_ht,
                             hash_trigger(trigger),
                             &event_notifier_rule->ht_node);
@@ -2613,7 +2613,7 @@ enum lttng_error_code kernel_unregister_event_notifier(const struct lttng_trigge
        enum lttng_error_code error_code_ret;
        int ret;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_lookup(kernel_token_to_event_notifier_rule_ht,
                        hash_trigger(trigger),
index 06f4ab1fb991a0ca0b81c6ff2dd1fd5b78a224ba..42eb0e7eed707a9c874a7e1b9f07716de67aefb5 100644 (file)
@@ -165,7 +165,7 @@ static void destroy_syscall_ht(struct lttng_ht *ht)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ht->ht, &iter.iter, ksyscall, node.node) {
                        int ret;
@@ -313,7 +313,7 @@ ssize_t syscall_table_list(struct lttng_event **_events)
                }
 
                {
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        struct syscall *ksyscall;
 
                        ksyscall = lookup_syscall(syscalls_ht, syscall_table[i].name);
index 520583cc205fb92addced4474637508352523af4..70a750aec528e1c9dcf3dcb655273b16f96e3f84 100644 (file)
@@ -130,7 +130,7 @@ static int update_kernel_stream(int fd)
                        }
 
                        {
-                               lttng::urcu::read_lock_guard read_lock;
+                               const lttng::urcu::read_lock_guard read_lock;
 
                                cds_lfht_for_each_entry (
                                        ksess->consumer->socks->ht, &iter.iter, socket, node.node) {
index 0b274c9a3fae6e4986f4704c9bdc5e7c4ba221f7..e2050e7febefa809227f38c1b48c3d0a9b252603 100644 (file)
@@ -787,7 +787,7 @@ int modprobe_lttng_data()
                }
        } else {
                /* Default probes. */
-               int def_len = ARRAY_SIZE(kern_modules_probes_default);
+               const int def_len = ARRAY_SIZE(kern_modules_probes_default);
 
                probes = calloc<kern_modules_param>(def_len);
                if (!probes) {
index 8065cd7323b20f8c9ca8bfa137d88ff44d9c5810..b06d7bea0e2d6624be952644267f522ae3f88988 100644 (file)
@@ -217,8 +217,8 @@ static int match_channel_trigger_list(struct cds_lfht_node *node, const void *ke
        trigger_list =
                caa_container_of(node, struct lttng_channel_trigger_list, channel_triggers_ht_node);
 
-       return !!((channel_key->key == trigger_list->channel_key.key) &&
-                 (channel_key->domain == trigger_list->channel_key.domain));
+       return !((channel_key->key != trigger_list->channel_key.key) ||
+                (channel_key->domain != trigger_list->channel_key.domain));
 }
 
 static int match_session_trigger_list(struct cds_lfht_node *node, const void *key)
@@ -239,8 +239,8 @@ static int match_channel_state_sample(struct cds_lfht_node *node, const void *ke
 
        sample = caa_container_of(node, struct channel_state_sample, channel_state_ht_node);
 
-       return !!((channel_key->key == sample->key.key) &&
-                 (channel_key->domain == sample->key.domain));
+       return !((channel_key->key != sample->key.key) ||
+                (channel_key->domain != sample->key.domain));
 }
 
 static int match_channel_info(struct cds_lfht_node *node, const void *key)
@@ -250,8 +250,8 @@ static int match_channel_info(struct cds_lfht_node *node, const void *key)
 
        channel_info = caa_container_of(node, struct channel_info, channels_ht_node);
 
-       return !!((channel_key->key == channel_info->key.key) &&
-                 (channel_key->domain == channel_info->key.domain));
+       return !((channel_key->key != channel_info->key.key) ||
+                (channel_key->domain != channel_info->key.domain));
 }
 
 static int match_trigger(struct cds_lfht_node *node, const void *key)
@@ -312,7 +312,7 @@ static struct session_info *get_session_info_by_id(const struct notification_thr
 {
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        cds_lfht_lookup(
                state->sessions_ht, hash_session_info_id(id), match_session_info, &id, &iter);
@@ -444,8 +444,8 @@ static unsigned long hash_trigger_by_name_uid(const struct lttng_trigger *trigge
 
 static unsigned long hash_channel_key(struct channel_key *key)
 {
-       unsigned long key_hash = hash_key_u64(&key->key, lttng_ht_seed);
-       unsigned long domain_hash =
+       const unsigned long key_hash = hash_key_u64(&key->key, lttng_ht_seed);
+       const unsigned long domain_hash =
                hash_key_ulong((void *) (unsigned long) key->domain, lttng_ht_seed);
 
        return key_hash ^ domain_hash;
@@ -527,7 +527,7 @@ static void session_info_destroy(void *_data)
        }
        lttng_session_trigger_list_destroy(session_info->trigger_list);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_del(session_info->sessions_ht, &session_info->sessions_ht_node);
        free(session_info->name);
        lttng_trace_archive_location_put(session_info->last_state_sample.rotation.location);
@@ -595,7 +595,7 @@ error:
 static void session_info_add_channel(struct session_info *session_info,
                                     struct channel_info *channel_info)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_add(session_info->channel_infos_ht,
                     hash_channel_key(&channel_info->key),
                     &channel_info->session_info_channels_ht_node);
@@ -604,7 +604,7 @@ static void session_info_add_channel(struct session_info *session_info,
 static void session_info_remove_channel(struct session_info *session_info,
                                        struct channel_info *channel_info)
 {
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_del(session_info->channel_infos_ht, &channel_info->session_info_channels_ht_node);
 }
 
@@ -663,7 +663,7 @@ static void notification_client_list_release(struct urcu_ref *list_ref)
        lttng_condition_put(list->condition);
 
        if (list->notification_trigger_clients_ht) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_del(list->notification_trigger_clients_ht,
                             &list->notification_trigger_clients_ht_node);
@@ -728,7 +728,7 @@ notification_client_list_create(struct notification_thread_state *state,
 
        {
                /* Build a list of clients to which this new condition applies. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        state->client_socket_ht, &iter, client, client_socket_ht_node) {
@@ -755,7 +755,7 @@ notification_client_list_create(struct notification_thread_state *state,
         * Add the client list to the global list of client list.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_add_unique(state->notification_trigger_clients_ht,
                                    lttng_condition_hash(client_list->condition),
@@ -790,7 +790,7 @@ get_client_list_from_condition(struct notification_thread_state *state,
        struct cds_lfht_iter iter;
        struct notification_client_list *list = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(state->notification_trigger_clients_ht,
                        lttng_condition_hash(condition),
                        match_client_list_condition,
@@ -820,7 +820,7 @@ static int evaluate_channel_condition_for_client(const struct lttng_condition *c
        struct channel_state_sample *last_sample = nullptr;
        struct lttng_channel_trigger_list *channel_trigger_list = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Find the channel associated with the condition. */
        cds_lfht_for_each_entry (
@@ -1516,7 +1516,7 @@ lttng_session_trigger_list_create(const char *session_name, struct cds_lfht *ses
 
        /* Publish the list through the session_triggers_ht. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_add(session_triggers_ht,
                             hash_key_str(session_name, lttng_ht_seed),
                             &list->session_triggers_ht_node);
@@ -1543,7 +1543,7 @@ static void lttng_session_trigger_list_destroy(struct lttng_session_trigger_list
                cds_list_del(&trigger_list_element->node);
                free(trigger_list_element);
        }
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        /* Unpublish the list from the session_triggers_ht. */
        cds_lfht_del(list->session_triggers_ht, &list->session_triggers_ht_node);
        call_rcu(&list->rcu_node, free_session_trigger_list_rcu);
@@ -1610,7 +1610,7 @@ lttng_session_trigger_list_build(const struct notification_thread_state *state,
 
        {
                /* Add all triggers applying to the session named 'session_name'. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                        int ret;
@@ -1646,7 +1646,7 @@ static struct session_info *create_and_publish_session_info(struct notification_
        struct session_info *session = nullptr;
        struct lttng_session_trigger_list *trigger_list;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        trigger_list = lttng_session_trigger_list_build(state, name);
        if (!trigger_list) {
                goto error;
@@ -1699,7 +1699,7 @@ static int handle_notification_thread_command_add_channel(struct notification_th
        int trigger_count = 0;
        struct cds_lfht_iter iter;
        struct session_info *session_info = nullptr;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        DBG("Adding channel: channel name = `%s`, session id = %" PRIu64 ", channel key = %" PRIu64
            ", domain = %s",
@@ -1867,7 +1867,7 @@ handle_notification_thread_command_remove_channel(struct notification_thread_sta
            channel_key,
            lttng_domain_type_str(domain));
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_lookup(state->channel_triggers_ht,
                        hash_channel_key(&key),
@@ -1942,7 +1942,7 @@ handle_notification_thread_command_session_rotation(struct notification_thread_s
        struct lttng_credentials session_creds;
        struct session_state_sample new_session_state;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        session_info = get_session_info_by_id(state, session_id);
        if (!session_info) {
@@ -2269,7 +2269,7 @@ handle_notification_thread_command_list_triggers(struct notification_thread_hand
        struct lttng_triggers *local_triggers = nullptr;
        const struct lttng_credentials *creds;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        local_triggers = lttng_triggers_create();
        if (!local_triggers) {
@@ -2341,7 +2341,7 @@ static int handle_notification_thread_command_get_trigger(struct notification_th
        uid_t trigger_owner_uid;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
                        if (lttng_trigger_is_equal(trigger, trigger_ht_element->trigger)) {
@@ -2674,7 +2674,7 @@ handle_notification_thread_command_register_trigger(struct notification_thread_s
        enum action_executor_status executor_status;
        const uint64_t trigger_tracer_token = state->trigger_id.next_tracer_token++;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Set the trigger's tracer token. */
        lttng_trigger_set_tracer_token(trigger, trigger_tracer_token);
@@ -2985,7 +2985,7 @@ static void teardown_tracer_notifier(struct notification_thread_state *state,
        struct notification_trigger_tokens_ht_element *trigger_tokens_ht_element;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        state->trigger_tokens_ht, &iter, trigger_tokens_ht_element, node) {
@@ -3048,7 +3048,7 @@ handle_notification_thread_command_unregister_trigger(struct notification_thread
        const struct lttng_condition *condition = lttng_trigger_get_const_condition(trigger);
        enum lttng_error_code cmd_reply;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_lookup(
                state->triggers_ht, lttng_condition_hash(condition), match_trigger, trigger, &iter);
@@ -3153,7 +3153,7 @@ end:
 
 static notification_thread_command *pop_cmd_queue(notification_thread_handle *handle)
 {
-       lttng::pthread::lock_guard queue_lock(handle->cmd_queue.lock);
+       const lttng::pthread::lock_guard queue_lock(handle->cmd_queue.lock);
 
        uint64_t counter;
        const auto read_ret = lttng_read(handle->cmd_queue.event_fd, &counter, sizeof(counter));
@@ -3289,7 +3289,7 @@ int handle_notification_thread_command(struct notification_thread_handle *handle
                        cmd->parameters.client_communication_update.id;
                struct notification_client *client;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                client = get_client_from_id(client_id, state);
 
                if (!client) {
@@ -3436,7 +3436,7 @@ int handle_notification_thread_client_connect(struct notification_thread_state *
        DBG("Added new notification channel client socket (%i) to poll set", client->socket);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_add(state->client_socket_ht,
                             hash_client_socket(client->socket),
@@ -3497,7 +3497,7 @@ int handle_notification_thread_client_disconnect(int client_socket,
        int ret = 0;
        struct notification_client *client;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        DBG("Closing client connection (socket fd = %i)", client_socket);
        client = get_client_from_socket(client_socket, state);
@@ -3522,7 +3522,7 @@ int handle_notification_thread_client_disconnect_all(struct notification_thread_
        DBG("Closing all client connections");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        state->client_socket_ht, &iter, client, client_socket_ht_node) {
@@ -3544,9 +3544,9 @@ int handle_notification_thread_trigger_unregister_all(struct notification_thread
        struct cds_lfht_iter iter;
        struct lttng_trigger_ht_element *trigger_ht_element;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_for_each_entry (state->triggers_ht, &iter, trigger_ht_element, node) {
-               int ret = handle_notification_thread_command_unregister_trigger(
+               const int ret = handle_notification_thread_command_unregister_trigger(
                        state, trigger_ht_element->trigger, nullptr);
                if (ret) {
                        error_occurred = true;
@@ -4025,7 +4025,7 @@ int handle_notification_thread_client_in(struct notification_thread_state *state
        ssize_t recv_ret;
        size_t offset;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        client = get_client_from_socket(socket, state);
        if (!client) {
                /* Internal error, abort. */
@@ -4124,7 +4124,7 @@ int handle_notification_thread_client_out(struct notification_thread_state *stat
        struct notification_client *client;
        enum client_transmission_status transmission_status;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        client = get_client_from_socket(socket, state);
        if (!client) {
                /* Internal error, abort. */
@@ -4654,7 +4654,7 @@ dispatch_one_event_notifier_notification(struct notification_thread_state *state
        unsigned int capture_count = 0;
 
        /* Find triggers associated with this token. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(state->trigger_tokens_ht,
                        hash_key_u64(&notification->tracer_token, lttng_ht_seed),
                        match_trigger_token,
@@ -4825,7 +4825,7 @@ int handle_notification_thread_channel_sample(struct notification_thread_state *
        struct lttng_credentials channel_creds = {};
        struct lttng_credentials session_creds = {};
        struct session_info *session;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * The monitoring pipe only holds messages smaller than PIPE_BUF,
index 72aa08292141c7b8d7439fc3d9579ca8d3183c40..82272fedc2a53e021bc73e89e9102b08fc96ac36 100644 (file)
@@ -156,7 +156,7 @@ error:
 static char *get_notification_channel_sock_path()
 {
        int ret;
-       bool is_root = !getuid();
+       const bool is_root = !getuid();
        char *sock_path;
 
        sock_path = calloc<char>(LTTNG_PATH_MAX);
@@ -662,8 +662,8 @@ static void *thread_notification(void *data)
 
                fd_count = ret;
                for (i = 0; i < fd_count; i++) {
-                       int fd = LTTNG_POLL_GETFD(&state.events, i);
-                       uint32_t revents = LTTNG_POLL_GETEV(&state.events, i);
+                       const int fd = LTTNG_POLL_GETFD(&state.events, i);
+                       const uint32_t revents = LTTNG_POLL_GETEV(&state.events, i);
 
                        DBG("Handling fd (%i) activity (%u)", fd, revents);
 
index 10e0656724a8f26cdd5591ab3f94d7ae89a4c1a4..a26f620b40910b45390cc2649ae01f5e10b90c8a 100644 (file)
@@ -122,7 +122,7 @@ void check_session_rotation_pending_on_consumers(const ltt_session::locked_ref&
        uint64_t relayd_id;
        bool chunk_exists_on_peer = false;
        enum lttng_trace_chunk_status chunk_status;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        LTTNG_ASSERT(session->chunk_being_archived);
 
@@ -140,7 +140,7 @@ void check_session_rotation_pending_on_consumers(const ltt_session::locked_ref&
                        -1ULL :
                        session->ust_session->consumer->net_seq_index;
 
-               lttng::pthread::lock_guard socket_lock(*socket->lock);
+               const lttng::pthread::lock_guard socket_lock(*socket->lock);
                ret = consumer_trace_chunk_exists(socket,
                                                  relayd_id,
                                                  session->id,
@@ -164,7 +164,7 @@ skip_ust:
 
        cds_lfht_for_each_entry (
                session->kernel_session->consumer->socks->ht, &iter, socket, node.node) {
-               lttng::pthread::lock_guard socket_lock(*socket->lock);
+               const lttng::pthread::lock_guard socket_lock(*socket->lock);
 
                relayd_id = session->kernel_session->consumer->type == CONSUMER_DST_LOCAL ?
                        -1ULL :
@@ -391,7 +391,7 @@ void ls::rotation_thread_timer_queue_destroy(struct rotation_thread_timer_queue
        lttng_pipe_destroy(queue->event_pipe);
 
        {
-               lttng::pthread::lock_guard queue_lock(queue->lock);
+               const lttng::pthread::lock_guard queue_lock(queue->lock);
 
                LTTNG_ASSERT(cds_list_empty(&queue->list));
        }
@@ -472,7 +472,7 @@ void ls::rotation_thread_enqueue_job(ls::rotation_thread_timer_queue *queue,
        const char dummy = '!';
        struct rotation_thread_job *job = nullptr;
        const char *job_type_str = get_job_type_str(job_type);
-       lttng::pthread::lock_guard queue_lock(queue->lock);
+       const lttng::pthread::lock_guard queue_lock(queue->lock);
 
        if (timer_job_exists(queue, job_type, session)) {
                /*
@@ -533,7 +533,7 @@ void ls::rotation_thread::_handle_job_queue()
 
                {
                        /* Take the queue lock only to pop an element from the list. */
-                       lttng::pthread::lock_guard rotation_timer_queue_lock(
+                       const lttng::pthread::lock_guard rotation_timer_queue_lock(
                                _rotation_timer_queue.lock);
                        if (cds_list_empty(&_rotation_timer_queue.list)) {
                                break;
index 7e3c49290a193b0e627a54d55d8cca49e9252a4a..67fa01de66d0e5ab6cbe756923500bd8d7184f44 100644 (file)
@@ -1108,7 +1108,7 @@ static int save_ust_events(struct config_writer *writer, struct lttng_ht *events
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (events->ht, &iter.iter, node, node) {
                        event = lttng::utils::container_of(node, &ltt_ust_event::node);
@@ -1189,7 +1189,7 @@ static int save_agent_events(struct config_writer *writer, struct agent *agent)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (agent->events->ht, &iter.iter, node, node) {
                        struct agent_event *agent_event;
@@ -1833,7 +1833,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
 
        if (tracking_policy == LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                unsigned int i, count;
-               enum process_attr_tracker_status status =
+               const process_attr_tracker_status status =
                        process_attr_tracker_get_inclusion_set(tracker, &values);
 
                if (status != PROCESS_ATTR_TRACKER_STATUS_OK) {
@@ -2039,7 +2039,7 @@ static int save_ust_domain(struct config_writer *writer,
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        session->ust_session->domain_global.channels->ht, &iter.iter, node, node) {
@@ -2319,7 +2319,7 @@ static int save_snapshot_outputs(struct config_writer *writer, struct snapshot *
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (snapshot->output_ht->ht, &iter.iter, output, node.node) {
                        ret = config_writer_open_element(writer, config_element_output);
index ea92db57f9e0a24f796c7e3f8f93eff3ba5bd6f8..f6041584114ef62c4cb0efe3bb2c19c6bda759e8 100644 (file)
@@ -520,7 +520,7 @@ static int _session_set_trace_chunk_no_lock_check(const ltt_session::locked_ref&
        uint64_t chunk_id;
        enum lttng_trace_chunk_status chunk_status;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        /*
         * Ownership of current trace chunk is transferred to
         * `current_trace_chunk`.
@@ -889,7 +889,7 @@ static enum lttng_error_code session_kernel_open_packets(const ltt_session::lock
        struct cds_lfht_node *node;
        struct ltt_kernel_channel *chan;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_first(session->kernel_session->consumer->socks->ht, &iter.iter);
        node = cds_lfht_iter_get_node(&iter.iter);
@@ -1402,7 +1402,7 @@ bool sample_session_id_by_name(const char *name, uint64_t *id)
        struct lttng_ht_iter iter;
        struct ltt_session *ls;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (!ltt_sessions_ht_by_name) {
                found = false;
@@ -1447,7 +1447,7 @@ void ltt_session::_locked_const_session_release(const ltt_session *session)
 
 ltt_session::locked_ref ltt_session::find_locked_session(ltt_session::id_t id)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        auto session = session_find_by_id(id);
 
        if (!session) {
@@ -1464,7 +1464,7 @@ ltt_session::locked_ref ltt_session::find_locked_session(ltt_session::id_t id)
 
 ltt_session::locked_ref ltt_session::find_locked_session(lttng::c_string_view name)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        auto session = session_find_by_name(name.data());
 
        if (!session) {
@@ -1477,7 +1477,7 @@ ltt_session::locked_ref ltt_session::find_locked_session(lttng::c_string_view na
 
 ltt_session::const_locked_ref ltt_session::find_locked_const_session(ltt_session::id_t id)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        const auto *session = session_find_by_id(id);
 
        if (!session) {
@@ -1490,7 +1490,7 @@ ltt_session::const_locked_ref ltt_session::find_locked_const_session(ltt_session
 
 ltt_session::const_locked_ref ltt_session::find_locked_const_session(lttng::c_string_view name)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        const auto *session = session_find_by_name(name.data());
 
        if (!session) {
@@ -1503,7 +1503,7 @@ ltt_session::const_locked_ref ltt_session::find_locked_const_session(lttng::c_st
 
 ltt_session::ref ltt_session::find_session(ltt_session::id_t id)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        auto session = session_find_by_id(id);
 
        if (!session) {
@@ -1515,7 +1515,7 @@ ltt_session::ref ltt_session::find_session(ltt_session::id_t id)
 
 ltt_session::ref ltt_session::find_session(lttng::c_string_view name)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        auto session = session_find_by_name(name.data());
 
        if (!session) {
@@ -1527,7 +1527,7 @@ ltt_session::ref ltt_session::find_session(lttng::c_string_view name)
 
 ltt_session::const_ref ltt_session::find_const_session(ltt_session::id_t id)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        const auto *session = session_find_by_id(id);
 
        if (!session) {
@@ -1539,7 +1539,7 @@ ltt_session::const_ref ltt_session::find_const_session(ltt_session::id_t id)
 
 ltt_session::const_ref ltt_session::find_const_session(lttng::c_string_view name)
 {
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        const auto *session = session_find_by_name(name.data());
 
        if (!session) {
index e8aeae8efbddb4e805f8ed90fa2a9b9b9ff80b20..037488b8a86c96f97660b3b8810337051190619e 100644 (file)
@@ -236,7 +236,7 @@ end:
 int sessiond_config_init(struct sessiond_config *config)
 {
        int ret;
-       bool is_root = (getuid() == 0);
+       const bool is_root = (getuid() == 0);
        char *str;
 
        LTTNG_ASSERT(config);
index f9ab929d64905ff1f57d431e2fd0b76d4aefebe1..d4fb5f0699e704aa9efae68df43de3f4ccd38bdf 100644 (file)
@@ -194,7 +194,7 @@ void snapshot_delete_output(struct snapshot *snapshot, struct snapshot_output *o
        LTTNG_ASSERT(output);
 
        iter.iter.node = &output->node.node;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        ret = lttng_ht_del(snapshot->output_ht, &iter);
        LTTNG_ASSERT(!ret);
        /*
@@ -213,7 +213,7 @@ void snapshot_add_output(struct snapshot *snapshot, struct snapshot_output *outp
        LTTNG_ASSERT(snapshot->output_ht);
        LTTNG_ASSERT(output);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_add_unique_ulong(snapshot->output_ht, &output->node);
        /*
         * This is safe because the ownership of a snapshot object is in a session
@@ -327,7 +327,7 @@ void snapshot_destroy(struct snapshot *obj)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (obj->output_ht->ht, &iter.iter, output, node.node) {
                        snapshot_delete_output(obj, output);
index bffd2900b3e8c93c8bd7af9f77ffc791a133ffed..ea892a6d92c69cd40dc92d4c032967a7ca2f53ef 100644 (file)
@@ -282,7 +282,7 @@ struct ltt_ust_session *trace_ust_create_session(uint64_t session_id)
 
        /* Init data structure */
        lus->id = session_id;
-       lus->active = 0;
+       lus->active = false;
 
        /* Set default metadata channel attribute. */
        lus->metadata_attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
@@ -764,10 +764,10 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (id_tracker->ht->ht, &iter.iter, tracker_node, node.node) {
-                       int ret = lttng_ht_del(id_tracker->ht, &iter);
+                       const int ret = lttng_ht_del(id_tracker->ht, &iter);
 
                        LTTNG_ASSERT(!ret);
                        destroy_id_tracker_node(tracker_node);
@@ -781,7 +781,7 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
 static struct ust_id_tracker_node *
 id_tracker_lookup(struct ust_id_tracker *id_tracker, int id, struct lttng_ht_iter *iter)
 {
-       unsigned long _id = (unsigned long) id;
+       const unsigned long _id = (unsigned long) id;
        struct lttng_ht_node_ulong *node;
 
        lttng_ht_lookup(id_tracker->ht, (void *) _id, iter);
@@ -1208,7 +1208,7 @@ static void destroy_contexts(struct lttng_ht *ht)
        LTTNG_ASSERT(ht);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ht->ht, &iter.iter, node, node) {
                        /* Remove from ordered list. */
@@ -1276,7 +1276,7 @@ static void destroy_events(struct lttng_ht *events)
        LTTNG_ASSERT(events);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (events->ht, &iter.iter, node, node) {
                        ret = lttng_ht_del(events, &iter);
@@ -1345,7 +1345,7 @@ int trace_ust_regenerate_metadata(struct ltt_ust_session *usess)
        struct buffer_reg_uid *uid_reg = nullptr;
        struct buffer_reg_session *session_reg = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_list_for_each_entry (uid_reg, &usess->buffer_reg_uid_list, lnode) {
                lsu::registry_session *registry;
 
@@ -1376,7 +1376,7 @@ static void destroy_channels(struct lttng_ht *channels)
        LTTNG_ASSERT(channels);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (channels->ht, &iter.iter, node, node) {
                        struct ltt_ust_channel *chan =
@@ -1418,10 +1418,10 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        destroy_domain_global(&session->domain_global);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (session->agents->ht, &iter.iter, agt, node.node) {
-                       int ret = lttng_ht_del(session->agents, &iter);
+                       const int ret = lttng_ht_del(session->agents, &iter);
 
                        LTTNG_ASSERT(!ret);
                        agent_destroy(agt);
index 526e51b6bc847ad47f7b4ceec872f95c975cbba7..453034490fc6a1e70f41b8fa0ca710c10c763a30 100644 (file)
@@ -93,7 +93,7 @@ static void process_attr_tracker_clear_inclusion_set(struct process_attr_tracker
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        tracker->inclusion_set_ht, &iter.iter, value_node, inclusion_set_ht_node) {
@@ -167,7 +167,7 @@ process_attr_tracker_lookup(const struct process_attr_tracker *tracker,
 
        LTTNG_ASSERT(tracker->policy == LTTNG_TRACKING_POLICY_INCLUDE_SET);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(tracker->inclusion_set_ht,
                        process_attr_value_hash(value),
                        match_inclusion_set_value,
@@ -189,7 +189,7 @@ process_attr_tracker_inclusion_set_add_value(struct process_attr_tracker *tracke
        struct process_attr_value *value_copy = nullptr;
        struct process_attr_tracker_value_node *value_node = nullptr;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        if (tracker->policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                status = PROCESS_ATTR_TRACKER_STATUS_INVALID_TRACKING_POLICY;
                goto end;
@@ -236,7 +236,7 @@ process_attr_tracker_inclusion_set_remove_value(struct process_attr_tracker *tra
        struct process_attr_tracker_value_node *value_node;
        enum process_attr_tracker_status status = PROCESS_ATTR_TRACKER_STATUS_OK;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        if (tracker->policy != LTTNG_TRACKING_POLICY_INCLUDE_SET) {
                status = PROCESS_ATTR_TRACKER_STATUS_INVALID_TRACKING_POLICY;
                goto end;
@@ -275,7 +275,7 @@ process_attr_tracker_get_inclusion_set(const struct process_attr_tracker *tracke
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        tracker->inclusion_set_ht, &iter.iter, value_node, inclusion_set_ht_node) {
index 83f4a24274fc84cd47799bd2327be35713b2702d..4129333c16ba4b54e881236e1bc158f6d67f44ee 100644 (file)
@@ -75,7 +75,7 @@ std::string escape_tsdl_identifier(const std::string& original_identifier)
        new_identifier = "_";
 
        /* Replace illegal characters by '_'. */
-       std::locale c_locale{ "C" };
+       const std::locale c_locale{ "C" };
        for (const auto current_char : original_identifier) {
                if (!std::isalnum(current_char, c_locale) && current_char != '_') {
                        new_identifier += '_';
index cc23c75fa04c4cf4eb0d8c12e34ceee7754318e4..cb70dae23b16e20d177b4c6e2ab78600bd2b0dc6 100644 (file)
@@ -503,7 +503,7 @@ static void save_per_pid_lost_discarded_counters(struct ust_app_channel *ua_chan
                return;
        }
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        try {
                const auto session = ltt_session::find_session(ua_chan->session->tracing_id);
@@ -881,7 +881,7 @@ static int close_metadata(uint64_t metadata_key,
 {
        int ret;
        struct consumer_socket *socket;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        LTTNG_ASSERT(consumer);
 
@@ -1033,13 +1033,13 @@ static void delete_ust_app(struct ust_app *app)
        /* Wipe sessions */
        cds_list_for_each_entry_safe (ua_sess, tmp_ua_sess, &app->teardown_head, teardown_node) {
                /* Free every object in the session and the session. */
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                delete_ust_app_session(sock, ua_sess, app);
        }
 
        /* Remove the event notifier rules associated with this app. */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (app->token_to_event_notifier_rule_ht->ht,
                                         &iter.iter,
@@ -1722,7 +1722,7 @@ static struct lttng_ust_abi_event_exclusion *
 create_ust_exclusion_from_exclusion(const struct lttng_event_exclusion *exclusion)
 {
        struct lttng_ust_abi_event_exclusion *ust_exclusion = nullptr;
-       size_t exclusion_alloc_size = sizeof(struct lttng_ust_abi_event_exclusion) +
+       const size_t exclusion_alloc_size = sizeof(struct lttng_ust_abi_event_exclusion) +
                LTTNG_UST_ABI_SYM_NAME_LEN * exclusion->count;
 
        ust_exclusion = zmalloc<lttng_ust_abi_event_exclusion>(exclusion_alloc_size);
@@ -2565,7 +2565,7 @@ static int setup_buffer_reg_pid(struct ust_app_session *ua_sess,
        LTTNG_ASSERT(ua_sess);
        LTTNG_ASSERT(app);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        reg_pid = buffer_reg_pid_find(ua_sess->id);
        if (!reg_pid) {
@@ -2634,7 +2634,7 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
        LTTNG_ASSERT(usess);
        LTTNG_ASSERT(app);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        reg_uid = buffer_reg_uid_find(usess->id, app->abi.bits_per_long, app->uid);
        if (!reg_uid) {
@@ -3050,7 +3050,7 @@ static int do_consumer_create_channel(struct ltt_ust_session *usess,
        LTTNG_ASSERT(ua_chan);
        LTTNG_ASSERT(registry);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        health_code_update();
 
        /* Get the right consumer socket for the application. */
@@ -3569,7 +3569,7 @@ static int create_channel_per_pid(struct ust_app *app,
 
        DBG("UST app creating channel %s with per PID buffers", ua_chan->name);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        registry = ust_app_get_session_registry(ua_sess->get_identifier());
        /* The UST app session lock is held, registry shall not be null. */
@@ -4120,7 +4120,7 @@ void ust_app_add(struct ust_app *app)
 
        app->registration_time = time(nullptr);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * On a re-registration, we want to kick out the previous registration of
@@ -4319,7 +4319,7 @@ static void ust_app_unregister(ust_app& app)
        struct lttng_ht_iter iter;
        struct ust_app_session *ua_sess;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * For per-PID buffers, perform "push metadata" and flush all
@@ -4425,7 +4425,7 @@ void ust_app_unregister_by_socket(int sock_fd)
        struct lttng_ht_iter ust_app_sock_iter;
        int ret;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Get the node reference for a call_rcu */
        lttng_ht_lookup(ust_app_ht_by_sock, (void *) ((unsigned long) sock_fd), &ust_app_sock_iter);
@@ -4469,7 +4469,7 @@ int ust_app_list_events(struct lttng_event **events)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct lttng_ust_abi_tracepoint_iter uiter;
@@ -4627,7 +4627,7 @@ int ust_app_list_event_fields(struct lttng_event_field **fields)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct lttng_ust_abi_field_iter uiter;
@@ -4776,7 +4776,7 @@ void ust_app_clean_list()
 
        /* Cleanup notify socket hash table */
        if (ust_app_ht_by_notify_sock) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        ust_app_ht_by_notify_sock->ht, &iter.iter, app, notify_sock_n.node) {
@@ -4791,7 +4791,7 @@ void ust_app_clean_list()
 
        /* Cleanup socket hash table */
        if (ust_app_ht_by_sock) {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht_by_sock->ht, &iter.iter, app, sock_n.node) {
                        ret = lttng_ht_del(ust_app_ht_by_sock, &iter);
@@ -4850,7 +4850,7 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_ch
             usess->id);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* For every registered applications */
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
@@ -4905,7 +4905,7 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess, struct ltt_ust_cha
             usess->id);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* For every registered applications */
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
@@ -4956,7 +4956,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
            usess->id);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* For all registered applications */
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
@@ -5109,7 +5109,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
         */
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* For all registered applications */
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
@@ -5192,7 +5192,7 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
            usess->id);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* For all registered applications */
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
@@ -5255,7 +5255,7 @@ static int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *ap
 
        DBG("Starting tracing for ust app pid %d", app->pid);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        const auto update_health_code_on_exit =
                lttng::make_scope_exit([]() noexcept { health_code_update(); });
 
@@ -5345,7 +5345,7 @@ static int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app
 
        DBG("Stopping tracing for ust app pid %d", app->pid);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        const auto update_health_code_on_exit =
                lttng::make_scope_exit([]() noexcept { health_code_update(); });
 
@@ -5472,7 +5472,7 @@ static int ust_app_flush_app_session(ust_app& app, ust_app_session& ua_sess)
        switch (ua_sess.buffer_type) {
        case LTTNG_BUFFER_PER_PID:
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ua_sess.channels->ht, &iter.iter, ua_chan, node.node) {
                        health_code_update();
@@ -5515,7 +5515,7 @@ static int ust_app_flush_session(struct ltt_ust_session *usess)
 
                /* Flush all per UID buffers associated to that session. */
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        lsu::registry_session *ust_session_reg;
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
@@ -5551,7 +5551,7 @@ static int ust_app_flush_session(struct ltt_ust_session *usess)
                struct ust_app_session *ua_sess;
                struct lttng_ht_iter iter;
                struct ust_app *app;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = ust_app_lookup_app_session(usess, app);
@@ -5583,7 +5583,7 @@ static int ust_app_clear_quiescent_app_session(struct ust_app *app, struct ust_a
 
        DBG("Clearing stream quiescent state for ust app pid %d", app->pid);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        const auto update_health_code_on_exit =
                lttng::make_scope_exit([]() noexcept { health_code_update(); });
 
@@ -5652,7 +5652,7 @@ static int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct consumer_socket *socket;
                        struct buffer_reg_channel *buf_reg_chan;
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        /* Get associated consumer socket.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
@@ -5685,7 +5685,7 @@ static int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
                struct ust_app_session *ua_sess;
                struct lttng_ht_iter iter;
                struct ust_app *app;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ua_sess = ust_app_lookup_app_session(usess, app);
@@ -5719,7 +5719,7 @@ static int destroy_trace(struct ltt_ust_session *usess, struct ust_app *app)
 
        DBG("Destroy tracing for ust app pid %d", app->pid);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (!app->compatible) {
                goto end;
@@ -5788,7 +5788,7 @@ int ust_app_start_trace_all(struct ltt_ust_session *usess)
        (void) ust_app_clear_quiescent_session(usess);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ust_app_global_update(usess, app);
@@ -5817,7 +5817,7 @@ int ust_app_stop_trace_all(struct ltt_ust_session *usess)
        usess->active = false;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ret = ust_app_stop_trace(usess, app);
@@ -5845,7 +5845,7 @@ int ust_app_destroy_trace_all(struct ltt_ust_session *usess)
        DBG("Destroy all UST traces");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ret = destroy_trace(usess, app);
@@ -6007,7 +6007,7 @@ static void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /* Remove all unknown event sources from the app. */
                cds_lfht_for_each_entry (app->token_to_event_notifier_rule_ht->ht,
@@ -6146,7 +6146,7 @@ static void ust_app_synchronize(struct ltt_ust_session *usess, struct ust_app *a
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                ust_app_synchronize_all_channels(usess, locked_ua_sess, app);
 
@@ -6247,7 +6247,7 @@ void ust_app_global_update_all(struct ltt_ust_session *usess)
        struct ust_app *app;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        ust_app_global_update(usess, app);
@@ -6260,7 +6260,7 @@ void ust_app_global_update_all_event_notifier_rules()
        struct lttng_ht_iter iter;
        struct ust_app *app;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                ust_app_global_update_event_notifier_rules(app);
        }
@@ -6283,7 +6283,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
        LTTNG_ASSERT(usess->active);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        if (!app->compatible) {
                                /*
@@ -6453,7 +6453,7 @@ static int handle_app_register_channel_notification(int sock,
                lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::memory::free>(
                        raw_context_fields);
 
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        /* Lookup application. If not found, there is a code flow error. */
        app = find_app_by_notify_sock(sock);
@@ -6622,7 +6622,7 @@ static int add_event_ust_registry(int sock,
        struct ust_app *app;
        struct ust_app_channel *ua_chan;
        struct ust_app_session *ua_sess;
-       lttng::urcu::read_lock_guard rcu_lock;
+       const lttng::urcu::read_lock_guard rcu_lock;
        auto signature = lttng::make_unique_wrapper<char, lttng::memory::free>(raw_signature);
        auto fields =
                lttng::make_unique_wrapper<lttng_ust_ctl_field, lttng::memory::free>(raw_fields);
@@ -6747,7 +6747,7 @@ static int add_enum_ust_registry(int sock,
        struct ust_app *app;
        struct ust_app_session *ua_sess;
        uint64_t enum_id = -1ULL;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
        auto entries =
                lttng::make_unique_wrapper<struct lttng_ust_ctl_enum_entry, lttng::memory::free>(
                        raw_entries);
@@ -6884,7 +6884,7 @@ int ust_app_recv_notify(int sock)
                }
 
                {
-                       lttng::urcu::read_lock_guard rcu_lock;
+                       const lttng::urcu::read_lock_guard rcu_lock;
                        const struct ust_app *app = find_app_by_notify_sock(sock);
                        if (!app) {
                                DBG("Application socket %d is being torn down. Abort event notify",
@@ -7019,7 +7019,7 @@ void ust_app_notify_sock_unregister(int sock)
 
        LTTNG_ASSERT(sock >= 0);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        obj = zmalloc<ust_app_notify_sock_obj>();
        if (!obj) {
@@ -7109,7 +7109,7 @@ enum lttng_error_code ust_app_snapshot_record(const struct ltt_ust_session *uses
        {
                struct buffer_reg_uid *reg;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
@@ -7178,7 +7178,7 @@ enum lttng_error_code ust_app_snapshot_record(const struct ltt_ust_session *uses
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
@@ -7289,7 +7289,7 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_sessio
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
 
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        cds_lfht_for_each_entry (
                                reg->registry->channels->ht, &iter.iter, buf_reg_chan, node.node) {
@@ -7307,7 +7307,7 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(const struct ltt_ust_sessio
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct ust_app_channel *ua_chan;
@@ -7396,7 +7396,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
         * Iterate over every registered applications. Sum counters for
         * all applications containing requested session and channel.
         */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                struct lttng_ht_iter uiter;
@@ -7444,7 +7444,7 @@ static int ust_app_regenerate_statedump(struct ltt_ust_session *usess, struct us
 
        DBG("Regenerating the metadata for ust app pid %d", app->pid);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        const auto update_health_code_on_exit =
                lttng::make_scope_exit([]() noexcept { health_code_update(); });
 
@@ -7476,7 +7476,7 @@ int ust_app_regenerate_statedump_all(struct ltt_ust_session *usess)
 
        DBG("Regenerating the metadata for all UST apps");
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                if (!app->compatible) {
@@ -7515,7 +7515,7 @@ enum lttng_error_code ust_app_rotate_session(const ltt_session::locked_ref& sess
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        /* Get consumer socket to use to push the metadata.*/
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
@@ -7569,7 +7569,7 @@ enum lttng_error_code ust_app_rotate_session(const ltt_session::locked_ref& sess
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                ust_app *raw_app;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, raw_app, pid_n.node) {
@@ -7664,7 +7664,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories(const struct ltt_ust
        case LTTNG_BUFFER_PER_UID:
        {
                struct buffer_reg_uid *reg;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        fmt_ret = asprintf(&pathname_index,
@@ -7695,7 +7695,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories(const struct ltt_ust
        case LTTNG_BUFFER_PER_PID:
        {
                struct ust_app *app;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                /*
                 * Create the toplevel ust/ directory in case no apps are running.
@@ -7779,7 +7779,7 @@ enum lttng_error_code ust_app_clear_session(const ltt_session::locked_ref& sessi
        case LTTNG_BUFFER_PER_UID:
        {
                struct buffer_reg_uid *reg;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
@@ -7821,7 +7821,7 @@ enum lttng_error_code ust_app_clear_session(const ltt_session::locked_ref& sessi
        }
        case LTTNG_BUFFER_PER_PID:
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
@@ -7938,7 +7938,7 @@ enum lttng_error_code ust_app_open_packets(const ltt_session::locked_ref& sessio
                cds_list_for_each_entry (reg, &usess->buffer_reg_uid_list, lnode) {
                        struct buffer_reg_channel *buf_reg_chan;
                        struct consumer_socket *socket;
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
 
                        socket = consumer_find_socket_by_bitness(reg->bits_per_long,
                                                                 usess->consumer);
@@ -7963,7 +7963,7 @@ enum lttng_error_code ust_app_open_packets(const ltt_session::locked_ref& sessio
        case LTTNG_BUFFER_PER_PID:
        {
                struct ust_app *app;
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ust_app_ht->ht, &iter.iter, app, pid_n.node) {
                        struct consumer_socket *socket;
index 8bcc246121346b239c651ac66c8a23b8aab926a3..a4de848cb25324547b04a43daaf6311a3c2e93cd 100644 (file)
@@ -462,7 +462,7 @@ int ust_consumer_metadata_request(struct consumer_socket *socket)
 
        LTTNG_ASSERT(socket);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        health_code_update();
 
        /* Wait for a metadata request */
index f4c8f226e09f104b33b7142a16d1b59fe8878425..93e031733944e72765ca6b6b1b8c2a4117b5f6b6 100644 (file)
@@ -381,7 +381,7 @@ void lsu::registry_channel::add_event(int session_objd,
 {
        uint32_t event_id;
        struct cds_lfht_node *nptr;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        /*
         * This should not happen but since it comes from the UST tracer, an
@@ -500,7 +500,7 @@ void lsu::registry_channel::_accept_on_event_classes(
        std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes;
 
        {
-               lttng::urcu::read_lock_guard read_lock_guard;
+               const lttng::urcu::read_lock_guard read_lock_guard;
                struct lttng_ht_iter iter;
                const lttng::sessiond::ust::registry_event *event;
 
index 49dc60d5232090048c781d9f587a25fc79670925..4463e78e9905f5a53414af8c5644f5ad8808e24a 100644 (file)
@@ -28,7 +28,7 @@ lsu::registry_session_per_pid::registry_session_per_pid(const struct ust_app& ap
        _procname{ app.name },
        _app_creation_time{ app.registration_time }
 {
-       lttng::pthread::lock_guard registry_lock(_lock);
+       const lttng::pthread::lock_guard registry_lock(_lock);
        _generate_metadata();
 }
 
index f5e1a93c2630d02bd9c59bea1256b85a3b8af42b..3959d0394c0a953d9d966719a3f4a9aa77300e62 100644 (file)
@@ -22,7 +22,7 @@ lsu::registry_session_per_uid::registry_session_per_uid(const struct lst::abi& i
        registry_session{ in_abi, major, minor, root_shm_path, shm_path, euid, egid, tracing_id },
        _tracing_uid{ tracing_uid }
 {
-       lttng::pthread::lock_guard registry_lock(_lock);
+       const lttng::pthread::lock_guard registry_lock(_lock);
        _generate_metadata();
 }
 
index 860e623cd2ce5efd22aa0e219f6244053fa50157..c6dac671d9ad485beefa496175d179f875d14af4 100644 (file)
@@ -123,7 +123,7 @@ void destroy_channel(lsu::registry_channel *chan, bool notify) noexcept
        }
 
        if (chan->_events) {
-               lttng::urcu::read_lock_guard read_lock_guard;
+               const lttng::urcu::read_lock_guard read_lock_guard;
 
                /* Destroy all event associated with this registry. */
                DIAGNOSTIC_PUSH
@@ -359,7 +359,7 @@ const lst::type *lsu::registry_session::packet_header() const noexcept
 void lsu::registry_session::_destroy_enum(lsu::registry_enum *reg_enum) noexcept
 {
        int ret;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        LTTNG_ASSERT(reg_enum);
        ASSERT_RCU_READ_LOCKED();
@@ -384,7 +384,7 @@ lsu::registry_session::~registry_session()
        LTTNG_ASSERT(!ret);
 
        if (_channels) {
-               lttng::urcu::read_lock_guard read_lock_guard;
+               const lttng::urcu::read_lock_guard read_lock_guard;
 
                /* Destroy all event associated with this registry. */
                DIAGNOSTIC_PUSH
@@ -421,7 +421,7 @@ lsu::registry_session::~registry_session()
 
        /* Destroy the enum hash table */
        if (_enums) {
-               lttng::urcu::read_lock_guard read_lock_guard;
+               const lttng::urcu::read_lock_guard read_lock_guard;
 
                /* Destroy all enum entries associated with this registry. */
                DIAGNOSTIC_PUSH
@@ -444,7 +444,7 @@ lsu::registry_session::locked_ref lsu::registry_session::lock() noexcept
  */
 void lsu::registry_session::add_channel(uint64_t key)
 {
-       lttng::pthread::lock_guard session_lock_guard(_lock);
+       const lttng::pthread::lock_guard session_lock_guard(_lock);
 
        /*
         * Assign a channel ID right now since the event notification comes
@@ -481,14 +481,14 @@ void lsu::registry_session::add_channel(uint64_t key)
                        }
                });
 
-       lttng::urcu::read_lock_guard rcu_read_lock_guard;
+       const lttng::urcu::read_lock_guard rcu_read_lock_guard;
        lttng_ht_node_init_u64(&chan->_node, key);
        lttng_ht_add_unique_u64(_channels.get(), &chan->_node);
 }
 
 lttng::sessiond::ust::registry_channel& lsu::registry_session::channel(uint64_t channel_key) const
 {
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
@@ -512,7 +512,7 @@ void lsu::registry_session::remove_channel(uint64_t channel_key, bool notify)
 {
        struct lttng_ht_iter iter;
        int ret;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
 
        ASSERT_LOCKED(_lock);
        auto& channel_to_remove = channel(channel_key);
@@ -566,7 +566,7 @@ void lsu::registry_session::_accept_on_stream_classes(lst::trace_class_visitor&
        std::vector<const lttng::sessiond::ust::registry_channel *> sorted_stream_classes;
 
        {
-               lttng::urcu::read_lock_guard rcu_lock_guard;
+               const lttng::urcu::read_lock_guard rcu_lock_guard;
                const lsu::registry_channel *channel;
                lttng_ht_iter channel_it;
 
@@ -680,7 +680,7 @@ void lsu::registry_session::_generate_metadata()
 
 void lsu::registry_session::regenerate_metadata()
 {
-       lttng::pthread::lock_guard registry_lock(_lock);
+       const lttng::pthread::lock_guard registry_lock(_lock);
 
        /* Resample the clock */
        _clock = lttng::make_unique<lsu::clock_class>();
@@ -783,7 +783,7 @@ void lsu::registry_session::create_or_find_enum(int session_objd,
 {
        struct cds_lfht_node *nodep;
        lsu::registry_enum *reg_enum = nullptr, *old_reg_enum;
-       lttng::urcu::read_lock_guard read_lock_guard;
+       const lttng::urcu::read_lock_guard read_lock_guard;
        auto entries = lttng::make_unique_wrapper<lttng_ust_ctl_enum_entry, lttng::memory::free>(
                raw_entries);
 
index 54f41f28bd0344fd29c5ad69b5be7e024a8d42cd..fa20cda61bcec86cb10de90e24af2b3de44ec0ed 100644 (file)
@@ -980,7 +980,7 @@ static struct parse_event_rule_res parse_event_rule(int *argc, const char ***arg
                /* Set exclusion list. */
                if (lttng_dynamic_pointer_array_get_count(&exclude_names) > 0) {
                        int n;
-                       int count = lttng_dynamic_pointer_array_get_count(&exclude_names);
+                       const int count = lttng_dynamic_pointer_array_get_count(&exclude_names);
 
                        for (n = 0; n < count; n++) {
                                const char *exclude_name =
@@ -1628,7 +1628,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(
                        }
                } else {
                        const char *arg = argpar_item_non_opt_arg(argpar_item);
-                       unsigned int idx = argpar_item_non_opt_non_opt_index(argpar_item);
+                       const unsigned int idx = argpar_item_non_opt_non_opt_index(argpar_item);
 
                        switch (idx) {
                        case 0:
@@ -2177,7 +2177,8 @@ int cmd_add_trigger(int argc, const char **argv)
                                         nullptr);
                if (status == PARSE_NEXT_ITEM_STATUS_ERROR) {
                        if (argpar_error_type(argpar_error) == ARGPAR_ERROR_TYPE_MISSING_OPT_ARG) {
-                               int opt_id = argpar_error_opt_descr(argpar_error, nullptr)->id;
+                               const int opt_id =
+                                       argpar_error_opt_descr(argpar_error, nullptr)->id;
 
                                if (opt_id == OPT_CONDITION) {
                                        print_valid_condition_names();
index e1756c3d30a30c4449a641e5548391f58da9413e..189d7c2a0c719b4abf726d0c39a39c29cf0edfec 100644 (file)
@@ -523,7 +523,7 @@ static int spawn_sessiond(const char *pathname)
                 */
                for (;;) {
                        int status;
-                       pid_t wait_pid_ret = waitpid(pid, &status, 0);
+                       const pid_t wait_pid_ret = waitpid(pid, &status, 0);
 
                        if (wait_pid_ret < 0) {
                                if (errno == EINTR) {
index ef4b914d38bd39f124debce1dfb31600ba572a50..b39d705276b992329759df938d550037d830b4fe 100644 (file)
@@ -349,7 +349,7 @@ int cmd_destroy(int argc, const char **argv)
        static poptContext pc;
        const char *leftover = nullptr;
        lttng::cli::session_spec spec(lttng::cli::session_spec::type::NAME);
-       lttng::cli::session_list const sessions;
+       const lttng::cli::session_list sessions;
 
        pc = poptGetContext(nullptr, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
index 03e567c86d449c317f91df4fd1dd67de04dc014a..0cedb26421e976d48c2d5ad271056c97b155d4a4 100644 (file)
@@ -250,7 +250,7 @@ static void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *ev
 static void print_event_rule_logging(const struct lttng_event_rule *event_rule)
 {
        enum lttng_event_rule_status event_rule_status;
-       enum lttng_event_rule_type event_rule_type = lttng_event_rule_get_type(event_rule);
+       const lttng_event_rule_type event_rule_type = lttng_event_rule_get_type(event_rule);
        const char *pattern;
        const char *filter;
        int log_level;
index 73940723628b18ba04b410496ddcfd46f04a73ba..d266baa44c3f67cacaa83ce617a52196e4077d4e 100644 (file)
@@ -225,7 +225,7 @@ bool loglevel_parse_range_string(const char *str,
                                 enum lttng_loglevel *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(
+       const bool ret = loglevel_parse_range_string_common(
                str, loglevel_values, ARRAY_SIZE(loglevel_values), &min_int, &max_int);
 
        *min = (lttng_loglevel) min_int;
@@ -252,7 +252,7 @@ bool loglevel_log4j_parse_range_string(const char *str,
                                       enum lttng_loglevel_log4j *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(
+       const bool ret = loglevel_parse_range_string_common(
                str, loglevel_log4j_values, ARRAY_SIZE(loglevel_log4j_values), &min_int, &max_int);
 
        *min = (lttng_loglevel_log4j) min_int;
@@ -279,7 +279,7 @@ bool loglevel_jul_parse_range_string(const char *str,
                                     enum lttng_loglevel_jul *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(
+       const bool ret = loglevel_parse_range_string_common(
                str, loglevel_jul_values, ARRAY_SIZE(loglevel_jul_values), &min_int, &max_int);
 
        *min = (lttng_loglevel_jul) min_int;
@@ -306,11 +306,11 @@ bool loglevel_python_parse_range_string(const char *str,
                                        enum lttng_loglevel_python *max)
 {
        int min_int, max_int;
-       bool ret = loglevel_parse_range_string_common(str,
-                                                     loglevel_python_values,
-                                                     ARRAY_SIZE(loglevel_python_values),
-                                                     &min_int,
-                                                     &max_int);
+       const bool ret = loglevel_parse_range_string_common(str,
+                                                           loglevel_python_values,
+                                                           ARRAY_SIZE(loglevel_python_values),
+                                                           &min_int,
+                                                           &max_int);
 
        *min = (lttng_loglevel_python) min_int;
        *max = (lttng_loglevel_python) max_int;
index 45fe256a579d092b4a1d92ddd81e26459b315a1e..6622d1aa8805dd54099cef6eaa5d1fe6d544b9fb 100644 (file)
@@ -758,36 +758,36 @@ void print_kernel_tracer_status_error()
                case LTTNG_KERNEL_TRACER_STATUS_INITIALIZED:
                        return;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_UNKNOWN:
-                       std::cerr << "\tKernel module loading failed" << std::endl;
+                       std::cerr << "\tKernel module loading failed" << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_MISSING:
-                       std::cerr << "\tMissing one or more required kernel modules" << std::endl;
+                       std::cerr << "\tMissing one or more required kernel modules" << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_MODULES_SIGNATURE:
                        std::cerr
                                << "\tKernel module signature error prevented loading of one or more required kernel modules"
-                               << std::endl;
+                               << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_NEED_ROOT:
-                       std::cerr << "\tlttng-sessiond isn't running as root" << std::endl;
+                       std::cerr << "\tlttng-sessiond isn't running as root" << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_NOTIFIER:
-                       std::cerr << "\tFailed to setup notifiers" << std::endl;
+                       std::cerr << "\tFailed to setup notifiers" << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_OPEN_PROC_LTTNG:
-                       std::cerr << "\tlttng-sessiond failed to open /proc/lttng" << std::endl;
+                       std::cerr << "\tlttng-sessiond failed to open /proc/lttng" << '\n';
                        break;
                case LTTNG_KERNEL_TRACER_STATUS_ERR_VERSION_MISMATCH:
                        std::cerr << "\tVersion mismatch between kernel tracer and kernel tracer ABI"
-                                 << std::endl;
+                                 << '\n';
                        break;
                default:
                        std::cerr << lttng::format("\t\tUnknown kernel tracer status (%d)",
                                                   static_cast<int>(kernel_tracer_status))
-                                 << std::endl;
+                                 << '\n';
                        break;
                }
 
-               std::cerr << "\tConsult lttng-sessiond logs for more information" << std::endl;
+               std::cerr << "\tConsult lttng-sessiond logs for more information" << '\n';
        }
 }
index 7c8934778a5b478ac1252d937a61f44151e577ea..27e08c7ee4f62faf5ee4cf960147e60a2c414972 100644 (file)
@@ -74,7 +74,7 @@ static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_err
        {
                bool is_short;
                const struct argpar_opt_descr *descr = argpar_error_opt_descr(error, &is_short);
-               int orig_index = argpar_error_orig_index(error);
+               const int orig_index = argpar_error_orig_index(error);
                const char *arg = argv[orig_index];
 
                if (is_short) {
@@ -101,7 +101,7 @@ static ATTR_FORMAT_PRINTF(4, 0) char *format_arg_error_v(const struct argpar_err
        }
        case ARGPAR_ERROR_TYPE_UNKNOWN_OPT:
        {
-               int orig_index = argpar_error_orig_index(error);
+               const int orig_index = argpar_error_orig_index(error);
                const char *unknown_opt = argpar_error_unknown_opt_name(error);
 
                ret = strutils_appendf(&str,
index 00b4f5e7bca300cb6d513b38a7c640b016978cc1..e66f03bd31b197e864c869e4d0e9e980536cc8f5 100644 (file)
@@ -40,10 +40,10 @@ int bytecode_init(struct lttng_bytecode_alloc **fb)
 static int32_t bytecode_reserve(struct lttng_bytecode_alloc **fb, uint32_t align, uint32_t len)
 {
        int32_t ret;
-       uint32_t padding = lttng_offset_align((*fb)->b.len, align);
-       uint32_t new_len = (*fb)->b.len + padding + len;
+       const uint32_t padding = lttng_offset_align((*fb)->b.len, align);
+       const uint32_t new_len = (*fb)->b.len + padding + len;
        uint32_t new_alloc_len = sizeof(struct lttng_bytecode_alloc) + new_len;
-       uint32_t old_alloc_len = (*fb)->alloc_len;
+       const uint32_t old_alloc_len = (*fb)->alloc_len;
 
        if (new_len > LTTNG_FILTER_MAX_LEN)
                return -EINVAL;
index 157e9d4c24e0abd0b656d564d9623a2bad9f2f7f..afa6c9f09f2ac0ded8a7a6ab722580b5d424d59a 100644 (file)
@@ -318,7 +318,7 @@ static DIR *lttng_directory_handle_opendir(const struct lttng_directory_handle *
                                           const char *path)
 {
        DIR *dir_stream = nullptr;
-       int fd = openat(handle->dirfd, path, O_RDONLY);
+       const int fd = openat(handle->dirfd, path, O_RDONLY);
 
        if (fd < 0) {
                goto end;
@@ -343,7 +343,7 @@ end:
 static int lttng_directory_handle_rmdir(const struct lttng_directory_handle *handle,
                                        const char *name)
 {
-       int ret = unlinkat(handle->dirfd, name, AT_REMOVEDIR);
+       const int ret = unlinkat(handle->dirfd, name, AT_REMOVEDIR);
        if (ret) {
                PERROR("Failed to remove directory `%s`", name);
        }
index c78528735063cb261a0f4830fb023131397cd496..692d605c963abc3986579355b9d894259d61ce80 100644 (file)
@@ -22,7 +22,7 @@
 
 static bool is_usage_evaluation(const struct lttng_evaluation *evaluation)
 {
-       enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
+       const lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW ||
                type == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH;
index d86d2ad7b048b036133f8e9ee8f66049287de5f6..91012f475cc97fc7fea324fbd4198c9adce7ffa3 100644 (file)
@@ -30,7 +30,7 @@
 
 static bool is_event_rule_matches_evaluation(const struct lttng_evaluation *evaluation)
 {
-       enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
+       const lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES;
 }
index 1e9cb4379a428609e5e6de5e72d68350a8e9dc25..b6f2bbfa5b6011f08e82883a6d9fdfde19298cf8 100644 (file)
@@ -212,7 +212,7 @@ static ssize_t init_condition_from_payload(struct lttng_condition *condition,
        const char *session_name;
        struct lttng_buffer_view session_name_view;
        const struct lttng_condition_session_consumed_size_comm *condition_comm;
-       struct lttng_payload_view condition_comm_view =
+       const lttng_payload_view condition_comm_view =
                lttng_payload_view_from_view(src_view, 0, sizeof(*condition_comm));
 
        if (!lttng_payload_view_is_valid(&condition_comm_view)) {
index 20af727cf8ff29feea0d6023208c0141b45dc70f..45e360996bf5cec1619d84fe795af34e05b8eefe 100644 (file)
@@ -48,7 +48,7 @@ static const struct lttng_evaluation rotation_evaluation_template = {
 
 static bool is_rotation_condition(const struct lttng_condition *condition)
 {
-       enum lttng_condition_type type = lttng_condition_get_type(condition);
+       const lttng_condition_type type = lttng_condition_get_type(condition);
 
        return type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING ||
                type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
@@ -56,7 +56,7 @@ static bool is_rotation_condition(const struct lttng_condition *condition)
 
 static bool is_rotation_evaluation(const struct lttng_evaluation *evaluation)
 {
-       enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
+       const lttng_condition_type type = lttng_evaluation_get_type(evaluation);
 
        return type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING ||
                type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED;
@@ -187,7 +187,7 @@ static ssize_t init_condition_from_payload(struct lttng_condition *condition,
        const char *session_name;
        struct lttng_buffer_view name_view;
        const struct lttng_condition_session_rotation_comm *condition_comm;
-       struct lttng_payload_view condition_comm_view =
+       const lttng_payload_view condition_comm_view =
                lttng_payload_view_from_view(src_view, 0, sizeof(*condition_comm));
 
        if (!lttng_payload_view_is_valid(&condition_comm_view)) {
@@ -318,7 +318,8 @@ static ssize_t create_evaluation_from_payload(enum lttng_condition_type type,
        struct lttng_evaluation *evaluation = nullptr;
        struct lttng_trace_archive_location *location = nullptr;
        const struct lttng_evaluation_session_rotation_comm *comm;
-       struct lttng_payload_view comm_view = lttng_payload_view_from_view(view, 0, sizeof(*comm));
+       const lttng_payload_view comm_view =
+               lttng_payload_view_from_view(view, 0, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
                goto error;
index 0742c865296bad5754c074afb88a6ef08eea8a20..e65592055518cbb028aeea78fde576da59c62c0f 100644 (file)
@@ -373,7 +373,7 @@ int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx, uint64_
        /* Ease our life a bit. */
        ht = the_consumer_data.stream_list_ht;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Search the metadata associated with the session id of the given stream. */
 
@@ -643,7 +643,7 @@ struct lttng_consumer_stream *consumer_stream_create(struct lttng_consumer_chann
 {
        int ret;
        struct lttng_consumer_stream *stream;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        stream = zmalloc<lttng_consumer_stream>();
        if (stream == nullptr) {
@@ -851,7 +851,7 @@ void consumer_stream_close_output(struct lttng_consumer_stream *stream)
        stream->trace_chunk = nullptr;
 
        /* Check and cleanup relayd if needed. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        relayd = consumer_find_relayd(stream->net_seq_idx);
        if (relayd != nullptr) {
                consumer_stream_relayd_close(stream, relayd);
@@ -874,7 +874,7 @@ void consumer_stream_delete(struct lttng_consumer_stream *stream, struct lttng_h
        /* Should NEVER be called not in monitor mode. */
        LTTNG_ASSERT(stream->chan->monitor);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (ht) {
                iter.iter.node = &stream->node.node;
@@ -1093,7 +1093,7 @@ int consumer_stream_write_index(struct lttng_consumer_stream *stream,
        LTTNG_ASSERT(stream);
        LTTNG_ASSERT(element);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
                struct consumer_relayd_sock_pair *relayd;
                relayd = consumer_find_relayd(stream->net_seq_idx);
index 70094ef4f98e30c5da46e9c8b087e3bd5dfdd7da..c4c45e8a19eb54fb8a219dd6e1e1f037496df037 100644 (file)
@@ -284,7 +284,7 @@ static void live_timer(struct lttng_consumer_local_data *ctx, siginfo_t *si)
        DBG("Live timer for channel %" PRIu64, channel->key);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry_duplicate(ht->ht,
                                                  ht->hash_fct(&channel->key, lttng_ht_seed),
                                                  ht->match_fct,
@@ -576,7 +576,7 @@ static int sample_channel_positions(struct lttng_consumer_channel *channel,
 
        *_total_consumed = 0;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        cds_lfht_for_each_entry_duplicate(ht->ht,
                                          ht->hash_fct(&channel->key, lttng_ht_seed),
@@ -644,7 +644,7 @@ end:
 void sample_and_send_channel_buffer_stats(struct lttng_consumer_channel *channel)
 {
        int ret;
-       int channel_monitor_pipe = consumer_timer_thread_get_channel_monitor_pipe();
+       const int channel_monitor_pipe = consumer_timer_thread_get_channel_monitor_pipe();
        struct lttcomm_consumer_channel_monitor_msg msg = {
                .key = channel->key,
                .session_id = channel->session_id,
index ed25a42ea8724b33afbc1651efd760b29d9af876..295ea2726e3c54e2991705cf3f90770652ebd082 100644 (file)
@@ -199,7 +199,7 @@ static struct lttng_consumer_stream *find_stream(uint64_t key, struct lttng_ht *
                return nullptr;
        }
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        lttng_ht_lookup(ht, &key, &iter);
        node = lttng_ht_iter_get_node<lttng_ht_node_u64>(&iter);
@@ -214,7 +214,7 @@ static void steal_stream_key(uint64_t key, struct lttng_ht *ht)
 {
        struct lttng_consumer_stream *stream;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        stream = find_stream(key, ht);
        if (stream) {
                stream->key = (uint64_t) -1ULL;
@@ -267,7 +267,7 @@ static void steal_channel_key(uint64_t key)
 {
        struct lttng_consumer_channel *channel;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        channel = consumer_find_channel(key);
        if (channel) {
                channel->key = (uint64_t) -1ULL;
@@ -398,7 +398,7 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
        if (channel->is_published) {
                int ret;
 
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                iter.iter.node = &channel->node.node;
                ret = lttng_ht_del(the_consumer_data.channel_ht, &iter);
                LTTNG_ASSERT(!ret);
@@ -425,7 +425,7 @@ static void cleanup_relayd_ht()
        struct consumer_relayd_sock_pair *relayd;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_consumer_data.relayd_ht->ht, &iter.iter, relayd, node.node) {
@@ -451,7 +451,7 @@ static void update_endpoint_status_by_netidx(uint64_t net_seq_idx,
 
        DBG("Consumer set delete flag on stream by idx %" PRIu64, net_seq_idx);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Let's begin with metadata */
        cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
@@ -576,7 +576,7 @@ void consumer_add_data_stream(struct lttng_consumer_stream *stream)
        pthread_mutex_lock(&stream->chan->lock);
        pthread_mutex_lock(&stream->chan->timer_lock);
        pthread_mutex_lock(&stream->lock);
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Steal stream identifier to avoid having streams with the same key */
        steal_stream_key(stream->key, ht);
@@ -621,7 +621,7 @@ void consumer_add_data_stream(struct lttng_consumer_stream *stream)
  */
 static int add_relayd(struct consumer_relayd_sock_pair *relayd)
 {
-       int ret = 0;
+       const int ret = 0;
        struct lttng_ht_node_u64 *node;
        struct lttng_ht_iter iter;
 
@@ -714,7 +714,7 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream, char *path
        LTTNG_ASSERT(path);
 
        /* The stream is not metadata. Get relayd reference if exists. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        relayd = consumer_find_relayd(stream->net_seq_idx);
        if (relayd != nullptr) {
                /* Add stream on the relayd */
@@ -767,7 +767,7 @@ int consumer_send_relayd_streams_sent(uint64_t net_seq_idx)
        LTTNG_ASSERT(net_seq_idx != -1ULL);
 
        /* The stream is not metadata. Get relayd reference if exists. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        relayd = consumer_find_relayd(net_seq_idx);
        if (relayd != nullptr) {
                /* Add stream on the relayd */
@@ -801,7 +801,7 @@ void close_relayd_stream(struct lttng_consumer_stream *stream)
        struct consumer_relayd_sock_pair *relayd;
 
        /* The stream is not metadata. Get relayd reference if exists. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        relayd = consumer_find_relayd(stream->net_seq_idx);
        if (relayd) {
                consumer_stream_relayd_close(stream, relayd);
@@ -1032,8 +1032,8 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        channel->monitor = monitor;
        channel->live_timer_interval = live_timer_interval;
        channel->is_live = is_in_live_session;
-       pthread_mutex_init(&channel->lock, NULL);
-       pthread_mutex_init(&channel->timer_lock, NULL);
+       pthread_mutex_init(&channel->lock, nullptr);
+       pthread_mutex_init(&channel->timer_lock, nullptr);
 
        switch (output) {
        case LTTNG_EVENT_SPLICE:
@@ -1084,7 +1084,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
        CDS_INIT_LIST_HEAD(&channel->streams.head);
 
        if (trace_chunk) {
-               int ret = lttng_consumer_channel_set_trace_chunk(channel, trace_chunk);
+               const int ret = lttng_consumer_channel_set_trace_chunk(channel, trace_chunk);
                if (ret) {
                        goto error;
                }
@@ -1120,7 +1120,7 @@ int consumer_add_channel(struct lttng_consumer_channel *channel,
         */
        steal_channel_key(channel->key);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        lttng_ht_add_unique_u64(the_consumer_data.channel_ht, &channel->node);
        lttng_ht_add_u64(the_consumer_data.channels_by_session_id_ht,
                         &channel->channels_by_session_id_ht_node);
@@ -1163,7 +1163,7 @@ static int update_poll_array(struct lttng_consumer_local_data *ctx,
        *nb_inactive_fd = 0;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                        /*
                         * Only active streams with an active end point can be added to the
@@ -1276,7 +1276,7 @@ void lttng_consumer_cleanup()
        unsigned int trace_chunks_left;
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        the_consumer_data.channel_ht->ht, &iter.iter, channel, node.node) {
@@ -1343,7 +1343,7 @@ void lttng_consumer_should_exit(struct lttng_consumer_local_data *ctx)
  */
 static void lttng_consumer_sync_trace_file(struct lttng_consumer_stream *stream, off_t orig_offset)
 {
-       int outfd = stream->out_fd;
+       const int outfd = stream->out_fd;
 
        /*
         * This does a blocking write-and-wait on any page that belongs to the
@@ -1461,7 +1461,7 @@ static void destroy_data_stream_ht(struct lttng_ht *ht)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                        /*
                         * Ignore return value since we are currently cleaning up so any error
@@ -1488,7 +1488,7 @@ static void destroy_metadata_stream_ht(struct lttng_ht *ht)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (ht->ht, &iter.iter, stream, node.node) {
                        /*
                         * Ignore return value since we are currently cleaning up so any error
@@ -1598,7 +1598,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(struct lttng_consumer_stream *stre
        size_t write_len;
 
        /* RCU lock for the relayd pointer */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        LTTNG_ASSERT(stream->net_seq_idx != (uint64_t) -1ULL || stream->trace_chunk);
 
        /* Flag that the current stream if set for network streaming. */
@@ -1755,7 +1755,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
        ssize_t ret = 0, written = 0, ret_splice = 0;
        loff_t offset = 0;
        off_t orig_offset = stream->out_fd_offset;
-       int fd = stream->wait_fd;
+       const int fd = stream->wait_fd;
        /* Default is on the disk */
        int outfd = stream->out_fd;
        struct consumer_relayd_sock_pair *relayd = nullptr;
@@ -1775,7 +1775,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
        }
 
        /* RCU lock for the relayd pointer */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /* Flag that the current stream if set for network streaming. */
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
@@ -1872,7 +1872,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(struct lttng_consumer_local_data
 
                /* Handle stream on the relayd if the output is on the network */
                if (relayd && stream->metadata_flag) {
-                       size_t metadata_payload_size =
+                       const size_t metadata_payload_size =
                                sizeof(struct lttcomm_relayd_metadata_payload);
 
                        /* Update counter to fit the spliced data */
@@ -2178,7 +2178,7 @@ void consumer_add_metadata_stream(struct lttng_consumer_stream *stream)
         * after this point.
         */
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * Lookup the stream just to make sure it does not exist in our internal
@@ -2229,7 +2229,7 @@ static void validate_endpoint_status_data_stream()
        DBG("Consumer delete flagged data stream");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (data_ht->ht, &iter.iter, stream, node.node) {
                        /* Validate delete flag of the stream */
@@ -2255,7 +2255,7 @@ static void validate_endpoint_status_metadata_stream(struct lttng_poll_event *po
        LTTNG_ASSERT(pollset);
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
                        /* Validate delete flag of the stream */
                        if (stream->endpoint_status == CONSUMER_ENDPOINT_ACTIVE) {
@@ -2405,7 +2405,7 @@ void *consumer_thread_metadata_poll(void *data)
                                continue;
                        }
 
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        {
                                uint64_t tmp_id = (uint64_t) pollfd;
 
@@ -2806,7 +2806,7 @@ static void consumer_close_channel_streams(struct lttng_consumer_channel *channe
 
        ht = the_consumer_data.stream_per_chan_id_ht;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_for_each_entry_duplicate(ht->ht,
                                          ht->hash_fct(&channel->key, lttng_ht_seed),
                                          ht->match_fct,
@@ -2859,7 +2859,7 @@ static void destroy_channel_ht(struct lttng_ht *ht)
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (ht->ht, &iter.iter, channel, wait_fd_node.node) {
                        ret = lttng_ht_del(ht, &iter);
@@ -2972,7 +2972,7 @@ void *consumer_thread_channel_poll(void *data)
 
                                                lttng_ht_node_init_u64(&chan->wait_fd_node,
                                                                       chan->wait_fd);
-                                               lttng::urcu::read_lock_guard read_lock;
+                                               const lttng::urcu::read_lock_guard read_lock;
                                                lttng_ht_add_unique_u64(channel_ht,
                                                                        &chan->wait_fd_node);
                                                /* Add channel to the global poll events list */
@@ -2993,7 +2993,7 @@ void *consumer_thread_channel_poll(void *data)
                                                 * GET_CHANNEL failed.
                                                 */
 
-                                               lttng::urcu::read_lock_guard read_lock;
+                                               const lttng::urcu::read_lock_guard read_lock;
                                                chan = consumer_find_channel(key);
                                                if (!chan) {
                                                        ERR("UST consumer get channel key %" PRIu64
@@ -3061,7 +3061,7 @@ void *consumer_thread_channel_poll(void *data)
                                continue;
                        }
 
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        {
                                uint64_t tmp_id = (uint64_t) pollfd;
 
@@ -3739,7 +3739,7 @@ int consumer_data_pending(uint64_t id)
 
        DBG("Consumer data pending command on session id %" PRIu64, id);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        pthread_mutex_lock(&the_consumer_data.lock);
 
        switch (the_consumer_data.type) {
@@ -3984,7 +3984,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                 nullptr);
        lttng_dynamic_pointer_array_init(&streams_packet_to_open, nullptr);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        pthread_mutex_lock(&channel->lock);
        LTTNG_ASSERT(channel->trace_chunk);
@@ -4422,7 +4422,7 @@ static int consumer_clear_unmonitored_channel(struct lttng_consumer_channel *cha
        int ret;
        struct lttng_consumer_stream *stream;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        pthread_mutex_lock(&channel->lock);
        cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                health_code_update();
@@ -4634,7 +4634,7 @@ int lttng_consumer_rotate_ready_streams(struct lttng_consumer_channel *channel,
 
        ASSERT_RCU_READ_LOCKED();
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        DBG("Consumer rotate ready streams in channel %" PRIu64, key);
 
@@ -4798,7 +4798,7 @@ lttng_consumer_create_trace_chunk(const uint64_t *relayd_id,
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry_duplicate(
                        the_consumer_data.channels_by_session_id_ht->ht,
                        the_consumer_data.channels_by_session_id_ht->hash_fct(&session_id,
@@ -4954,7 +4954,7 @@ lttng_consumer_close_trace_chunk(const uint64_t *relayd_id,
         * current chunk found in the session's channels.
         */
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_lfht_for_each_entry (
                        the_consumer_data.channel_ht->ht, &iter.iter, channel, node.node) {
                        int ret;
@@ -5019,7 +5019,7 @@ lttng_consumer_trace_chunk_exists(const uint64_t *relayd_id, uint64_t session_id
        const bool is_local_trace = !relayd_id;
        struct consumer_relayd_sock_pair *relayd = nullptr;
        bool chunk_exists_local, chunk_exists_remote;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (relayd_id) {
                /* Only used for logging purposes. */
@@ -5086,7 +5086,7 @@ static int consumer_clear_monitored_channel(struct lttng_consumer_channel *chann
 
        ht = the_consumer_data.stream_per_chan_id_ht;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_for_each_entry_duplicate(ht->ht,
                                          ht->hash_fct(&channel->key, lttng_ht_seed),
                                          ht->match_fct,
@@ -5154,7 +5154,7 @@ enum lttcomm_return_code lttng_consumer_open_channel_packets(struct lttng_consum
        }
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
                cds_list_for_each_entry (stream, &channel->streams.head, send_node) {
                        enum consumer_stream_open_packet_status status;
 
index b64e9676ad3e9eb3d01428ce8a9731eb73333feb..1fbb5e6cd1c7ec0c529174d38816755fe24f6486 100644 (file)
@@ -132,7 +132,7 @@ int lttng_dynamic_buffer_set_capacity(struct lttng_dynamic_buffer *buffer, size_
 {
        int ret = 0;
        void *new_buf;
-       size_t new_capacity = demanded_capacity ? round_to_power_of_2(demanded_capacity) : 0;
+       const size_t new_capacity = demanded_capacity ? round_to_power_of_2(demanded_capacity) : 0;
 
        if (!buffer || demanded_capacity < buffer->size) {
                /*
index 2410d9b1c876a2a7aeb2bf0d478755bdc3e22946..4b5f27e5731ffcf1ff18c9da147c27c5a2c68078 100644 (file)
@@ -452,7 +452,7 @@ ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *
 {
        ssize_t used_size = 0;
        struct lttng_error_query_result_comm *header;
-       struct lttng_payload_view header_view =
+       const lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
        const char *name;
        const char *description;
@@ -466,7 +466,7 @@ ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *
        used_size += sizeof(*header);
 
        {
-               struct lttng_payload_view name_view =
+               const lttng_payload_view name_view =
                        lttng_payload_view_from_view(view, used_size, header->name_len);
 
                if (!lttng_payload_view_is_valid(&name_view) ||
@@ -481,7 +481,7 @@ ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *
        }
 
        {
-               struct lttng_payload_view description_view =
+               const lttng_payload_view description_view =
                        lttng_payload_view_from_view(view, used_size, header->description_len);
 
                if (!lttng_payload_view_is_valid(&description_view) ||
@@ -500,7 +500,7 @@ ssize_t lttng_error_query_result_create_from_payload(struct lttng_payload_view *
        case LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER:
        {
                struct lttng_error_query_result_counter_comm *counter;
-               struct lttng_payload_view counter_payload_view =
+               const lttng_payload_view counter_payload_view =
                        lttng_payload_view_from_view(view, used_size, sizeof(*counter));
 
                if (!lttng_payload_view_is_valid(&counter_payload_view)) {
@@ -567,7 +567,7 @@ ssize_t lttng_error_query_results_create_from_payload(struct lttng_payload_view
        size_t result_index;
        ssize_t total_used_size = 0;
        struct lttng_error_query_results_comm *header;
-       struct lttng_payload_view header_view =
+       const lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
        struct lttng_error_query_results *results = nullptr;
 
@@ -778,7 +778,7 @@ ssize_t lttng_error_query_create_from_payload(struct lttng_payload_view *view,
        ssize_t used_size = 0;
        struct lttng_error_query_comm *header;
        struct lttng_trigger *trigger = nullptr;
-       struct lttng_payload_view header_view =
+       const lttng_payload_view header_view =
                lttng_payload_view_from_view(view, 0, sizeof(*header));
 
        if (!lttng_payload_view_is_valid(&header_view)) {
index 150e1c3f91f950ff02f9d75c2e5aa0e0a8b9bbdc..25c366f4651bd87295cba8ff5acd9a765eb8e6b8 100644 (file)
@@ -52,7 +52,7 @@ ssize_t lttng_evaluation_create_from_payload(const struct lttng_condition *condi
 {
        ssize_t ret, evaluation_size = 0;
        const struct lttng_evaluation_comm *evaluation_comm;
-       struct lttng_payload_view evaluation_comm_view =
+       const lttng_payload_view evaluation_comm_view =
                lttng_payload_view_from_view(src_view, 0, sizeof(*evaluation_comm));
        struct lttng_payload_view evaluation_view =
                lttng_payload_view_from_view(src_view, sizeof(*evaluation_comm), -1);
index 3e862b2464cd54e35ea4569b9103fc27971c2011..197d4b011d4c63ab829679c0253f6634059395a2 100644 (file)
@@ -283,7 +283,7 @@ struct lttng_event *lttng_event_rule_generate_lttng_event(const struct lttng_eve
 bool lttng_event_rule_targets_agent_domain(const struct lttng_event_rule *rule)
 {
        bool targets_agent_domain = false;
-       enum lttng_domain_type type = lttng_event_rule_get_domain_type(rule);
+       const lttng_domain_type type = lttng_event_rule_get_domain_type(rule);
 
        switch (type) {
        case LTTNG_DOMAIN_JUL:
index bae7bdfa78380ac0e224cffae54ca77aee58d4a0..badfa4e79e0e9108bffda3197e4a7aa96be73615 100644 (file)
@@ -339,7 +339,7 @@ ssize_t lttng_event_rule_kernel_kprobe_create_from_payload(struct lttng_payload_
 
        {
                /* Map the name. */
-               struct lttng_payload_view current_payload_view =
+               const lttng_payload_view current_payload_view =
                        lttng_payload_view_from_view(view, offset, kprobe_comm->name_len);
 
                if (!lttng_payload_view_is_valid(&current_payload_view)) {
index a6d48eaf7f80e2001226aba7467394e34793183b..e4b41b729f73332e84f81ad5eb96d118df92a58f 100644 (file)
@@ -142,7 +142,7 @@ lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
        ssize_t ret, offset = 0;
        const struct lttng_event_probe_attr_comm *comm;
        struct lttng_event_probe_attr *local_attr = nullptr;
-       struct lttng_payload_view comm_view =
+       const lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
@@ -164,7 +164,7 @@ lttng_event_probe_attr_create_from_payload(struct lttng_payload_view *view,
 
        {
                const char *name;
-               struct lttng_payload_view name_view =
+               const lttng_payload_view name_view =
                        lttng_payload_view_from_view(view, offset, comm->symbol_name_len);
 
                if (!lttng_payload_view_is_valid(&name_view)) {
@@ -204,7 +204,7 @@ lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
        ssize_t ret, offset = 0;
        const struct lttng_event_function_attr_comm *comm;
        struct lttng_event_function_attr *local_attr = nullptr;
-       struct lttng_payload_view comm_view =
+       const lttng_payload_view comm_view =
                lttng_payload_view_from_view(view, offset, sizeof(*comm));
 
        if (!lttng_payload_view_is_valid(&comm_view)) {
@@ -223,7 +223,7 @@ lttng_event_function_attr_create_from_payload(struct lttng_payload_view *view,
 
        {
                const char *name;
-               struct lttng_payload_view name_view =
+               const lttng_payload_view name_view =
                        lttng_payload_view_from_view(view, offset, comm->symbol_name_len);
 
                if (!lttng_payload_view_is_valid(&name_view)) {
@@ -346,7 +346,7 @@ ssize_t lttng_event_create_from_payload(struct lttng_payload_view *view,
        assert(view);
 
        {
-               struct lttng_payload_view comm_view =
+               const lttng_payload_view comm_view =
                        lttng_payload_view_from_view(view, offset, sizeof(*event_comm));
 
                if (!lttng_payload_view_is_valid(&comm_view)) {
@@ -441,7 +441,7 @@ deserialize_filter_expression:
 
        {
                const char *filter_expression_buffer;
-               struct lttng_buffer_view filter_expression_view = lttng_buffer_view_from_view(
+               const lttng_buffer_view filter_expression_view = lttng_buffer_view_from_view(
                        &view->buffer, offset, event_comm->filter_expression_len);
 
                if (!lttng_buffer_view_is_valid(&filter_expression_view)) {
@@ -480,7 +480,7 @@ deserialize_filter_expression:
 
        /* Bytecode */
        {
-               struct lttng_payload_view bytecode_view =
+               const lttng_payload_view bytecode_view =
                        lttng_payload_view_from_view(view, offset, event_comm->bytecode_len);
 
                if (!lttng_payload_view_is_valid(&bytecode_view)) {
@@ -1019,7 +1019,7 @@ ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
        ssize_t ret, offset = 0;
        const struct lttng_event_context_comm *comm;
        struct lttng_event_context *local_context = nullptr;
-       struct lttng_buffer_view comm_view =
+       const lttng_buffer_view comm_view =
                lttng_buffer_view_from_view(&view->buffer, offset, sizeof(*comm));
 
        assert(event_ctx);
@@ -1042,7 +1042,7 @@ ssize_t lttng_event_context_create_from_payload(struct lttng_payload_view *view,
        local_context->ctx = (lttng_event_context_type) comm->type;
 
        {
-               struct lttng_payload_view subtype_view =
+               const lttng_payload_view subtype_view =
                        lttng_payload_view_from_view(view, offset, -1);
 
                switch (local_context->ctx) {
index 7f4c2b5b2b698f81116570d94380720c7ceda7c6..1db2c4245af8184ce681e6d53b62344fc1ec2a7f 100644 (file)
@@ -427,7 +427,7 @@ void fd_tracker_log(struct fd_tracker *tracker)
        DBG_NO_LOC("  Tracked unsuspendable file descriptors");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        tracker->unsuspendable_fds, &iter, unsuspendable_fd, tracker_node) {
@@ -604,7 +604,7 @@ int fd_tracker_open_unsuspendable_fd(struct fd_tracker *tracker,
        int ret, user_ret, i, fds_to_suspend;
        unsigned int active_fds;
        struct unsuspendable_fd **entries;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        entries = calloc<unsuspendable_fd *>(fd_count);
        if (!entries) {
@@ -695,7 +695,7 @@ int fd_tracker_close_unsuspendable_fd(struct fd_tracker *tracker,
 {
        int i, ret, user_ret;
        int *fds = nullptr;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        /*
         * Maintain a local copy of fds_in as the user's callback may modify its
index c98f6ad455c39598bcafb8eb9918852b822aba07..5d0dd20208ae44f8ee349870a6754bbe13bce84c 100644 (file)
@@ -212,7 +212,7 @@ static void lttng_inode_destroy(struct lttng_inode *inode)
                return;
        }
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_del(inode->registry_ht, &inode->registry_node);
 
        if (inode->unlink_pending) {
@@ -476,7 +476,7 @@ void lttng_inode_registry_destroy(struct lttng_inode_registry *registry)
                return;
        }
        if (registry->inodes) {
-               int ret = cds_lfht_destroy(registry->inodes, nullptr);
+               const int ret = cds_lfht_destroy(registry->inodes, nullptr);
 
                LTTNG_ASSERT(!ret);
        }
@@ -496,7 +496,7 @@ lttng_inode_registry_get_inode(struct lttng_inode_registry *registry,
        struct cds_lfht_iter iter;
        struct cds_lfht_node *node;
        struct lttng_inode *inode = nullptr;
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        ret = fstat(fd, &statbuf);
        if (ret < 0) {
index 51a36326bdbabd88ebd48b91ea435f6913797136..8448717d67c40452b3927f2c4eeac1713b7aeb89 100644 (file)
@@ -28,7 +28,7 @@
 
 // the parameter name (of the reentrant 'yyparse' function)
 // data is a pointer to a 'SParserParam' structure
-//#define YYPARSE_PARAM        parser_ctx
+// #define YYPARSE_PARAM       parser_ctx
 
 #ifndef YY_TYPEDEF_YY_SCANNER_T
 #define YY_TYPEDEF_YY_SCANNER_T
index be7e77342df8b6d7c297f135c87194c9921cf47d..a410fc41cb59c7d66af239546c96e92401af8a10 100644 (file)
@@ -273,7 +273,7 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht, struct lttng_ht_node_str *node
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_unique(ht->ht,
                                       ht->hash_fct(node->key, lttng_ht_seed),
                                       ht->match_fct,
@@ -292,7 +292,7 @@ void lttng_ht_add_str(struct lttng_ht *ht, struct lttng_ht_node_str *node)
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_add(ht->ht, ht->hash_fct(node->key, lttng_ht_seed), &node->node);
 }
 
@@ -306,7 +306,7 @@ void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node)
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_add(ht->ht, ht->hash_fct((void *) node->key, lttng_ht_seed), &node->node);
 }
 
@@ -320,7 +320,7 @@ void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node)
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_add(ht->ht, ht->hash_fct(&node->key, lttng_ht_seed), &node->node);
 }
 
@@ -335,7 +335,7 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_unique(ht->ht,
                                       ht->hash_fct((void *) node->key, lttng_ht_seed),
                                       ht->match_fct,
@@ -355,7 +355,7 @@ void lttng_ht_add_unique_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_unique(ht->ht,
                                       ht->hash_fct(&node->key, lttng_ht_seed),
                                       ht->match_fct,
@@ -375,7 +375,7 @@ void lttng_ht_add_unique_two_u64(struct lttng_ht *ht, struct lttng_ht_node_two_u
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_unique(ht->ht,
                                       ht->hash_fct((void *) &node->key, lttng_ht_seed),
                                       ht->match_fct,
@@ -396,7 +396,7 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_replace(ht->ht,
                                        ht->hash_fct((void *) node->key, lttng_ht_seed),
                                        ht->match_fct,
@@ -421,7 +421,7 @@ struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
        LTTNG_ASSERT(node);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        node_ptr = cds_lfht_add_replace(ht->ht,
                                        ht->hash_fct(&node->key, lttng_ht_seed),
                                        ht->match_fct,
@@ -447,7 +447,7 @@ int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter)
        LTTNG_ASSERT(iter);
 
        /* RCU read lock protects from ABA. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        ret = cds_lfht_del(ht->ht, iter->iter.node);
        return ret;
 }
@@ -488,7 +488,7 @@ unsigned long lttng_ht_get_count(struct lttng_ht *ht)
        LTTNG_ASSERT(ht->ht);
 
        /* RCU read lock protects from ABA and allows RCU traversal. */
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_count_nodes(ht->ht, &scb, &count, &sca);
 
        return count;
index 863a4c52b0d3781f47fd1e4fab144e658fcccbef..e24c48a474e2c5eec3a81fd519c1441e4c77d185 100644 (file)
@@ -99,7 +99,7 @@ _lttng_index_file_create_from_trace_chunk(struct lttng_trace_chunk *chunk,
                chunk_status = (lttng_trace_chunk_status) lttng_trace_chunk_unlink_file(
                        chunk, index_file_path);
                if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK &&
-                   !(chunk_status == LTTNG_TRACE_CHUNK_STATUS_ERROR && errno == ENOENT)) {
+                   (chunk_status != LTTNG_TRACE_CHUNK_STATUS_ERROR || errno != ENOENT)) {
                        goto error;
                }
        }
index ebfe153c276c593870df422ea5ea0c9ed6cad81a..2389627063abefe88dfc4ce6b1e0248086966b31 100644 (file)
@@ -36,7 +36,7 @@ static int config_entry_handler_filter(struct handler_filter_args *args,
                                       const char *value)
 {
        int ret = 0;
-       struct config_entry entry = { section, name, value };
+       const config_entry entry = { section, name, value };
 
        LTTNG_ASSERT(args);
 
index c17a8c0e8684b8d887b799abced290390775e989..e6fba384e3ed967c6e0c6e83adcd13445214f216 100644 (file)
@@ -75,7 +75,7 @@ static char *find_char_or_comment(const char *s, char c)
 {
        int was_whitespace = 0;
 
-       while (*s && *s != c && !(was_whitespace && *s == ';')) {
+       while (*s && *s != c && (!was_whitespace || *s != ';')) {
                was_whitespace = isspace((unsigned char) (*s));
                s++;
        }
index 7e8de03f6b1380ca46eaf31c02ce5682b5f20e81..fe360ea694e1d026fba26ee02052d7a46157d14d 100644 (file)
@@ -52,7 +52,7 @@ extern int consumer_poll_timeout;
 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);
        /*
@@ -86,7 +86,7 @@ int lttng_kconsumer_sample_snapshot_positions(struct lttng_consumer_stream *stre
 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) {
@@ -104,7 +104,7 @@ int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
 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) {
@@ -152,7 +152,7 @@ static int lttng_kconsumer_snapshot_channel(struct lttng_consumer_channel *chann
        /* 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) {
@@ -354,7 +354,7 @@ static int lttng_kconsumer_snapshot_metadata(struct lttng_consumer_channel *meta
 
        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);
@@ -454,14 +454,14 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        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. */
@@ -542,7 +542,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                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) {
@@ -709,7 +709,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                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);
@@ -875,7 +875,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        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;
 
@@ -915,7 +915,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        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);
@@ -941,7 +941,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        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);
@@ -988,7 +988,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        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;
 
@@ -1034,8 +1034,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                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,
@@ -1066,8 +1066,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                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,
@@ -1146,7 +1146,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        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);
@@ -1192,7 +1192,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        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);
index 6673ddc8d3504a7c40b496fd277f0274f3d7743c..2962b7f8c473bc6b5b1a535c828f18fe39dc9800 100644 (file)
 
 static bool is_log_level_rule_exactly_type(const struct lttng_log_level_rule *rule)
 {
-       enum lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
+       const lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
 
        return type == LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY;
 }
 
 static bool is_log_level_rule_at_least_as_severe_type(const struct lttng_log_level_rule *rule)
 {
-       enum lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
+       const lttng_log_level_rule_type type = lttng_log_level_rule_get_type(rule);
 
        return type == LTTNG_LOG_LEVEL_RULE_TYPE_AT_LEAST_AS_SEVERE_AS;
 }
index be1db0250ac02bae4af5cba422c52c3cb41a8132..8094b49677ed117fcef8d1f00f0b22faaeede7e7 100644 (file)
@@ -610,7 +610,7 @@ static int lttng_elf_get_section_hdr_by_name(struct lttng_elf *elf,
 
        for (i = 0; i < elf->ehdr->e_shnum; ++i) {
                bool name_equal;
-               int ret = lttng_elf_get_section_hdr(elf, i, section_hdr);
+               const int ret = lttng_elf_get_section_hdr(elf, i, section_hdr);
 
                if (ret) {
                        break;
@@ -823,10 +823,10 @@ int lttng_elf_get_symbol_offset(int fd, char *symbol, uint64_t *offset)
 
                /* Get the symbol at the current index. */
                if (is_elf_32_bit(elf)) {
-                       Elf32_Sym tmp = ((Elf32_Sym *) symbol_table_data)[sym_idx];
+                       const Elf32_Sym tmp = ((Elf32_Sym *) symbol_table_data)[sym_idx];
                        copy_sym(tmp, curr_sym);
                } else {
-                       Elf64_Sym tmp = ((Elf64_Sym *) symbol_table_data)[sym_idx];
+                       const Elf64_Sym tmp = ((Elf64_Sym *) symbol_table_data)[sym_idx];
                        copy_sym(tmp, curr_sym);
                }
 
index 7d037e47226cf2469503bf30b8073915fb134349..5a57b97152c823829fb8d295d1ebf128429c78c3 100644 (file)
@@ -33,9 +33,9 @@ public:
        ~mutex() = default;
 
        /* "Not copyable" and "not moveable" Mutex requirements. */
-       mutex(mutex const&) = delete;
+       mutex(const mutex&) = delete;
        mutex(mutex&&) = delete;
-       mutex& operator=(mutex const&) = delete;
+       mutex& operator=(const mutex&) = delete;
        mutex& operator=(mutex&&) = delete;
 
        void lock()
index d98b2181d374a5bfccf0766ff7ca566c1f5d97e2..7b1d0b8c15724e4e83094da3dacd591d4ccdbef9 100644 (file)
@@ -76,7 +76,7 @@ private:
                        return;
                }
 
-               typename CustomDeleter::deleter del;
+               const typename CustomDeleter::deleter del;
                del(_value);
                release();
        }
index 07d9e171f0a0cf941c78cec5c928af2da9158469..ffbc02d35ace207928f13aaf7d3a55d2aeaa0d0a 100644 (file)
@@ -788,9 +788,9 @@ send_fds_to_master(run_as_worker_data *worker, enum run_as_cmd cmd, struct run_a
        }
 
        for (i = 0; i < COMMAND_OUT_FD_COUNT(cmd); i++) {
-               int fd = COMMAND_OUT_FDS(cmd, run_as_ret)[i];
+               const int fd = COMMAND_OUT_FDS(cmd, run_as_ret)[i];
                if (fd >= 0) {
-                       int ret_close = close(fd);
+                       const int ret_close = close(fd);
 
                        if (ret_close < 0) {
                                PERROR("Failed to close result file descriptor (fd = %i)", fd);
index 633685799aad448f352adfac358c5214269dfa05..3471f6c0bfe9e50570bd710fcb50782a1be8ff79 100644 (file)
@@ -102,7 +102,7 @@ static int connect_no_timeout(struct lttcomm_sock *sock)
 
 static int connect_with_timeout(struct lttcomm_sock *sock)
 {
-       unsigned long timeout = lttcomm_get_network_timeout();
+       const unsigned long timeout = lttcomm_get_network_timeout();
        int ret, flags, connect_ret;
        struct timespec orig_time, cur_time;
        unsigned long diff_ms;
index 289e19e98df67b3192095da8d4df50c4197b99cb..0d1b6f15ba02611024e61340f76f3027ae1d1011 100644 (file)
@@ -97,7 +97,7 @@ static int connect_no_timeout(struct lttcomm_sock *sock)
 
 static int connect_with_timeout(struct lttcomm_sock *sock)
 {
-       unsigned long timeout = lttcomm_get_network_timeout();
+       const unsigned long timeout = lttcomm_get_network_timeout();
        int ret, flags, connect_ret;
        struct timespec orig_time, cur_time;
        unsigned long diff_ms;
index 593ab265ccc25f6a1d7e06d098c31c0568529b27..c5236a432f5ac8b00b039187aca49f07b2f10ad2 100644 (file)
@@ -126,7 +126,7 @@ const char *lttcomm_get_readable_code(enum lttcomm_return_code code)
        code = (lttcomm_return_code) -code;
 
        if (code != LTTCOMM_CONSUMERD_SUCCESS &&
-           !(code >= LTTCOMM_CONSUMERD_COMMAND_SOCK_READY && code < LTTCOMM_NR)) {
+           (code < LTTCOMM_CONSUMERD_COMMAND_SOCK_READY || code >= LTTCOMM_NR)) {
                code = LTTCOMM_CONSUMERD_UNKNOWN_ERROR;
        }
 
index 4f727e2e8ed0fe9f407249e538a4dfe1b80d7f85..13302f134a26f770f6d1b14bcd8cff64a23ba20e 100644 (file)
@@ -275,7 +275,7 @@ int strutils_split(const char *input,
                }
 
                if (*s == delim) {
-                       size_t last_len = s - last - 1;
+                       const size_t last_len = s - last - 1;
                        last = s;
                        number_of_substrings++;
 
@@ -375,8 +375,8 @@ int strutils_append_str(char **s, const char *append)
 {
        char *old = *s;
        char *new_str;
-       size_t oldlen = (old == nullptr) ? 0 : strlen(old);
-       size_t appendlen = strlen(append);
+       const size_t oldlen = (old == nullptr) ? 0 : strlen(old);
+       const size_t appendlen = strlen(append);
 
        new_str = zmalloc<char>(oldlen + appendlen + 1);
        if (!new_str) {
@@ -394,7 +394,7 @@ int strutils_append_str(char **s, const char *append)
 int strutils_appendf(char **s, const char *fmt, ...)
 {
        char *new_str;
-       size_t oldlen = (*s) ? strlen(*s) : 0;
+       const size_t oldlen = (*s) ? strlen(*s) : 0;
        size_t addlen = 0;
        int ret;
        va_list args;
index ca29b2d61891efad38919300ee6771cc70f7008d..6caaf27ba2902af9a35b34bf58ddc95b357cb1c0 100644 (file)
@@ -47,9 +47,9 @@ int timespec_to_ms(struct timespec ts, unsigned long *ms)
 
 struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2)
 {
-       uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t1.tv_nsec;
-       uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t2.tv_nsec;
-       uint64_t diff = std::max(ts1, ts2) - std::min(ts1, ts2);
+       const uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t1.tv_nsec;
+       const uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t2.tv_nsec;
+       const uint64_t diff = std::max(ts1, ts2) - std::min(ts1, ts2);
        struct timespec res;
 
        res.tv_sec = diff / (uint64_t) NSEC_PER_SEC;
index 5da16a6134ac7027365a022abb27410bec2edf1f..591768b92321ee40b371389a8dca589883fa8ead 100644 (file)
@@ -257,7 +257,7 @@ static int fs_handle_untracked_close(struct fs_handle *_handle)
 {
        struct fs_handle_untracked *handle =
                lttng::utils::container_of(_handle, &fs_handle_untracked::parent);
-       int ret = close(handle->fd);
+       const int ret = close(handle->fd);
 
        fs_handle_untracked_destroy(handle);
        return ret;
@@ -1828,7 +1828,7 @@ static void lttng_trace_chunk_release(struct urcu_ref *ref)
                element = lttng::utils::container_of(chunk,
                                                     &lttng_trace_chunk_registry_element::chunk);
                if (element->registry) {
-                       lttng::urcu::read_lock_guard read_lock;
+                       const lttng::urcu::read_lock_guard read_lock;
                        cds_lfht_del(element->registry->ht, &element->trace_chunk_registry_ht_node);
                        call_rcu(&element->rcu_node, free_lttng_trace_chunk_registry_element);
                } else {
@@ -1878,7 +1878,7 @@ void lttng_trace_chunk_registry_destroy(struct lttng_trace_chunk_registry *regis
                return;
        }
        if (registry->ht) {
-               int ret = cds_lfht_destroy(registry->ht, nullptr);
+               const int ret = cds_lfht_destroy(registry->ht, nullptr);
                LTTNG_ASSERT(!ret);
        }
        free(registry);
@@ -1944,7 +1944,7 @@ lttng_trace_chunk_registry_publish_chunk(struct lttng_trace_chunk_registry *regi
        element = lttng_trace_chunk_registry_element_create_from_chunk(chunk, session_id);
        pthread_mutex_unlock(&chunk->lock);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        if (!element) {
                goto end;
        }
@@ -2034,7 +2034,7 @@ static struct lttng_trace_chunk *_lttng_trace_chunk_registry_find_chunk(
        struct lttng_trace_chunk *published_chunk = nullptr;
        struct cds_lfht_iter iter;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(registry->ht,
                        element_hash,
                        lttng_trace_chunk_registry_element_match,
@@ -2065,7 +2065,7 @@ int lttng_trace_chunk_registry_chunk_exists(const struct lttng_trace_chunk_regis
                                            uint64_t chunk_id,
                                            bool *chunk_exists)
 {
-       int ret = 0;
+       const int ret = 0;
        lttng_trace_chunk_registry_element target_element;
 
        target_element.chunk.id.is_set = true;
@@ -2076,7 +2076,7 @@ int lttng_trace_chunk_registry_chunk_exists(const struct lttng_trace_chunk_regis
        struct cds_lfht_node *published_node;
        struct cds_lfht_iter iter;
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        cds_lfht_lookup(registry->ht,
                        element_hash,
                        lttng_trace_chunk_registry_element_match,
@@ -2110,7 +2110,7 @@ lttng_trace_chunk_registry_put_each_chunk(const struct lttng_trace_chunk_registr
        DBG("Releasing trace chunk registry to all trace chunks");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (
                        registry->ht, &iter, chunk_element, trace_chunk_registry_ht_node) {
index 11ab18a98567cddcf6ca2cb3513f61009150e6cf..ea81e1d13bdb28c07a3aaac756666508e23bf710 100644 (file)
@@ -410,7 +410,7 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd)
        struct cmsghdr *cmptr;
        struct iovec iov[1];
        ssize_t ret = -1;
-       unsigned int sizeof_fds = nb_fd * sizeof(int);
+       const unsigned int sizeof_fds = nb_fd * sizeof(int);
        char tmp[CMSG_SPACE(sizeof_fds)];
        char dummy = 0;
 
@@ -534,7 +534,7 @@ ssize_t lttcomm_send_fds_unix_sock_non_block(int sock, const int *fds, size_t nb
        struct cmsghdr *cmptr;
        struct iovec iov[1];
        ssize_t ret = -1;
-       unsigned int sizeof_fds = nb_fd * sizeof(int);
+       const unsigned int sizeof_fds = nb_fd * sizeof(int);
        char tmp[CMSG_SPACE(sizeof_fds)];
        char dummy = 0;
 
@@ -620,7 +620,7 @@ ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
        struct iovec iov[1];
        ssize_t ret = 0;
        struct cmsghdr *cmsg;
-       size_t sizeof_fds = nb_fd * sizeof(int);
+       const size_t sizeof_fds = nb_fd * sizeof(int);
 
 #ifdef __linux__
 /* Account for the struct ucred cmsg in the buffer size */
@@ -846,7 +846,7 @@ ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_fd)
        struct iovec iov[1];
        ssize_t ret = 0;
        struct cmsghdr *cmsg;
-       size_t sizeof_fds = nb_fd * sizeof(int);
+       const size_t sizeof_fds = nb_fd * sizeof(int);
 
        LTTNG_ASSERT(sock);
        LTTNG_ASSERT(fds);
@@ -983,7 +983,7 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len)
        ssize_t ret = -1;
 #if defined(__linux__) || defined(__CYGWIN__)
        struct cmsghdr *cmptr;
-       size_t sizeof_cred = sizeof(lttng_sock_cred);
+       const size_t sizeof_cred = sizeof(lttng_sock_cred);
        char anc_buf[CMSG_SPACE(sizeof_cred)];
        lttng_sock_cred *creds;
 
@@ -1048,7 +1048,7 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len, lttng_sock
        size_t len_last;
 #if defined(__linux__) || defined(__CYGWIN__)
        struct cmsghdr *cmptr;
-       size_t sizeof_cred = sizeof(lttng_sock_cred);
+       const size_t sizeof_cred = sizeof(lttng_sock_cred);
        char anc_buf[CMSG_SPACE(sizeof_cred)];
 #endif /* __linux__, __CYGWIN__ */
 
index 35bb2905c9e44cfeaf14b6e065d39696861ce8a6..017c9fad5ddacb84271303eee5572bdaf5329934 100644 (file)
@@ -30,7 +30,7 @@ public:
        ~read_lock() = default;
 
        /* "Not copyable" and "not moveable" Mutex requirements. */
-       read_lock(read_lock const&) = delete;
+       read_lock(const read_lock&) = delete;
        read_lock(read_lock&&) = delete;
        read_lock& operator=(read_lock&&) = delete;
        read_lock& operator=(const read_lock&) = delete;
index 4a9c31812b75909769121c12edcf60e1571d6f6f..426f12860aec441ce96354b122fd81f2cd1114b4 100644 (file)
@@ -1436,7 +1436,7 @@ int lttng_userspace_probe_location_create_from_payload(
        int consumed = 0;
        int ret;
        struct lttng_userspace_probe_location_comm *probe_location_comm;
-       struct lttng_payload_view probe_location_comm_view =
+       const lttng_payload_view probe_location_comm_view =
                lttng_payload_view_from_view(view, 0, sizeof(*probe_location_comm));
 
        LTTNG_ASSERT(view);
@@ -1512,7 +1512,7 @@ end:
 static int lttng_userspace_probe_location_function_set_binary_fd_handle(
        struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd)
 {
-       int ret = 0;
+       const int ret = 0;
        struct lttng_userspace_probe_location_function *function_location;
 
        LTTNG_ASSERT(location);
@@ -1529,7 +1529,7 @@ static int lttng_userspace_probe_location_function_set_binary_fd_handle(
 static int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
        struct lttng_userspace_probe_location *location, struct fd_handle *binary_fd)
 {
-       int ret = 0;
+       const int ret = 0;
        struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
 
        LTTNG_ASSERT(location);
index 3f40d03ed3d846cb8fa95788c94bf555be5fb28f..93686e75a7166116e5448b580aa7d9a2b904ff86 100644 (file)
@@ -667,7 +667,7 @@ static int flush_channel(uint64_t chan_key)
 
        DBG("UST consumer flush channel key %" PRIu64, chan_key);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        channel = consumer_find_channel(chan_key);
        if (!channel) {
                ERR("UST consumer flush channel %" PRIu64 " not found", chan_key);
@@ -741,7 +741,7 @@ static int clear_quiescent_channel(uint64_t chan_key)
 
        DBG("UST consumer clear quiescent channel key %" PRIu64, chan_key);
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
        channel = consumer_find_channel(chan_key);
        if (!channel) {
                ERR("UST consumer clear quiescent channel %" PRIu64 " not found", chan_key);
@@ -959,7 +959,7 @@ static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
 
        DBG("UST 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;
 
        LTTNG_ASSERT(!metadata_channel->monitor);
 
@@ -1068,7 +1068,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
        LTTNG_ASSERT(ctx);
        ASSERT_RCU_READ_LOCKED();
 
-       lttng::urcu::read_lock_guard read_lock;
+       const lttng::urcu::read_lock_guard read_lock;
 
        if (relayd_id != (uint64_t) -1ULL) {
                use_relayd = 1;
@@ -1395,14 +1395,14 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        health_code_update();
 
        /* relayd needs RCU read-side lock */
-       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. */
@@ -1420,7 +1420,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        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;
 
                DBG("UST consumer destroying relayd %" PRIu64, index);
@@ -1456,7 +1456,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        {
                int is_data_pending;
                ssize_t ret_send;
-               uint64_t id = msg.u.data_pending.session_id;
+               const uint64_t id = msg.u.data_pending.session_id;
 
                DBG("UST consumer data pending command for id %" PRIu64, id);
 
@@ -1629,7 +1629,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_GET_CHANNEL:
        {
                int ret, relayd_err = 0;
-               uint64_t key = msg.u.get_channel.key;
+               const uint64_t key = msg.u.get_channel.key;
                struct lttng_consumer_channel *found_channel;
 
                found_channel = consumer_find_channel(key);
@@ -1689,7 +1689,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        case LTTNG_CONSUMER_DESTROY_CHANNEL:
        {
-               uint64_t key = msg.u.destroy_channel.key;
+               const uint64_t key = msg.u.destroy_channel.key;
 
                /*
                 * Only called if streams have not been sent to stream
@@ -1735,10 +1735,10 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_PUSH_METADATA:
        {
                int ret;
-               uint64_t len = msg.u.push_metadata.len;
-               uint64_t key = msg.u.push_metadata.key;
-               uint64_t offset = msg.u.push_metadata.target_offset;
-               uint64_t version = msg.u.push_metadata.version;
+               const uint64_t len = msg.u.push_metadata.len;
+               const uint64_t key = msg.u.push_metadata.key;
+               const uint64_t offset = msg.u.push_metadata.target_offset;
+               const uint64_t version = msg.u.push_metadata.version;
                struct lttng_consumer_channel *found_channel;
 
                DBG("UST consumer push metadata key %" PRIu64 " of len %" PRIu64, key, len);
@@ -1814,7 +1814,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_SNAPSHOT_CHANNEL:
        {
                struct lttng_consumer_channel *found_channel;
-               uint64_t key = msg.u.snapshot_channel.key;
+               const uint64_t key = msg.u.snapshot_channel.key;
                int ret_send;
 
                found_channel = consumer_find_channel(key);
@@ -1867,7 +1867,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                struct lttng_ht *ht;
                struct lttng_consumer_stream *stream;
                uint64_t id = msg.u.discarded_events.session_id;
-               uint64_t key = msg.u.discarded_events.channel_key;
+               const uint64_t key = msg.u.discarded_events.channel_key;
 
                DBG("UST consumer discarded events command for session id %" PRIu64, id);
                pthread_mutex_lock(&the_consumer_data.lock);
@@ -1921,7 +1921,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                struct lttng_ht *ht;
                struct lttng_consumer_stream *stream;
                uint64_t id = msg.u.lost_packets.session_id;
-               uint64_t key = msg.u.lost_packets.channel_key;
+               const uint64_t key = msg.u.lost_packets.channel_key;
 
                DBG("UST consumer lost packets command for session id %" PRIu64, id);
                pthread_mutex_lock(&the_consumer_data.lock);
@@ -2014,7 +2014,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_ROTATE_CHANNEL:
        {
                struct lttng_consumer_channel *found_channel;
-               uint64_t key = msg.u.rotate_channel.key;
+               const uint64_t key = msg.u.rotate_channel.key;
                int ret_send_status;
 
                found_channel = consumer_find_channel(key);
@@ -2067,7 +2067,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_CLEAR_CHANNEL:
        {
                struct lttng_consumer_channel *found_channel;
-               uint64_t key = msg.u.clear_channel.key;
+               const uint64_t key = msg.u.clear_channel.key;
                int ret_send_status;
 
                found_channel = consumer_find_channel(key);
@@ -3204,7 +3204,7 @@ void lttng_ustconsumer_close_all_metadata(struct lttng_ht *metadata_ht)
        DBG("UST consumer closing all metadata streams");
 
        {
-               lttng::urcu::read_lock_guard read_lock;
+               const lttng::urcu::read_lock_guard read_lock;
 
                cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
                        health_code_update();
@@ -3243,7 +3243,7 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
 {
        struct lttcomm_metadata_request_msg request;
        struct lttcomm_consumer_msg msg;
-       enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
+       const lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
        uint64_t len, key, offset, version;
        int ret;
 
index 62c9c22d52686e442edad15ce3a4a17a8edb0a75..f1be2c39ed438e12abe04355688c253c30cbe17d 100644 (file)
@@ -475,7 +475,7 @@ end:
  *
  * @return 0 on success, -1 on failure.
  */
-int utils_parse_time_suffix(char const *const str, uint64_t *const time_us)
+int utils_parse_time_suffix(const char *const str, uint64_t *const time_us)
 {
        int ret;
        uint64_t base_time;
index 850c29ba88bf9ca3fe96b071861a7d67847c1b73..36cb690d447ff13fead85997160ca609099f0242 100644 (file)
@@ -38,8 +38,8 @@ int utils_stream_file_path(const char *path_name,
                           const char *suffix,
                           char *out_stream_path,
                           size_t stream_path_len);
-int utils_parse_size_suffix(char const *const str, uint64_t *const size);
-int utils_parse_time_suffix(char const *const str, uint64_t *const time_us);
+int utils_parse_size_suffix(const char *const str, uint64_t *const size);
+int utils_parse_time_suffix(const char *const str, uint64_t *const time_us);
 int utils_get_count_order_u32(uint32_t x);
 int utils_get_count_order_u64(uint64_t x);
 const char *utils_get_home_dir();
index 61b2e5041f7bb44f5ee19f28bbb864a329c1d218..49ab6cdf16076fbe5862eb8427acc0403d8a73a9 100644 (file)
@@ -180,7 +180,7 @@ lttng_clear_handle_wait_for_completion(struct lttng_clear_handle *handle, int ti
                goto end;
        }
        if (has_timeout) {
-               int ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
+               const int ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
                if (ret) {
                        status = LTTNG_CLEAR_HANDLE_STATUS_ERROR;
                        goto end;
index 34f58f7e01187afc2ae5ab1ad326326197abf009..e97364587a103efa70caad6441f289901572f95d 100644 (file)
@@ -235,7 +235,7 @@ lttng_destruction_handle_wait_for_completion(struct lttng_destruction_handle *ha
                goto end;
        }
        if (has_timeout) {
-               int ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
+               const int ret = lttng_clock_gettime(CLOCK_MONOTONIC, &initial_time);
                if (ret) {
                        status = LTTNG_DESTRUCTION_HANDLE_STATUS_ERROR;
                        goto end;
index bbc94828e6c828e7b7a9acbe90080654d714202a..5057b75eff17abebc3d2d9c9ff2b29e08b078670 100644 (file)
@@ -1214,7 +1214,7 @@ serialize:
 
        {
                struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
-               int fd_count = lttng_payload_view_get_fd_handle_count(&view);
+               const int fd_count = lttng_payload_view_get_fd_handle_count(&view);
                int fd_to_send;
 
                if (fd_count < 0) {
@@ -1397,7 +1397,7 @@ serialize:
 
        {
                struct lttng_payload_view view = lttng_payload_view_from_payload(&payload, 0, -1);
-               int fd_count = lttng_payload_view_get_fd_handle_count(&view);
+               const int fd_count = lttng_payload_view_get_fd_handle_count(&view);
                int fd_to_send;
 
                if (fd_count < 0) {
@@ -1702,7 +1702,7 @@ int lttng_list_tracepoints(struct lttng_handle *handle, struct lttng_event **eve
        nb_events = (unsigned int) cmd_header->count;
 
        {
-               struct lttng_buffer_view events_view =
+               const lttng_buffer_view events_view =
                        lttng_buffer_view_init(reception_buffer, 0, total_payload_received);
                struct lttng_payload_view events_payload_view =
                        lttng_payload_view_from_buffer_view(&events_view, 0, -1);
@@ -1912,7 +1912,7 @@ enum lttng_error_code lttng_create_session_ext(struct lttng_session_descriptor *
                !lttng_session_descriptor_is_output_destination_initialized(session_descriptor);
        if (sessiond_must_generate_ouput) {
                const char *home_dir = utils_get_home_dir();
-               size_t home_dir_len = home_dir ? strlen(home_dir) + 1 : 0;
+               const size_t home_dir_len = home_dir ? strlen(home_dir) + 1 : 0;
 
                if (!home_dir || home_dir_len > LTTNG_PATH_MAX) {
                        ret_code = LTTNG_ERR_FATAL;
index 2eff064cd363756bc63e5018fdc73f75da04f0a4..bdac834d231c4a88adf965db723a5a945656cbd1 100644 (file)
@@ -595,7 +595,7 @@ enum class type {
   custom_type
 };
 
-// Maps core type T to the corresponding type enum constant.
+// Maps core type T to the corresponding type constant.
 template <typename T, typename Char>
 struct type_constant : std::integral_constant<type, type::custom_type> {};
 
index b6f0210d503d24a03bf9e50235019d4b37c718be..83f13567a83d0093f77bb9c1510419326df6748d 100644 (file)
@@ -66,7 +66,7 @@ static void epoll_pwait_int_max(FILE *validation_output_file);
 static void ppoll_concurrent_write(FILE *validation_output_file);
 static void epoll_pwait_concurrent_munmap(FILE *validation_output_file);
 
-typedef void (*test_case_cb)(FILE *output_file);
+using test_case_cb = void (*)(FILE *);
 
 namespace {
 const struct test_case {
@@ -142,7 +142,7 @@ struct ppoll_thread_data {
 };
 } /* namespace */
 
-static void test_select_big(void)
+static void test_select_big()
 {
        fd_set rfds, wfds, exfds;
        struct timeval tv;
@@ -167,7 +167,7 @@ static void test_select_big(void)
        if (timeout > 0) {
                ret = select(fd2 + 1, &rfds, &wfds, &exfds, &tv);
        } else {
-               ret = select(fd2 + 1, &rfds, &wfds, &exfds, NULL);
+               ret = select(fd2 + 1, &rfds, &wfds, &exfds, nullptr);
        }
 
        if (ret == -1) {
@@ -217,12 +217,12 @@ static void test_pselect_generic(long int syscall_id)
        }
 }
 
-static void test_pselect(void)
+static void test_pselect()
 {
        test_pselect_generic(SYS_pselect6);
 }
 
-static void test_select(void)
+static void test_select()
 {
        fd_set rfds;
        struct timeval tv;
@@ -236,9 +236,9 @@ static void test_select(void)
        tv.tv_usec = timeout * MSEC_PER_USEC;
 
        if (timeout > 0) {
-               ret = select(1, &rfds, NULL, NULL, &tv);
+               ret = select(1, &rfds, nullptr, nullptr, &tv);
        } else {
-               ret = select(1, &rfds, NULL, NULL, NULL);
+               ret = select(1, &rfds, nullptr, nullptr, nullptr);
        }
 
        if (ret == -1) {
@@ -251,7 +251,7 @@ static void test_select(void)
        }
 }
 
-static void test_poll(void)
+static void test_poll()
 {
        struct pollfd ufds[NB_FD];
        char buf[BUF_SIZE];
@@ -300,7 +300,7 @@ static void test_ppoll_generic(long int syscall_id)
        }
 }
 
-static void test_ppoll(void)
+static void test_ppoll()
 {
        test_ppoll_generic(SYS_ppoll);
 }
@@ -320,7 +320,7 @@ static void test_ppoll_big(FILE *validation_output_file __attribute__((unused)))
                ufds[i].events = POLLIN | POLLPRI;
        }
 
-       ret = ppoll(ufds, MAX_FDS, NULL, NULL);
+       ret = ppoll(ufds, MAX_FDS, nullptr, nullptr);
 
        if (ret < 0) {
                PERROR("ppoll");
@@ -418,9 +418,9 @@ static void test_epoll_pwait(FILE *validation_output_file)
        }
 
        if (timeout > 0) {
-               ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, NULL);
+               ret = epoll_pwait(epollfd, &epoll_event, 1, timeout, nullptr);
        } else {
-               ret = epoll_pwait(epollfd, &epoll_event, 1, -1, NULL);
+               ret = epoll_pwait(epollfd, &epoll_event, 1, -1, nullptr);
        }
 
        if (ret == 1) {
@@ -773,7 +773,7 @@ static void *ppoll_writer(void *arg)
                usleep(100);
        }
 
-       return NULL;
+       return nullptr;
 }
 
 static void do_ppoll(int *fds, struct pollfd *ufds)
@@ -790,7 +790,7 @@ static void do_ppoll(int *fds, struct pollfd *ufds)
                ufds[i].events = POLLIN | POLLPRI;
        }
 
-       ret = ppoll(ufds, MAX_FDS, &ts, NULL);
+       ret = ppoll(ufds, MAX_FDS, &ts, nullptr);
 
        if (ret < 0) {
                PERROR("ppoll");
@@ -813,7 +813,7 @@ static void stress_ppoll(int *fds, int value)
        thread_data.value = value;
 
        stop_thread = 0;
-       ret = pthread_create(&writer, NULL, &ppoll_writer, (void *) &thread_data);
+       ret = pthread_create(&writer, nullptr, &ppoll_writer, (void *) &thread_data);
        if (ret != 0) {
                fprintf(stderr, "[error] pthread_create\n");
                goto end;
@@ -822,7 +822,7 @@ static void stress_ppoll(int *fds, int value)
                do_ppoll(fds, ufds);
        }
        stop_thread = 1;
-       ret = pthread_join(writer, NULL);
+       ret = pthread_join(writer, nullptr);
        if (ret) {
                fprintf(stderr, "[error] pthread_join\n");
                goto end;
@@ -870,14 +870,14 @@ static void ppoll_concurrent_write(FILE *validation_output_file __attribute__((u
 
 static void *epoll_pwait_writer(void *addr)
 {
-       srand(time(NULL));
+       srand(time(nullptr));
 
        while (!stop_thread) {
                usleep(rand() % 30);
                munmap(addr, MAX_FDS * sizeof(struct epoll_event));
        }
 
-       return NULL;
+       return nullptr;
 }
 
 /*
@@ -907,7 +907,7 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                goto error;
        }
 
-       epoll_event = (struct epoll_event *) mmap(NULL,
+       epoll_event = (struct epoll_event *) mmap(nullptr,
                                                  MAX_FDS * sizeof(struct epoll_event),
                                                  PROT_READ | PROT_WRITE,
                                                  MAP_PRIVATE | MAP_ANONYMOUS,
@@ -932,13 +932,13 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
                }
        }
        stop_thread = 0;
-       ret = pthread_create(&writer, NULL, &epoll_pwait_writer, (void *) epoll_event);
+       ret = pthread_create(&writer, nullptr, &epoll_pwait_writer, (void *) epoll_event);
        if (ret != 0) {
                fprintf(stderr, "[error] pthread_create\n");
                goto error_unmap;
        }
 
-       ret = epoll_pwait(epollfd, epoll_event, 1, 1, NULL);
+       ret = epoll_pwait(epollfd, epoll_event, 1, 1, nullptr);
 
        if (ret == 1) {
                ret = read(wait_fd, buf, BUF_SIZE);
@@ -950,7 +950,7 @@ static void epoll_pwait_concurrent_munmap(FILE *validation_output_file)
        }
 
        stop_thread = 1;
-       ret = pthread_join(writer, NULL);
+       ret = pthread_join(writer, nullptr);
        if (ret) {
                fprintf(stderr, "[error] pthread_join\n");
                goto error_unmap;
@@ -977,7 +977,7 @@ end:
        return;
 }
 
-static void print_list(void)
+static void print_list()
 {
        printf("Test list (-t X):\n");
 
@@ -989,7 +989,7 @@ static void print_list(void)
        }
 }
 
-static void print_test_syscalls(void)
+static void print_test_syscalls()
 {
        const char *supported_syscalls[] = {
 #ifdef SYS_select
@@ -1033,31 +1033,31 @@ int main(int argc, const char **argv)
        const char *test_name;
        poptContext optCon;
        struct rlimit open_lim;
-       FILE *test_validation_output_file = NULL;
-       const char *test_validation_output_file_path = NULL;
+       FILE *test_validation_output_file = nullptr;
+       const char *test_validation_output_file_path = nullptr;
        struct poptOption optionsTable[] = {
-               { "test", 't', POPT_ARG_STRING, &test_name, 0, "Name of test to run", NULL },
-               { "list-tests", 'l', 0, 0, 'l', "List tests (-t X)", NULL },
+               { "test", 't', POPT_ARG_STRING, &test_name, 0, "Name of test to run", nullptr },
+               { "list-tests", 'l', 0, nullptr, 'l', "List tests (-t X)", nullptr },
                { "list-supported-test-syscalls",
                  's',
                  0,
-                 0,
+                 nullptr,
                  's',
                  "List supported test syscalls",
-                 NULL },
+                 nullptr },
                { "validation-file",
                  'o',
                  POPT_ARG_STRING,
                  &test_validation_output_file_path,
                  0,
                  "Test case output",
-                 NULL },
-               POPT_AUTOHELP{ NULL, 0, 0, NULL, 0, NULL, NULL }
+                 nullptr },
+               POPT_AUTOHELP{ nullptr, 0, 0, nullptr, 0, nullptr, nullptr }
        };
        const struct test_case *test_case;
        size_t test_case_id;
 
-       optCon = poptGetContext(NULL, argc, argv, optionsTable, 0);
+       optCon = poptGetContext(nullptr, argc, argv, optionsTable, 0);
 
        if (argc < 2) {
                poptPrintUsage(optCon, stderr, 0);
@@ -1106,7 +1106,7 @@ int main(int argc, const char **argv)
         * for the validation, disabling the buffering on the validation file
         * works.
         */
-       setbuf(test_validation_output_file, NULL);
+       setbuf(test_validation_output_file, nullptr);
        wait_fd = STDIN_FILENO;
 
        /* Test case id is 1-based. */
index b878af48639771979821777821aec3df4548183e..025387f727a2064ffb7b94cf107ec4bf00aaba32 100644 (file)
@@ -102,7 +102,7 @@ static int unregister_all_triggers()
                ret = lttng_unregister_trigger(trigger);
                if (ret) {
                        const char *name;
-                       enum lttng_trigger_status get_name_status =
+                       const lttng_trigger_status get_name_status =
                                lttng_trigger_get_name(trigger, &name);
                        if (get_name_status == LTTNG_TRIGGER_STATUS_OK) {
                                fail("Failed to unregister trigger: trigger name = '%s'", name);
index 27bd100c694fbd567e8a5b6e055b317f583b3c53..5c9f6885b9cc13258ade95828dfa7bb8574d8871 100644 (file)
 
 static struct option long_options[] = {
        /* These options set a flag. */
-       { "trigger", required_argument, 0, 't' },
-       { "sync-after-notif-register", required_argument, 0, 'a' },
+       { "trigger", required_argument, nullptr, 't' },
+       { "sync-after-notif-register", required_argument, nullptr, 'a' },
        /* Default alue for count is 1 */
-       { "count", required_argument, 0, 'b' },
+       { "count", required_argument, nullptr, 'b' },
        /*
         * When end-trigger is present the reception loop is exited only when a
         * notification matching the end trigger is received.
         * Otherwise the loop is exited when the count of notification received
         * for `trigger` math the `count` argument.
         */
-       { "end-trigger", required_argument, 0, 'c' },
-       { 0, 0, 0, 0 }
+       { "end-trigger", required_argument, nullptr, 'c' },
+       { nullptr, 0, nullptr, 0 }
 };
 
 static bool action_list_contains_notify(const struct lttng_action *action_list)
@@ -53,7 +53,7 @@ static bool action_list_contains_notify(const struct lttng_action *action_list)
 static bool is_trigger_name(const char *expected_trigger_name,
                            struct lttng_notification *notification)
 {
-       const char *trigger_name = NULL;
+       const char *trigger_name = nullptr;
        enum lttng_trigger_status trigger_status;
        const struct lttng_trigger *trigger;
        bool names_match;
@@ -88,13 +88,13 @@ static int _main(int argc, char **argv)
        int ret;
        int option;
        int option_index;
-       char *expected_trigger_name = NULL;
-       char *end_trigger_name = NULL;
-       struct lttng_triggers *triggers = NULL;
+       char *expected_trigger_name = nullptr;
+       char *end_trigger_name = nullptr;
+       struct lttng_triggers *triggers = nullptr;
        unsigned int count, i, subcription_count = 0;
        enum lttng_trigger_status trigger_status;
-       char *after_notif_register_file_path = NULL;
-       struct lttng_notification_channel *notification_channel = NULL;
+       char *after_notif_register_file_path = nullptr;
+       struct lttng_notification_channel *notification_channel = nullptr;
        int expected_notifications = 1, notification_count = 0;
 
        while ((option = getopt_long(argc, argv, "a:b:c:t:", long_options, &option_index)) != -1) {
@@ -154,19 +154,19 @@ static int _main(int argc, char **argv)
                const struct lttng_action *action = lttng_trigger_get_const_action(trigger);
                const enum lttng_action_type action_type = lttng_action_get_type(action);
                enum lttng_notification_channel_status channel_status;
-               const char *trigger_name = NULL;
+               const char *trigger_name = nullptr;
 
                lttng_trigger_get_name(trigger, &trigger_name);
                if (strcmp(trigger_name, expected_trigger_name) != 0) {
                        /* Might match the end event trigger */
-                       if (end_trigger_name != NULL &&
+                       if (end_trigger_name != nullptr &&
                            strcmp(trigger_name, end_trigger_name) != 0) {
                                continue;
                        }
                }
-               if (!((action_type == LTTNG_ACTION_TYPE_LIST &&
-                      action_list_contains_notify(action)) ||
-                     action_type == LTTNG_ACTION_TYPE_NOTIFY)) {
+               if ((action_type != LTTNG_ACTION_TYPE_LIST ||
+                    !action_list_contains_notify(action)) &&
+                   action_type != LTTNG_ACTION_TYPE_NOTIFY) {
                        /* "The action of trigger is not notify, skipping. */
                        continue;
                }
@@ -190,7 +190,7 @@ static int _main(int argc, char **argv)
                goto end;
        }
 
-       if (end_trigger_name != NULL && subcription_count != 2) {
+       if (end_trigger_name != nullptr && subcription_count != 2) {
                fprintf(stderr, "No matching end event trigger with a notify action found.\n");
                ret = -1;
                goto end;
@@ -232,7 +232,8 @@ static int _main(int argc, char **argv)
                }
 
                /* Early exit check. */
-               if (end_trigger_name != NULL && is_trigger_name(end_trigger_name, notification)) {
+               if (end_trigger_name != nullptr &&
+                   is_trigger_name(end_trigger_name, notification)) {
                        /* Exit the loop immediately. */
                        printf("Received end event notification from trigger %s\n",
                               end_trigger_name);
@@ -249,7 +250,7 @@ static int _main(int argc, char **argv)
 
                printf("Received event notification from trigger %s\n", expected_trigger_name);
                notification_count++;
-               if (end_trigger_name == NULL && expected_notifications == notification_count) {
+               if (end_trigger_name == nullptr && expected_notifications == notification_count) {
                        /*
                         * Here the loop exit is controlled by the number of
                         * notification and not by the reception of the end
index 52f6d26ca66a70799db00cd135d90478d9b3a52a..d45dfb799f56740924d5ec176d39859fc7ffa68a 100644 (file)
@@ -100,12 +100,12 @@ static void test_action_notify()
        lttng_payload_reset(&payload);
 }
 
-static void test_action_list(void)
+static void test_action_list()
 {
        int ret, action_idx;
-       struct lttng_action *list_action = NULL, *list_action_from_buffer = NULL,
-                           *stop_session_action = NULL, *notify_action = NULL,
-                           *start_session_action = NULL;
+       struct lttng_action *list_action = nullptr, *list_action_from_buffer = nullptr,
+                           *stop_session_action = nullptr, *notify_action = nullptr,
+                           *start_session_action = nullptr;
        struct lttng_payload payload;
 
        lttng_payload_init(&payload);
@@ -140,7 +140,7 @@ static void test_action_list(void)
 
        action_idx = 0;
        for (auto action : lttng::ctl::const_action_list_view(list_action)) {
-               enum lttng_action_type inner_action_type = lttng_action_get_type(action);
+               const lttng_action_type inner_action_type = lttng_action_get_type(action);
                switch (action_idx) {
                case 0:
                        ok(inner_action_type == LTTNG_ACTION_TYPE_START_SESSION,
@@ -160,7 +160,7 @@ static void test_action_list(void)
 
        action_idx = 0;
        for (auto action : lttng::ctl::action_list_view(list_action)) {
-               enum lttng_action_type inner_action_type = lttng_action_get_type(action);
+               const lttng_action_type inner_action_type = lttng_action_get_type(action);
                switch (action_idx) {
                case 0:
                        ok(inner_action_type == LTTNG_ACTION_TYPE_START_SESSION,
@@ -186,7 +186,7 @@ static void test_action_list(void)
        lttng_payload_reset(&payload);
 }
 
-static void test_action_rotate_session(void)
+static void test_action_rotate_session()
 {
        int ret;
        enum lttng_action_status status;
index 69812de43301952434d9ea8334a9cef0a0d05946..703b1c3c1ed3f2ddb7d0d0dc7f9f3e20bc15e0b6 100644 (file)
@@ -19,8 +19,8 @@ int lttng_opt_mi;
 static void test_contains_string()
 {
        const char buf[] = { 'A', 'l', 'l', 'o', '\0' };
-       struct lttng_buffer_view view = lttng_buffer_view_init(buf, 0, 5);
-       struct lttng_buffer_view view_minus_one = lttng_buffer_view_init(buf, 0, 4);
+       const lttng_buffer_view view = lttng_buffer_view_init(buf, 0, 5);
+       const lttng_buffer_view view_minus_one = lttng_buffer_view_init(buf, 0, 4);
 
        ok1(!lttng_buffer_view_contains_string(&view, buf, 4));
        ok1(lttng_buffer_view_contains_string(&view, buf, 5));
index cdc622a04e463e30dbdd6971bd3e6a03d55f39ab..b9924e3bcebd8a6868d25910c54e0b712a175d66 100644 (file)
@@ -167,8 +167,8 @@ static void untrack_std_fds(struct fd_tracker *tracker)
        };
 
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
-               int fd = files[i].fd;
-               int ret = fd_tracker_close_unsuspendable_fd(
+               const int fd = files[i].fd;
+               const int ret = fd_tracker_close_unsuspendable_fd(
                        tracker, &files[i].fd, 1, noop_close, nullptr);
 
                ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd, files[i].name);
@@ -299,7 +299,7 @@ static int open_pipes(void *data __attribute__((unused)), int *out_fds)
        const unsigned int pipe_count = TRACKER_FD_LIMIT / 2;
 
        for (i = 0; i < pipe_count; i++) {
-               int ret = pipe(&out_fds[i * 2]);
+               const int ret = pipe(&out_fds[i * 2]);
 
                if (ret) {
                        return -errno;
@@ -314,7 +314,7 @@ static int close_pipes(void *data __attribute__((unused)), int *fds)
        int *pipes = fds;
 
        for (i = 0; i < TRACKER_FD_LIMIT; i++) {
-               int ret = close(pipes[i]);
+               const int ret = close(pipes[i]);
 
                if (ret) {
                        return -errno;
index 209253267b176dadb29d1de1eac78485bdb7912a..4cd2704112238201caf3a2ee860fea99ff25c9c9 100644 (file)
@@ -145,7 +145,7 @@ static void test_log_level_rule_is_equal_at_least_as_severe_as()
 
 static void test_log_level_rule_exactly()
 {
-       int level = 9000;
+       const int level = 9000;
        int _level;
        struct lttng_log_level_rule *exactly = nullptr;
        enum lttng_log_level_rule_status status;
@@ -167,7 +167,7 @@ static void test_log_level_rule_exactly()
 
 static void test_log_level_rule_at_least_as_severe_as()
 {
-       int level = 9000;
+       const int level = 9000;
        int _level;
        struct lttng_log_level_rule *at_least_as_severe_as = nullptr;
        enum lttng_log_level_rule_status status;
index 419fc893d23796609aac808dc153c78f2e8551a2..9b9f770466ed6dd53cb0dc5b6c97fe0aa818eda2 100644 (file)
@@ -29,7 +29,7 @@ static void test_fd_push_pop_order()
 
        diag("Validating fd push/pop order");
        for (i = 0; i < 3; i++) {
-               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+               const int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
                struct fd_handle *handle;
 
                LTTNG_ASSERT(fd >= 0);
@@ -77,7 +77,7 @@ static void test_fd_push_pop_imbalance()
        diag("Validating fd pop imbalance");
        for (i = 0; i < 10; i++) {
                struct fd_handle *handle;
-               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+               const int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
 
                LTTNG_ASSERT(fd >= 0);
 
@@ -118,7 +118,7 @@ fail:
 static void test_fd_pop_fd_root_views()
 {
        int ret, i;
-       int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+       const int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
        struct fd_handle *handle;
        struct lttng_payload payload;
        const char *const test_description =
index 40ac0b4d6a118f1faa17d8e59b4a1dd9513dfc13..6a12d3422b4b350c1969fca7f4da45352c1c62e4 100644 (file)
@@ -33,8 +33,8 @@ static void test_rate_policy_every_n()
        struct lttng_rate_policy *policy_b = nullptr; /* Interval of 100 */
        struct lttng_rate_policy *policy_c = nullptr; /* Interval of 1 */
        struct lttng_rate_policy *policy_from_buffer = nullptr;
-       uint64_t interval_a_b = 100;
-       uint64_t interval_c = 1;
+       const uint64_t interval_a_b = 100;
+       const uint64_t interval_c = 1;
        uint64_t interval_query = 0;
        struct lttng_payload payload;
 
@@ -117,8 +117,8 @@ static void test_rate_policy_once_after_n()
        struct lttng_rate_policy *policy_b = nullptr; /* threshold of 100 */
        struct lttng_rate_policy *policy_c = nullptr; /* threshold of 1 */
        struct lttng_rate_policy *policy_from_buffer = nullptr;
-       uint64_t threshold_a_b = 100;
-       uint64_t threshold_c = 1;
+       const uint64_t threshold_a_b = 100;
+       const uint64_t threshold_c = 1;
        uint64_t threshold_query = 0;
        struct lttng_payload payload;
 
index 527d41ac920041bc0c8631f137aa0d70be442878..7c63da872e212f6ef026822fb2720a7fc9c1b901 100644 (file)
@@ -175,7 +175,7 @@ end:
 int main()
 {
        int i;
-       int num_test = sizeof(tests) / sizeof(struct test);
+       const int num_test = sizeof(tests) / sizeof(struct test);
        const time_t test_time = time(nullptr);
 
        plan_tests(NUM_TESTS_PER_TEST * num_test);
index e0af6e2969b4125417d0ec11d98659cac54ff32d..95a6173b8e75a15d9183348b34d2f350e10b1f09 100644 (file)
@@ -70,7 +70,7 @@ static void test_high_fd_count(unsigned int fd_count)
 
        for (i = 0; i < fd_count; i++) {
                struct fd_handle *handle;
-               int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
+               const int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
 
                if (fd < 0) {
                        PERROR("Failed to create fd while creating test payload");
index 8809448caf5b62e781e352efe169916a5394c9c2..4f460963fdd99dae922d93efd67e485b225ae085 100644 (file)
@@ -85,7 +85,7 @@ struct tree_symlink tree_symlinks[] = {
 };
 const int num_tree_symlinks = sizeof(tree_symlinks) / sizeof(tree_symlinks[0]);
 
-static struct symlink_test_input symlink_tests_inputs[] = {
+struct symlink_test_input symlink_tests_inputs[] = {
        { "a/g/../l/.", "a/b/l" },  { "a/g/../l/./", "a/b/l/" }, { "a/g/../l/..", "a/b" },
        { "a/g/../l/../", "a/b/" }, { "a/b/h/g/", "" },
 };
index 170e375924b5a72e8abee303d2a684323cded093..cd3567b307ce7f844b9de9ac1f4a3a9ee27569b9 100644 (file)
@@ -56,15 +56,15 @@ public:
        {
        }
 
-       event_name_set(event_name_set&& original) :
+       event_name_set(event_name_set&& original) noexcept :
                lttng::utils::random_access_container_wrapper<const bt_value *,
                                                              const char *,
                                                              event_name_set_operations>(
-                       std::move(original._container))
+                       original._container)
        {
        }
 
-       event_name_set(const bt_value *names) :
+       explicit event_name_set(const bt_value *names) :
                lttng::utils::random_access_container_wrapper<const bt_value *,
                                                              const char *,
                                                              event_name_set_operations>(names)
@@ -102,9 +102,7 @@ struct event_name_iterator_data {
        {
        }
 
-       ~event_name_iterator_data()
-       {
-       }
+       ~event_name_iterator_data() = default;
 
        const lttng::bt2::message_iterator_ref upstream_iterator;
        const class event_name_filter& event_name_filter;
@@ -161,7 +159,7 @@ event_name_initialize(bt_self_component_filter *self_comp,
        }
 
        try {
-               event_name_set event_names{ names_param };
+               const event_name_set event_names{ names_param };
                if (event_names.empty()) {
                        BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_COMPONENT(
                                bt_self_component_filter_as_self_component(self_comp),
index dc8894fd8a0b2ac594407d7c64f7480b086f6bc3..e3be5558ff9b5a148e27753b2414b9dd6c29985b 100644 (file)
 #include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
+#include <utility>
 
 class bad_alloc_with_msg : public std::bad_alloc {
 public:
-       explicit bad_alloc_with_msg(const std::string& msg) : _msg(msg)
+       explicit bad_alloc_with_msg(std::string msg) : _msg(std::move(msg))
        {
        }
 
-       virtual const char *what() const noexcept override
+       const char *what() const noexcept override
        {
                return _msg.c_str();
        }
@@ -45,9 +46,7 @@ public:
                }
        }
 
-       ~field_stats()
-       {
-       }
+       ~field_stats() = default;
 
        lttng::bt2::message_iterator_ref upstream_iterator;
        lttng::bt2::event_class_const_ref event_class;
index 52199240e908ec2f897120a12f479bd8d46cf4d9..6e0eaa3dfb395faa4c610b9dbba076f817ddb7f8 100644 (file)
@@ -7,14 +7,14 @@
 #include "obj.h"
 #include "tp.h"
 
-void test_constructor1(void) __attribute__((constructor));
-void test_constructor1(void)
+void test_constructor1() __attribute__((constructor));
+void test_constructor1()
 {
        tracepoint(tp, constructor_c_across_units_before_define);
 }
 
-void test_destructor1(void) __attribute__((destructor));
-void test_destructor1(void)
+void test_destructor1() __attribute__((destructor));
+void test_destructor1()
 {
        tracepoint(tp, destructor_c_across_units_before_define);
 }
index 9d550fcc8c92412781d79d1cf0a8d269e1d6cdd5..777df2d9561197993197ded6cc78326589deadc9 100644 (file)
@@ -6,17 +6,17 @@
 
 #include "obj.h"
 
-static void fct_constructor2(void);
-static void fct_destructor2(void);
+static void fct_constructor2();
+static void fct_destructor2();
 
-void test_constructor2_same_unit_before(void) __attribute__((constructor));
-void test_constructor2_same_unit_before(void)
+void test_constructor2_same_unit_before() __attribute__((constructor));
+void test_constructor2_same_unit_before()
 {
        fct_constructor2();
 }
 
-void test_destructor2_same_unit_before(void) __attribute__((destructor));
-void test_destructor2_same_unit_before(void)
+void test_destructor2_same_unit_before() __attribute__((destructor));
+void test_destructor2_same_unit_before()
 {
        fct_destructor2();
 }
@@ -28,24 +28,24 @@ Obj g_obj_same_unit_before_define("global - same unit before define");
 
 Obj g_obj_same_unit_after_define("global - same unit after define");
 
-static void fct_constructor2(void)
+static void fct_constructor2()
 {
        tracepoint(tp, constructor_c_same_unit_before_define);
 }
 
-static void fct_destructor2(void)
+static void fct_destructor2()
 {
        tracepoint(tp, destructor_c_same_unit_before_define);
 }
 
-void test_constructor2_same_unit_after(void) __attribute__((constructor));
-void test_constructor2_same_unit_after(void)
+void test_constructor2_same_unit_after() __attribute__((constructor));
+void test_constructor2_same_unit_after()
 {
        tracepoint(tp, constructor_c_same_unit_after_define);
 }
 
-void test_destructor2_same_unit_after(void) __attribute__((destructor));
-void test_destructor2_same_unit_after(void)
+void test_destructor2_same_unit_after() __attribute__((destructor));
+void test_destructor2_same_unit_after()
 {
        tracepoint(tp, destructor_c_same_unit_after_define);
 }
index fba3c262e0a18c44b058a2ba774096af2608d2e5..e39cd39030b386511eed60a9ca9b0f7283c33da2 100644 (file)
@@ -7,14 +7,14 @@
 #include "obj.h"
 #include "tp.h"
 
-void test_constructor3(void) __attribute__((constructor));
-void test_constructor3(void)
+void test_constructor3() __attribute__((constructor));
+void test_constructor3()
 {
        tracepoint(tp, constructor_c_across_units_after_define);
 }
 
-void test_destructor3(void) __attribute__((destructor));
-void test_destructor3(void)
+void test_destructor3() __attribute__((destructor));
+void test_destructor3()
 {
        tracepoint(tp, destructor_c_across_units_after_define);
 }
index bebf0d23269f15c7aed2d01a6bba2a2b1f36ce3a..631700dfc63181a7a2f65af56c59a10166af5146 100644 (file)
@@ -6,17 +6,17 @@
 
 #include "obj.h"
 
-static void fct_constructor4(void);
-static void fct_destructor4(void);
+static void fct_constructor4();
+static void fct_destructor4();
 
-void test_constructor4_same_unit_before(void) __attribute__((constructor));
-void test_constructor4_same_unit_before(void)
+void test_constructor4_same_unit_before() __attribute__((constructor));
+void test_constructor4_same_unit_before()
 {
        fct_constructor4();
 }
 
-void test_destructor4_same_unit_before(void) __attribute__((destructor));
-void test_destructor4_same_unit_before(void)
+void test_destructor4_same_unit_before() __attribute__((destructor));
+void test_destructor4_same_unit_before()
 {
        fct_destructor4();
 }
@@ -28,24 +28,24 @@ Obj g_obj_same_unit_before_provider("global - same unit before provider");
 
 Obj g_obj_same_unit_after_provider("global - same unit after provider");
 
-static void fct_constructor4(void)
+static void fct_constructor4()
 {
        tracepoint(tp, constructor_c_same_unit_before_provider);
 }
 
-static void fct_destructor4(void)
+static void fct_destructor4()
 {
        tracepoint(tp, destructor_c_same_unit_before_provider);
 }
 
-void test_constructor4_same_unit_after(void) __attribute__((constructor));
-void test_constructor4_same_unit_after(void)
+void test_constructor4_same_unit_after() __attribute__((constructor));
+void test_constructor4_same_unit_after()
 {
        tracepoint(tp, constructor_c_same_unit_after_provider);
 }
 
-void test_destructor4_same_unit_after(void) __attribute__((destructor));
-void test_destructor4_same_unit_after(void)
+void test_destructor4_same_unit_after() __attribute__((destructor));
+void test_destructor4_same_unit_after()
 {
        tracepoint(tp, destructor_c_same_unit_after_provider);
 }
index 17d3a6e24cb08b92867f6d3d3487b00052c882d9..338304b43016a4f59fc1f54462c3f8d56aa13fdc 100644 (file)
@@ -7,14 +7,14 @@
 #include "obj.h"
 #include "tp.h"
 
-void test_constructor5(void) __attribute__((constructor));
-void test_constructor5(void)
+void test_constructor5() __attribute__((constructor));
+void test_constructor5()
 {
        tracepoint(tp, constructor_c_across_units_after_provider);
 }
 
-void test_destructor5(void) __attribute__((destructor));
-void test_destructor5(void)
+void test_destructor5() __attribute__((destructor));
+void test_destructor5()
 {
        tracepoint(tp, destructor_c_across_units_after_provider);
 }
index 118ce66bdd32ddd3c20151fede871d923c51b4b2..ca95ca4281d16b2911d75f767bc06113cc0036f8 100644 (file)
@@ -12,24 +12,24 @@ extern "C" {
 #include "tp.h"
 
 /* Use tracepoints defined and provided by static archive. */
-void test_constructor_a(void) __attribute__((constructor));
-void test_constructor_a(void)
+void test_constructor_a() __attribute__((constructor));
+void test_constructor_a()
 {
        tracepoint(tp_a_c, constructor_c_provider_static_archive);
 }
 
-void test_destructor_a(void) __attribute__((destructor));
-void test_destructor_a(void)
+void test_destructor_a() __attribute__((destructor));
+void test_destructor_a()
 {
        tracepoint(tp_a_c, destructor_c_provider_static_archive);
 }
 
 Obja g_obja_static_archive("global - static archive define and provider");
 
-int main(void)
+int main()
 {
-       Obj l_obj("main() local");
-       Obja l_obja("main() local - static archive define and provider");
+       const Obj l_obj("main() local");
+       const Obja l_obja("main() local - static archive define and provider");
 
        tracepoint(tp, main);
        return 0;
index 35240ac146d65375d00e3a106516f7327f57c650..7b1015b5b27d31f5aae1a93917d21ff02c463ea5 100644 (file)
 #include "tp.h"
 
 /* Use tracepoints defined and provided by shared libraries. */
-void test_constructor_so(void) __attribute__((constructor));
-void test_constructor_so(void)
+void test_constructor_so() __attribute__((constructor));
+void test_constructor_so()
 {
        tracepoint(tp_so_c, constructor_c_provider_shared_library);
 }
 
-void test_destructor_so(void) __attribute__((destructor));
-void test_destructor_so(void)
+void test_destructor_so() __attribute__((destructor));
+void test_destructor_so()
 {
        tracepoint(tp_so_c, destructor_c_provider_shared_library);
 }
 
 Objso g_objso_shared_library("global - shared library define and provider");
 
-int main(void)
+int main()
 {
-       Obj l_obj("main() local");
-       Objso l_objso("main() local - shared library define and provider");
+       const Obj l_obj("main() local");
+       const Objso l_objso("main() local - shared library define and provider");
 
        tracepoint(tp, main);
        return 0;
index cd341d8c79260bc218d8a9f2686ff09ece6f5949..85eccde8f373f514abf6aad77f83fa33c82396a2 100644 (file)
 
 struct Obj {
        const char *msg;
-       Obj(const char *msg);
+       explicit Obj(const char *msg);
        ~Obj();
 };
 
 struct Obja {
        const char *msg;
-       Obja(const char *msg);
+       explicit Obja(const char *msg);
        ~Obja();
 };
 
index 0efe5ab4fd47685adc0d79b3767ac550d4d651c2..a906fb0714e033e2ed25d38b296f6099ed853e3f 100644 (file)
 
 struct Obj {
        const char *msg;
-       Obj(const char *msg);
+       explicit Obj(const char *msg);
        ~Obj();
 };
 
 struct Objso {
        const char *msg;
-       Objso(const char *msg);
+       explicit Objso(const char *msg);
        ~Objso();
 };
 
index 3b62ed0dfee9a80baa82b6cb50c0c05dcd0232ec..0e6b4812a119130f656bef2bf6de384a14681dfb 100644 (file)
@@ -51,8 +51,8 @@ int main(int argc, char **argv)
        long values[] = { 1, 2, 3 };
        char text[10] = "test";
        char escape[10] = "\\*";
-       double dbl = 2.0;
-       float flt = 2222.0;
+       const double dbl = 2.0;
+       const float flt = 2222.0;
        uint32_t net_values[] = { 1, 2, 3 };
        int nr_iter = 100, ret = 0, first_event_file_created = 0;
        useconds_t nr_usec = 0;
index b7c3974ee52c268e2f1d93e09e29b9ba4d00c1ee..791aa67546b687f3e910889f9684ecc850b164db 100644 (file)
@@ -37,8 +37,8 @@ int main(int argc, char **argv)
        int i, netint, ret = 0, option_index, option;
        long values[] = { 1, 2, 3 };
        char text[10] = "test";
-       double dbl = 2.0;
-       float flt = 2222.0;
+       const double dbl = 2.0;
+       const float flt = 2222.0;
        unsigned int nr_iter = 100;
        useconds_t nr_usec = 0;
        char *wait_before_first_event_file_path = nullptr;
index 280f2ed0284b80736ce92485479c488ce75aad1b..2531d0832e0ea071db9ef10adc04fec9b6c0e0a2 100644 (file)
@@ -180,7 +180,7 @@ static int extract_xpath(const char *xml_path, const xmlChar *xpath)
        LTTNG_ASSERT(xml_path);
        LTTNG_ASSERT(xpath);
 
-       ll::parser_ctx_uptr parserCtx{ xmlNewParserCtxt() };
+       const ll::parser_ctx_uptr parserCtx{ xmlNewParserCtxt() };
 
        if (!parserCtx) {
                fprintf(stderr, "ERR: could not allocate an XML parser context\n");
This page took 0.14963 seconds and 4 git commands to generate.