Apply FixIts proposed by clang-tidy (mostly missing 'const' qualifiers).
Change-Id: Ic616ddf6e826ee787c048de3f18aec18f9481532
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Standard: Cpp11
TabWidth: 8
UseTab: Always
+QualifierAlignment: Left
...
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");
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;
*
* 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
* 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
};
#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
* 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
attr;
};
-#define LTTNG_EVENT_FIELD_PADDING LTTNG_SYMBOL_NAME_LEN + 32
+#define LTTNG_EVENT_FIELD_PADDING (LTTNG_SYMBOL_NAME_LEN + 32)
/*!
@brief
#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;
/* 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))
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`");
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) {
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);
}
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) {
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);
}
{
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)
{
/*
{
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;
ret = 0;
}
} else if (ret == 0) {
- int is_root = !getuid();
+ const int is_root = !getuid();
if (is_root) {
gid_t gid;
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) {
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) {
/*
* 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.
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. */
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) {
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) {
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(
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);
}
{
- 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)
{
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) {
* 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) {
}
{
- 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;
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,
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
/* 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) {
* 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);
* 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)) {
* 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)) {
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();
/* 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();
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) {
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) {
* 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) {
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);
}
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);
int session_abort(struct relay_session *session)
{
- int ret = 0;
+ const int ret = 0;
if (!session) {
return 0;
}
{
- 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)) {
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;
}
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,
* 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;
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);
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) {
*/
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. */
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
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"
}
{
- 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)) {
* 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) {
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)
{
}
{
- 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) {
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) {
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);
}
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
}
{
- 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) {
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) {
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) {
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) {
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
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 = {
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);
* 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) {
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) {
}
{
- 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) {
}
{
- 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) {
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) {
}
{
- 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) {
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;
* 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);
}
{
- 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;
* 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. */
}
{
- 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) {
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, ®->node.node);
LTTNG_ASSERT(nodep == ®->node.node);
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, ®->node);
}
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
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);
}
/* 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);
LTTNG_ASSERT(regp);
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(buffer_registry_uid, &iter);
LTTNG_ASSERT(!ret);
}
{
- 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) {
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);
/* 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;
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;
{
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) {
}
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;
}
}
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
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) {
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();
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);
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) {
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, ¤t_chunk_id.value);
if (status == LTTNG_TRACE_CHUNK_STATUS_OK) {
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) {
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) {
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:
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) {
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 ||
{
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);
}
}
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
switch (domain->type) {
case LTTNG_DOMAIN_KERNEL:
/* 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;
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) {
{
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;
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);
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) {
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) {
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,
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) {
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
/* 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) {
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, ¤t_chunk_id.value);
if (chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK) {
* 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);
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) {
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;
/* 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. */
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) {
/*
}
{
- 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);
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. */
{
/* 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);
/* 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;
/* 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;
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;
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());
*/
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 */
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) {
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))) {
* 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
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);
}
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) {
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) {
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);
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;
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) {
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);
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) {
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) {
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,
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
/* 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) {
{
/* 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++;
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) {
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) {
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);
/* 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)) {
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);
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);
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) {
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;
}
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);
void kernel_wait_quiescent()
{
int ret;
- int fd = kernel_tracer_fd;
+ const int fd = kernel_tracer_fd;
DBG("Kernel quiescent wait on %d", fd);
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) {
{
/* 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;
* 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) {
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);
/*
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 `{}`",
* 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) {
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);
/* 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);
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),
}
{
- 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;
}
{
- 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);
}
{
- 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) {
}
} 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) {
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)
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)
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)
{
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);
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;
}
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);
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);
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);
}
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);
{
/* 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) {
* 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),
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,
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 (
/* 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);
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);
{
/* 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;
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;
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",
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),
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) {
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) {
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)) {
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);
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) {
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);
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));
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) {
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),
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);
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) {
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;
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. */
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. */
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(¬ification->tracer_token, lttng_ht_seed),
match_trigger_token,
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,
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);
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);
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);
-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,
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 :
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));
}
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)) {
/*
{
/* 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;
}
{
- 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, <t_ust_event::node);
}
{
- 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;
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) {
}
{
- 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) {
}
{
- 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);
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`.
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);
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;
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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);
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);
/*
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
}
{
- 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);
/* 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;
}
{
- 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);
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);
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. */
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);
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;
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 =
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);
}
{
- 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) {
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,
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;
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;
}
{
- 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) {
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 += '_';
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);
{
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);
/* 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,
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);
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) {
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) {
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. */
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. */
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
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
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);
}
{
- 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;
}
{
- 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;
/* 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) {
/* 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);
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) {
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) {
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) {
*/
{
- 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) {
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) {
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(); });
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(); });
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();
/* 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;
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);
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(); });
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,
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);
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;
(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);
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);
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);
}
{
- 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,
}
{
- 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);
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);
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);
}
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) {
/*
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);
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);
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);
}
{
- 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",
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) {
{
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;
}
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;
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) {
}
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;
* 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;
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(); });
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) {
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,
}
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) {
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,
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.
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;
}
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;
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);
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;
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 */
{
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
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;
_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();
}
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();
}
}
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
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();
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
/* 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
*/
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
}
});
- 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;
{
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);
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;
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>();
{
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);
/* 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 =
}
} 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:
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();
*/
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) {
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);
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;
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;
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;
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;
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;
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';
}
}
{
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) {
}
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,
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;
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;
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);
}
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;
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;
}
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)) {
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;
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;
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)) {
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;
/* 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. */
{
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) {
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);
/* 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;
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);
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,
*_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),
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,
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);
{
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;
{
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;
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);
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) {
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) {
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);
*/
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;
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 */
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 */
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);
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:
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;
}
*/
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);
*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
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) {
*/
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
}
{
- 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
}
{
- 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
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. */
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;
}
/* 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) {
/* 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 */
* 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
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 */
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) {
continue;
}
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
{
uint64_t tmp_id = (uint64_t) pollfd;
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,
}
{
- 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);
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 */
* 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
continue;
}
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
{
uint64_t tmp_id = (uint64_t) pollfd;
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) {
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);
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();
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);
}
{
- 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,
* 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;
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. */
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,
}
{
- 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;
{
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) {
/*
{
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;
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) ||
}
{
- 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) ||
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)) {
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;
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)) {
{
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);
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:
{
/* 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(¤t_payload_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)) {
{
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)) {
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)) {
{
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)) {
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)) {
{
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)) {
/* 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)) {
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);
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) {
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) {
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) {
{
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
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) {
return;
}
if (registry->inodes) {
- int ret = cds_lfht_destroy(registry->inodes, nullptr);
+ const int ret = cds_lfht_destroy(registry->inodes, nullptr);
LTTNG_ASSERT(!ret);
}
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) {
// 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
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,
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);
}
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);
}
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);
}
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,
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,
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,
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,
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,
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;
}
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;
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;
}
}
const char *value)
{
int ret = 0;
- struct config_entry entry = { section, name, value };
+ const config_entry entry = { section, name, value };
LTTNG_ASSERT(args);
{
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++;
}
int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream)
{
int ret = 0;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot(infd);
/*
int lttng_kconsumer_get_produced_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
{
int ret;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot_get_produced(infd, pos);
if (ret != 0) {
int lttng_kconsumer_get_consumed_snapshot(struct lttng_consumer_stream *stream, unsigned long *pos)
{
int ret;
- int infd = stream->wait_fd;
+ const int infd = stream->wait_fd;
ret = kernctl_snapshot_get_consumed(infd, pos);
if (ret != 0) {
/* Prevent channel modifications while we perform the snapshot.*/
pthread_mutex_lock(&channel->lock);
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
/* Splice is not supported yet for channel snapshot. */
if (channel->output != CONSUMER_CHANNEL_MMAP) {
DBG("Kernel consumer snapshot metadata with key %" PRIu64 " at path %s", key, path);
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
metadata_stream = metadata_channel->metadata_stream;
LTTNG_ASSERT(metadata_stream);
health_code_update();
/* relayd needs RCU read-side protection */
- lttng::urcu::read_lock_guard read_lock;
+ const lttng::urcu::read_lock_guard read_lock;
switch (msg.cmd_type) {
case LTTNG_CONSUMER_ADD_RELAYD_SOCKET:
{
- uint32_t major = msg.u.relayd_sock.major;
- uint32_t minor = msg.u.relayd_sock.minor;
- enum lttcomm_sock_proto protocol =
+ const uint32_t major = msg.u.relayd_sock.major;
+ const uint32_t minor = msg.u.relayd_sock.minor;
+ const lttcomm_sock_proto protocol =
(enum lttcomm_sock_proto) msg.u.relayd_sock.relayd_socket_protocol;
/* Session daemon status message are handled in the following call. */
health_code_update();
if (ctx->on_recv_channel != nullptr) {
- int ret_recv_channel = ctx->on_recv_channel(new_channel);
+ const int ret_recv_channel = ctx->on_recv_channel(new_channel);
if (ret_recv_channel == 0) {
ret_add_channel = consumer_add_channel(new_channel, ctx);
} else if (ret_recv_channel < 0) {
pthread_mutex_lock(&new_stream->lock);
if (ctx->on_recv_stream) {
- int ret_recv_stream = ctx->on_recv_stream(new_stream);
+ const int ret_recv_stream = ctx->on_recv_stream(new_stream);
if (ret_recv_stream < 0) {
pthread_mutex_unlock(&new_stream->lock);
pthread_mutex_unlock(&channel->lock);
}
case LTTNG_CONSUMER_DESTROY_RELAYD:
{
- uint64_t index = msg.u.destroy_relayd.net_seq_idx;
+ const uint64_t index = msg.u.destroy_relayd.net_seq_idx;
struct consumer_relayd_sock_pair *relayd;
int ret_send_status;
case LTTNG_CONSUMER_DATA_PENDING:
{
int32_t ret_data_pending;
- uint64_t id = msg.u.data_pending.session_id;
+ const uint64_t id = msg.u.data_pending.session_id;
ssize_t ret_send;
DBG("Kernel consumer data pending command for id %" PRIu64, id);
case LTTNG_CONSUMER_SNAPSHOT_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.snapshot_channel.key;
+ const uint64_t key = msg.u.snapshot_channel.key;
int ret_send_status;
channel = consumer_find_channel(key);
}
case LTTNG_CONSUMER_DESTROY_CHANNEL:
{
- uint64_t key = msg.u.destroy_channel.key;
+ const uint64_t key = msg.u.destroy_channel.key;
struct lttng_consumer_channel *channel;
int ret_send_status;
ssize_t ret;
uint64_t count;
struct lttng_consumer_channel *channel;
- uint64_t id = msg.u.discarded_events.session_id;
- uint64_t key = msg.u.discarded_events.channel_key;
+ const uint64_t id = msg.u.discarded_events.session_id;
+ const uint64_t key = msg.u.discarded_events.channel_key;
DBG("Kernel consumer discarded events command for session id %" PRIu64
", channel key %" PRIu64,
ssize_t ret;
uint64_t count;
struct lttng_consumer_channel *channel;
- uint64_t id = msg.u.lost_packets.session_id;
- uint64_t key = msg.u.lost_packets.channel_key;
+ const uint64_t id = msg.u.lost_packets.session_id;
+ const uint64_t key = msg.u.lost_packets.channel_key;
DBG("Kernel consumer lost packets command for session id %" PRIu64
", channel key %" PRIu64,
case LTTNG_CONSUMER_ROTATE_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.rotate_channel.key;
+ const uint64_t key = msg.u.rotate_channel.key;
int ret_send_status;
DBG("Consumer rotate channel %" PRIu64, key);
case LTTNG_CONSUMER_CLEAR_CHANNEL:
{
struct lttng_consumer_channel *channel;
- uint64_t key = msg.u.clear_channel.key;
+ const uint64_t key = msg.u.clear_channel.key;
int ret_send_status;
channel = consumer_find_channel(key);
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;
}
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;
/* 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);
}
~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()
return;
}
- typename CustomDeleter::deleter del;
+ const typename CustomDeleter::deleter del;
del(_value);
release();
}
}
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);
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;
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;
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;
}
}
if (*s == delim) {
- size_t last_len = s - last - 1;
+ const size_t last_len = s - last - 1;
last = s;
number_of_substrings++;
{
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) {
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;
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;
{
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;
element = lttng::utils::container_of(chunk,
<tng_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 {
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);
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;
}
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,
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;
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,
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) {
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;
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;
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 */
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);
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;
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__ */
~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;
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);
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);
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);
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);
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);
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);
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;
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. */
}
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);
{
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);
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);
}
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
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);
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);
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);
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);
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);
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);
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();
{
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;
*
* @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;
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();
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;
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;
{
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) {
{
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) {
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);
!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;
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> {};
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 {
};
} /* namespace */
-static void test_select_big(void)
+static void test_select_big()
{
fd_set rfds, wfds, exfds;
struct timeval tv;
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) {
}
}
-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;
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) {
}
}
-static void test_poll(void)
+static void test_poll()
{
struct pollfd ufds[NB_FD];
char buf[BUF_SIZE];
}
}
-static void test_ppoll(void)
+static void test_ppoll()
{
test_ppoll_generic(SYS_ppoll);
}
ufds[i].events = POLLIN | POLLPRI;
}
- ret = ppoll(ufds, MAX_FDS, NULL, NULL);
+ ret = ppoll(ufds, MAX_FDS, nullptr, nullptr);
if (ret < 0) {
PERROR("ppoll");
}
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) {
usleep(100);
}
- return NULL;
+ return nullptr;
}
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");
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;
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;
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;
}
/*
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,
}
}
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);
}
stop_thread = 1;
- ret = pthread_join(writer, NULL);
+ ret = pthread_join(writer, nullptr);
if (ret) {
fprintf(stderr, "[error] pthread_join\n");
goto error_unmap;
return;
}
-static void print_list(void)
+static void print_list()
{
printf("Test list (-t X):\n");
}
}
-static void print_test_syscalls(void)
+static void print_test_syscalls()
{
const char *supported_syscalls[] = {
#ifdef SYS_select
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);
* 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. */
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);
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)
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;
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) {
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;
}
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;
}
/* 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);
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
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);
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,
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,
lttng_payload_reset(&payload);
}
-static void test_action_rotate_session(void)
+static void test_action_rotate_session()
{
int ret;
enum lttng_action_status status;
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));
};
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);
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;
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;
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;
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;
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);
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);
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 =
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;
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;
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);
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");
};
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/", "" },
};
{
}
- 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)
{
}
- ~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;
}
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),
#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();
}
}
}
- ~field_stats()
- {
- }
+ ~field_stats() = default;
lttng::bt2::message_iterator_ref upstream_iterator;
lttng::bt2::event_class_const_ref event_class;
#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);
}
#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();
}
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);
}
#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);
}
#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();
}
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);
}
#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);
}
#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;
#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;
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();
};
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();
};
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;
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;
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");