#include <lttng/lttng.h>
-#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <sys/time.h>
#include <time.h>
+#include <common/macros.h>
+
static int print_capture(const struct lttng_condition *condition,
const struct lttng_event_field_value *capture,
unsigned int indent_level);
parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
event_expr);
- assert(parent_expr != NULL);
+ LTTNG_ASSERT(parent_expr != NULL);
print_one_event_expr(parent_expr);
status = lttng_event_expr_array_field_element_get_index(
event_expr, &index);
- assert(status == LTTNG_EVENT_EXPR_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
printf("[%u]", index);
const struct lttng_event_expr *expr =
lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
condition, i);
- assert(expr);
+ LTTNG_ASSERT(expr);
indent(indent_level + 1);
const struct lttng_event_field_value *captured_field_array = NULL;
unsigned int expected_capture_field_count;
- assert(lttng_evaluation_get_type(evaluation) ==
+ LTTNG_ASSERT(lttng_evaluation_get_type(evaluation) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
condition_status =
#ifndef LTTNG_EVENT_EXPR_INTERNAL_H
#define LTTNG_EVENT_EXPR_INTERNAL_H
-#include <assert.h>
#include <common/macros.h>
#include <lttng/event-expr.h>
static inline
bool lttng_event_expr_is_lvalue(const struct lttng_event_expr *expr)
{
- assert(expr);
+ LTTNG_ASSERT(expr);
return expr->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD ||
expr->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD ||
expr->type == LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD ||
#ifndef LTTNG_EVENT_FIELD_VALUE_INTERNAL_H
#define LTTNG_EVENT_FIELD_VALUE_INTERNAL_H
-#include <assert.h>
#include <stdint.h>
#include <lttng/event-field-value.h>
#include <common/dynamic-array.h>
*
*/
-#include <assert.h>
#include <common/compat/time.h>
#include <pthread.h>
#include <urcu/tls-compat.h>
/*
* Update current counter by 1 to indicate that the thread entered or left a
* blocking state caused by a poll(). If the counter's value is not an even
- * number (meaning a code execution flow), an assert() is raised.
+ * number (meaning a code execution flow), an LTTNG_ASSERT() is raised.
*/
static inline void health_poll_entry(void)
{
/* Code MUST be in code execution state which is an even number. */
- assert(!(uatomic_read(&URCU_TLS(health_state).current)
+ LTTNG_ASSERT(!(uatomic_read(&URCU_TLS(health_state).current)
& HEALTH_POLL_VALUE));
uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
/*
* Update current counter by 1 indicating the exit of a poll or blocking call.
- * If the counter's value is not an odd number (a poll execution), an assert()
+ * If the counter's value is not an odd number (a poll execution), an LTTNG_ASSERT()
* is raised.
*/
static inline void health_poll_exit(void)
{
/* Code MUST be in poll execution state which is an odd number. */
- assert(uatomic_read(&URCU_TLS(health_state).current)
+ LTTNG_ASSERT(uatomic_read(&URCU_TLS(health_state).current)
& HEALTH_POLL_VALUE);
uatomic_add(&URCU_TLS(health_state).current, HEALTH_POLL_VALUE);
*
*/
-#include <assert.h>
typedef void (*lttng_release_func)(void *);
static inline
void lttng_ref_init(struct lttng_ref *ref, lttng_release_func release)
{
- assert(ref);
+ LTTNG_ASSERT(ref);
ref->count = 1;
ref->release = release;
}
static inline
void lttng_ref_get(struct lttng_ref *ref)
{
- assert(ref);
+ LTTNG_ASSERT(ref);
ref->count++;
/* Overflow check. */
- assert(ref->count);
+ LTTNG_ASSERT(ref->count);
}
static inline
void lttng_ref_put(struct lttng_ref *ref)
{
- assert(ref);
+ LTTNG_ASSERT(ref);
/* Underflow check. */
- assert(ref->count);
+ LTTNG_ASSERT(ref->count);
if (caa_unlikely((--ref->count) == 0)) {
ref->release(ref);
}
#include <poll.h>
#include <unistd.h>
#include <sys/mman.h>
-#include <assert.h>
#include <urcu/compiler.h>
#include <ulimit.h>
#include <inttypes.h>
rcu_thread_online();
- assert(msg.cmd == HEALTH_CMD_CHECK);
+ LTTNG_ASSERT(msg.cmd == HEALTH_CMD_CHECK);
memset(&reply, 0, sizeof(reply));
for (i = 0; i < NR_HEALTH_CONSUMERD_TYPES; i++) {
#include <poll.h>
#include <unistd.h>
#include <sys/mman.h>
-#include <assert.h>
#include <urcu/compiler.h>
#include <ulimit.h>
*/
#include "common/time.h"
-#include <assert.h>
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
const char *hostname_ptr;
regex_t regex;
- assert(path);
- assert(local_session_name);
- assert(local_session_name[0] != '\0');
+ LTTNG_ASSERT(path);
+ LTTNG_ASSERT(local_session_name);
+ LTTNG_ASSERT(local_session_name[0] != '\0');
DBG("Parsing path \"%s\" of session \"%s\" to create a new path that is grouped by session",
path, local_session_name);
const ssize_t local_session_name_offset =
strlen(local_session_name) - DATETIME_STR_LEN + 1;
- assert(local_session_name_offset >= 0);
+ LTTNG_ASSERT(local_session_name_offset >= 0);
datetime = strdup(local_session_name +
local_session_name_offset);
if (!datetime) {
* "name-<datetime>" format. Using the datetime from such a
* session would be invalid.
* */
- assert(partial_base_path == NULL);
- assert(datetime == NULL);
+ LTTNG_ASSERT(partial_base_path == NULL);
+ LTTNG_ASSERT(datetime == NULL);
partial_base_path = strdup(second_token_ptr);
if (!partial_base_path) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/sessiond-comm/relayd.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <common/common.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/sessiond-comm/relayd.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/sessiond-comm/relayd.h>
struct lttng_ht_iter iter;
struct relay_connection *conn = NULL;
- assert(sock >= 0);
+ LTTNG_ASSERT(sock >= 0);
rcu_read_lock();
lttng_ht_lookup(relay_connections_ht, (void *)((unsigned long) sock),
iter.iter.node = &conn->sock_n.node;
ret = lttng_ht_del(conn->socket_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (conn->session) {
void connection_ht_add(struct lttng_ht *relay_connections_ht,
struct relay_connection *conn)
{
- assert(!conn->in_socket_ht);
+ LTTNG_ASSERT(!conn->in_socket_ht);
lttng_ht_add_unique_ulong(relay_connections_ht, &conn->sock_n);
conn->in_socket_ht = 1;
conn->socket_ht = relay_connections_ht;
{
int ret = 0;
- assert(conn);
- assert(session);
- assert(!conn->session);
+ LTTNG_ASSERT(conn);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(!conn->session);
if (connection_get(conn)) {
if (session_get(session)) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/utils.h>
* have put back their ref since the've been closed by the
* control side.
*/
- assert(cds_list_empty(&trace->stream_list));
+ LTTNG_ASSERT(cds_list_empty(&trace->stream_list));
session_put(trace->session);
trace->session = NULL;
free(trace->path);
iter.iter.node = &trace->node.node;
ret = lttng_ht_del(trace->session->ctf_traces_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ctf_trace_destroy(trace);
}
#include <poll.h>
#include <unistd.h>
#include <sys/mman.h>
-#include <assert.h>
#include <urcu/compiler.h>
#include <inttypes.h>
rcu_thread_online();
- assert(msg.cmd == HEALTH_CMD_CHECK);
+ LTTNG_ASSERT(msg.cmd == HEALTH_CMD_CHECK);
memset(&reply, 0, sizeof(reply));
for (i = 0; i < NR_HEALTH_RELAYD_TYPES; i++) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/utils.h>
/* Delete index from hash table. */
iter.iter.node = &index->index_n.node;
ret = lttng_ht_del(stream->indexes_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
stream->indexes_in_flight--;
}
* Index lock ensures that concurrent test and update of stream
* ref is atomic.
*/
- assert(index->ref.refcount != 0);
+ LTTNG_ASSERT(index->ref.refcount != 0);
urcu_ref_put(&index->ref, index_release);
rcu_read_unlock();
}
struct ctf_trace *ctf_trace;
struct relay_stream *relay_stream = NULL;
- assert(relay_session);
+ LTTNG_ASSERT(relay_session);
ASSERT_LOCKED(relay_session->lock);
if (relay_session->connection_closed) {
reference_acquired = lttng_trace_chunk_get(
viewer_session->current_trace_chunk);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
viewer_stream_trace_chunk =
viewer_session->current_trace_chunk;
}
uint64_t session_id;
bool closed = false;
- assert(conn);
+ LTTNG_ASSERT(conn);
DBG("Get new streams received");
bool closed = false;
uint64_t session_id;
- assert(conn);
+ LTTNG_ASSERT(conn);
health_code_update();
vstream->stream->stream_handle);
goto index_ready;
}
- assert(tracefile_array_seq_in_file(rstream->tfa,
+ LTTNG_ASSERT(tracefile_array_seq_in_file(rstream->tfa,
vstream->current_tracefile_id,
vstream->index_sent_seqcount));
}
const bool acquired_reference = lttng_trace_chunk_get(
new_trace_chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
}
vstream->stream_file.trace_chunk = new_trace_chunk;
struct ctf_trace *ctf_trace = NULL;
struct relay_viewer_stream *metadata_viewer_stream = NULL;
- assert(conn);
+ LTTNG_ASSERT(conn);
DBG("Viewer get next index");
goto send_reply;
}
/* At this point, ret is 0 thus we will be able to read the index. */
- assert(!ret);
+ LTTNG_ASSERT(!ret);
/* Try to open an index if one is needed for that stream. */
ret = try_open_index(vstream, rstream);
struct lttng_viewer_metadata_packet reply;
struct relay_viewer_stream *vstream = NULL;
- assert(conn);
+ LTTNG_ASSERT(conn);
DBG("Relay get metadata");
vstream->stream_file.trace_chunk);
lttng_trace_chunk_put(vstream->stream_file.trace_chunk);
acquired_reference = lttng_trace_chunk_get(conn->viewer_session->current_trace_chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
vstream->stream_file.trace_chunk =
conn->viewer_session->current_trace_chunk;
viewer_stream_close_files(vstream);
DBG("Viewer detach session received");
- assert(conn);
+ LTTNG_ASSERT(conn);
health_code_update();
newsock = accept_relayd_sock(data_sock,
"Data socket to relayd");
} else {
- assert(pollfd == control_sock->fd);
+ LTTNG_ASSERT(pollfd == control_sock->fd);
type = RELAY_CONTROL;
newsock = accept_relayd_sock(control_sock,
"Control socket to relayd");
ret = -1;
goto send_reply;
}
- assert(!conn->session);
+ LTTNG_ASSERT(!conn->session);
conn->session = session;
DBG("Created session %" PRIu64, session->id);
} else if (conn->minor >= 4 && conn->minor < 11) {
char *group_by_session_path_name;
- assert(session->session_name[0] != '\0');
+ LTTNG_ASSERT(session->session_name[0] != '\0');
group_by_session_path_name =
backward_compat_group_by_session(
struct lttcomm_relayd_generic_reply reply;
struct relay_stream *stream;
- assert(recv_hdr);
- assert(conn);
+ LTTNG_ASSERT(recv_hdr);
+ LTTNG_ASSERT(conn);
DBG("Init streams for data pending");
struct relay_stream *stream;
size_t msg_len;
- assert(conn);
+ LTTNG_ASSERT(conn);
DBG("Relay receiving index");
ssize_t send_ret;
struct lttcomm_relayd_generic_reply reply;
- assert(conn);
+ LTTNG_ASSERT(conn);
DBG("Relay receiving streams_sent");
goto end;
}
- assert(conn->session->output_directory);
+ LTTNG_ASSERT(conn->session->output_directory);
chunk_status = lttng_trace_chunk_set_as_owner(chunk,
conn->session->output_directory);
if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
goto end;
}
- assert(ret > 0);
- assert(ret <= state->left_to_receive);
+ LTTNG_ASSERT(ret > 0);
+ LTTNG_ASSERT(ret <= state->left_to_receive);
state->left_to_receive -= ret;
state->received += ret;
struct ctrl_connection_state_receive_header *state =
&conn->protocol.ctrl.state.receive_header;
- assert(state->left_to_receive != 0);
+ LTTNG_ASSERT(state->left_to_receive != 0);
ret = conn->sock->ops->recvmsg(conn->sock,
reception_buffer->data + state->received,
goto end;
}
- assert(ret > 0);
- assert(ret <= state->left_to_receive);
+ LTTNG_ASSERT(ret > 0);
+ LTTNG_ASSERT(ret <= state->left_to_receive);
state->left_to_receive -= ret;
state->received += ret;
struct lttcomm_relayd_data_hdr header;
struct relay_stream *stream;
- assert(state->left_to_receive != 0);
+ LTTNG_ASSERT(state->left_to_receive != 0);
ret = conn->sock->ops->recvmsg(conn->sock,
state->header_reception_buffer + state->received,
goto end;
}
- assert(ret > 0);
- assert(ret <= state->left_to_receive);
+ LTTNG_ASSERT(ret > 0);
+ LTTNG_ASSERT(ret <= state->left_to_receive);
state->left_to_receive -= ret;
state->received += ret;
packet_chunk = lttng_buffer_view_init(data_buffer,
0, recv_size);
- assert(packet_chunk.data);
+ LTTNG_ASSERT(packet_chunk.data);
ret = stream_write(stream, &packet_chunk, 0);
if (ret) {
ctrl_conn = connection_get_by_sock(relay_connections_ht, pollfd);
/* If not found, there is a synchronization issue. */
- assert(ctrl_conn);
+ LTTNG_ASSERT(ctrl_conn);
if (ctrl_conn->type == RELAY_DATA) {
if (revents & LPOLLIN) {
}
goto put_ctrl_connection;
}
- assert(ctrl_conn->type == RELAY_CONTROL);
+ LTTNG_ASSERT(ctrl_conn->type == RELAY_CONTROL);
if (revents & LPOLLIN) {
enum relay_connection_status status;
if (data_conn->type == RELAY_CONTROL) {
goto put_data_connection;
}
- assert(data_conn->type == RELAY_DATA);
+ LTTNG_ASSERT(data_conn->type == RELAY_DATA);
if (revents & LPOLLIN) {
enum relay_connection_status status;
int ret;
struct relay_session *session = NULL;
- assert(session_name);
- assert(hostname);
- assert(base_path);
+ LTTNG_ASSERT(session_name);
+ LTTNG_ASSERT(hostname);
+ LTTNG_ASSERT(base_path);
if (!is_name_path_safe(session_name)) {
ERR("Refusing to create session as the provided session name is not path-safe");
goto error;
}
- assert(session_output_directory);
+ LTTNG_ASSERT(session_output_directory);
session->output_directory = session_output_directory;
} else if (!id_sessiond) {
/*
int ret;
ret = session_delete(session);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
lttng_trace_chunk_put(session->current_trace_chunk);
session->current_trace_chunk = NULL;
lttng_trace_chunk_put(session->pending_closure_trace_chunk);
session->pending_closure_trace_chunk = NULL;
ret = sessiond_trace_chunk_registry_session_destroyed(
sessiond_trace_chunk_registry, session->sessiond_uuid);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
lttng_directory_handle_put(session->output_directory);
session->output_directory = NULL;
call_rcu(&session->rcu_node, rcu_destroy_session);
{
int ret = cds_lfht_destroy(sessiond_registry->ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
free(sessiond_registry);
}
* trace chunk.
*/
acquired_reference = lttng_trace_chunk_get(stream->trace_chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
previous_chunk = stream->trace_chunk;
/*
* the orinal stream_fd will be used to copy the "extra" data
* to the new file.
*/
- assert(stream->file);
+ LTTNG_ASSERT(stream->file);
previous_stream_file = stream->file;
stream->file = NULL;
- assert(!stream->is_metadata);
- assert(stream->tracefile_size_current >
+ LTTNG_ASSERT(!stream->is_metadata);
+ LTTNG_ASSERT(stream->tracefile_size_current >
stream->pos_after_last_complete_data_index);
misplaced_data_size = stream->tracefile_size_current -
stream->pos_after_last_complete_data_index;
goto end;
}
- assert(stream->file);
+ LTTNG_ASSERT(stream->file);
/*
* Seek the current tracefile to the position at which the rotation
* should have occurred.
* In overwrite mode, the packet seq num may jump over the
* rotation position.
*/
- assert(LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 >=
+ LTTNG_ASSERT(LTTNG_OPTIONAL_GET(stream->received_packet_seq_num) + 1 >=
stream->ongoing_rotation.value.packet_seq_num);
DBG("Rotating stream %" PRIu64 " index file",
stream->stream_handle);
lttng_trace_chunk_put(stream->trace_chunk);
acquired_reference = lttng_trace_chunk_get(chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
stream->trace_chunk = chunk;
if (stream->file) {
iter.iter.node = &stream->node.node;
ret = lttng_ht_del(relay_streams_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
stream->in_stream_ht = false;
}
if (stream->published) {
void stream_put(struct relay_stream *stream)
{
rcu_read_lock();
- assert(stream->ref.refcount != 0);
+ LTTNG_ASSERT(stream->ref.refcount != 0);
/*
* Wait until we have processed all the stream packets before
* actually putting our last stream reference.
const bool reference_acquired =
lttng_trace_chunk_get(next_trace_chunk);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
}
LTTNG_OPTIONAL_SET(&stream->ongoing_rotation, rotation);
uint64_t data_offset;
struct relay_index *index;
- assert(stream->trace_chunk);
+ LTTNG_ASSERT(stream->trace_chunk);
ASSERT_LOCKED(stream->lock);
/* Get data offset because we are about to update the index. */
data_offset = htobe64(stream->tracefile_size_current);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/utils.h>
#include <common/defaults.h>
*/
return true;
}
- assert(file_index < tfa->count);
+ LTTNG_ASSERT(file_index < tfa->count);
if (seq == -1ULL) {
return false;
}
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
*/
char *create_output_path(const char *path_name)
{
- assert(path_name);
+ LTTNG_ASSERT(path_name);
if (opt_output_path == NULL) {
return create_output_path_auto(path_name);
} else {
int ret;
- assert(!vsession->current_trace_chunk);
+ LTTNG_ASSERT(!vsession->current_trace_chunk);
session->viewer_attached = true;
ret = viewer_session_set_trace_chunk_copy(vsession,
const bool acquired_reference = lttng_trace_chunk_get(
trace_chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
}
vstream->stream_file.trace_chunk = trace_chunk;
iter.iter.node = &vstream->stream_n.node;
ret = lttng_ht_del(viewer_streams_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
static void viewer_stream_release(struct urcu_ref *ref)
* has been data written at some point, which will have set the
* tail.
*/
- assert(seq_tail != -1ULL);
+ LTTNG_ASSERT(seq_tail != -1ULL);
/*
* We need to resync because we lag behind tail.
*/
{
const enum lttng_action_type action_type = lttng_action_get_type(action);
- assert(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
+ LTTNG_ASSERT(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
return lttng_action_type_string(action_type);
}
struct lttng_action *action = item->action;
const enum lttng_action_type action_type = lttng_action_get_type(action);
- assert(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
+ LTTNG_ASSERT(action_type != LTTNG_ACTION_TYPE_UNKNOWN);
lttng_action_increase_execution_request_count(action);
if (!lttng_action_should_execute(action)) {
{
struct action_executor *executor = _data;
- assert(executor);
+ LTTNG_ASSERT(executor);
health_register(the_health_sessiond,
HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
trigger_status = lttng_trigger_get_owner_uid(
work_item->trigger, &trigger_owner_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
DBG("Work item skipped since the associated trigger is no longer registered: work item id = %" PRIu64 ", trigger name = '%s', trigger owner uid = %d",
work_item->id, trigger_name,
{
struct action_executor *executor = _data;
- assert(cds_list_empty(&executor->work.list));
+ LTTNG_ASSERT(cds_list_empty(&executor->work.list));
pthread_mutex_destroy(&executor->work.lock);
pthread_cond_destroy(&executor->work.cond);
struct action_work_item *work_item;
bool signal = false;
- assert(trigger);
+ LTTNG_ASSERT(trigger);
pthread_mutex_lock(&executor->work.lock);
/* Check for queue overflow. */
const bool reference_acquired =
notification_client_list_get(client_list);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
}
*work_item = (typeof(*work_item)){
},
};
- assert(action);
- assert(subitems);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(subitems);
if (type == LTTNG_ACTION_TYPE_LIST) {
unsigned int count, i;
status = lttng_action_list_get_count(action, &count);
- assert(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
for (i = 0; i < count; i++) {
struct lttng_action *inner_action = NULL;
inner_action = lttng_action_list_borrow_mutable_at_index(
action, i);
- assert(inner_action);
+ LTTNG_ASSERT(inner_action);
ret = add_action_to_subitem_array(
inner_action, subitems);
if (ret) {
case LTTNG_ACTION_TYPE_START_SESSION:
status = lttng_action_start_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
break;
case LTTNG_ACTION_TYPE_STOP_SESSION:
status = lttng_action_stop_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
break;
case LTTNG_ACTION_TYPE_ROTATE_SESSION:
status = lttng_action_rotate_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
break;
case LTTNG_ACTION_TYPE_SNAPSHOT_SESSION:
status = lttng_action_snapshot_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
break;
case LTTNG_ACTION_TYPE_LIST:
case LTTNG_ACTION_TYPE_UNKNOWN:
struct lttng_action *action;
action = lttng_trigger_get_action(trigger);
- assert(action);
+ LTTNG_ASSERT(action);
return add_action_to_subitem_array(action, subitems);
}
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/sessiond-comm/sessiond-comm.h>
struct lttng_ht_iter iter;
list = session_get_list();
- assert(list);
+ LTTNG_ASSERT(list);
cds_list_for_each_entry_safe(session, stmp, &list->head, list) {
if (!session_get(session)) {
* before this thread is launched.
*/
ret = uri_parse(default_reg_uri, &uri);
- assert(ret);
- assert(the_config.agent_tcp_port.begin > 0);
+ LTTNG_ASSERT(ret);
+ LTTNG_ASSERT(the_config.agent_tcp_port.begin > 0);
uri->port = the_config.agent_tcp_port.begin;
sock = lttcomm_alloc_sock_from_uri(uri);
int ret;
uint16_t port;
- assert(sock);
+ LTTNG_ASSERT(sock);
ret = lttcomm_sock_get_port(sock, &port);
if (ret) {
struct agent_register_msg msg;
struct lttcomm_sock *new_sock;
- assert(reg_sock);
+ LTTNG_ASSERT(reg_sock);
new_sock = reg_sock->ops->accept(reg_sock);
if (!new_sock) {
int enabled;
enabled = uatomic_read(&agent_tracing_enabled);
- assert(enabled != -1);
+ LTTNG_ASSERT(enabled != -1);
return enabled == 1;
}
rcu_thread_online();
/* Agent initialization call MUST be called before starting the thread. */
- assert(the_agent_apps_ht_by_sock);
+ LTTNG_ASSERT(the_agent_apps_ht_by_sock);
/* Create pollset with size 2, quit pipe and registration socket. */
ret = lttng_poll_create(&events, 2, LTTNG_CLOEXEC);
uint16_t port;
ret = lttcomm_sock_get_port(reg_sock, &port);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = write_agent_port(port);
if (ret) {
struct lttcomm_sock *new_app_socket;
int new_app_socket_fd;
- assert(pollfd == reg_sock->fd);
+ LTTNG_ASSERT(pollfd == reg_sock->fd);
ret = accept_agent_connection(
reg_sock, &new_app_id, &new_app_socket);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <urcu/uatomic.h>
#include <urcu/rculist.h>
struct agent_event *event;
const struct agent_ht_key *key;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct agent_event, node.node);
key = _key;
const struct agent_ht_key *key;
int ll_match;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct agent_event, node.node);
key = _key;
struct cds_lfht_node *node_ptr;
struct agent_ht_key key;
- assert(ht);
- assert(ht->ht);
- assert(event);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(event);
key.name = event->name;
key.loglevel_value = event->loglevel_value;
node_ptr = cds_lfht_add_unique(ht->ht,
ht->hash_fct(event->node.key, lttng_ht_seed),
ht_match_event, &key, &event->node.node);
- assert(node_ptr == &event->node.node);
+ LTTNG_ASSERT(node_ptr == &event->node.node);
}
/*
ssize_t size;
struct lttcomm_agent_hdr msg;
- assert(sock);
+ LTTNG_ASSERT(sock);
memset(&msg, 0, sizeof(msg));
msg.data_size = htobe64(data_size);
int ret;
ssize_t len;
- assert(sock);
- assert(data);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(data);
len = sock->ops->sendmsg(sock, data, size, 0);
if (len < size) {
int ret;
ssize_t len;
- assert(sock);
- assert(buf);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
len = sock->ops->recvmsg(sock, buf, size, 0);
if (len < size) {
struct lttcomm_agent_list_reply *reply = NULL;
struct lttcomm_agent_list_reply_hdr reply_hdr;
- assert(app);
- assert(app->sock);
- assert(events);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->sock);
+ LTTNG_ASSERT(events);
DBG2("Agent listing events for app pid: %d and socket %d", app->pid,
app->sock->fd);
struct lttcomm_agent_enable_event msg;
struct lttcomm_agent_generic_reply reply;
- assert(app);
- assert(app->sock);
- assert(event);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->sock);
+ LTTNG_ASSERT(event);
DBG2("Agent enabling event %s for app pid: %d and socket %d", event->name,
app->pid, app->sock->fd);
struct lttcomm_agent_generic_reply reply;
size_t app_ctx_provider_name_len, app_ctx_name_len, data_size;
- assert(app);
- assert(app->sock);
- assert(ctx);
- assert(cmd == AGENT_CMD_APP_CTX_ENABLE ||
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->sock);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(cmd == AGENT_CMD_APP_CTX_ENABLE ||
cmd == AGENT_CMD_APP_CTX_DISABLE);
DBG2("Agent %s application %s:%s for app pid: %d and socket %d",
struct lttcomm_agent_disable_event msg;
struct lttcomm_agent_generic_reply reply;
- assert(app);
- assert(app->sock);
- assert(event);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->sock);
+ LTTNG_ASSERT(event);
DBG2("Agent disabling event %s for app pid: %d and socket %d", event->name,
app->pid, app->sock->fd);
*/
int agent_send_registration_done(struct agent_app *app)
{
- assert(app);
- assert(app->sock);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->sock);
DBG("Agent sending registration done to app socket %d", app->sock->fd);
struct agent_app *app;
struct lttng_ht_iter iter;
- assert(event);
+ LTTNG_ASSERT(event);
rcu_read_lock();
goto end;
}
- assert(ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT);
+ LTTNG_ASSERT(ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT);
agent_ctx = zmalloc(sizeof(*ctx));
if (!agent_ctx) {
goto end;
struct agent_app *app;
struct lttng_ht_iter iter;
- assert(ctx);
+ LTTNG_ASSERT(ctx);
if (ctx->ctx != LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
ret = LTTNG_ERR_INVALID;
goto error;
struct agent_app *app;
struct lttng_ht_iter iter;
- assert(event);
+ LTTNG_ASSERT(event);
if (!AGENT_EVENT_IS_ENABLED(event)) {
goto end;
}
}
/* event->enabled_count is now 0. */
- assert(!AGENT_EVENT_IS_ENABLED(event));
+ LTTNG_ASSERT(!AGENT_EVENT_IS_ENABLED(event));
error:
rcu_read_unlock();
struct agent_app *app;
struct lttng_ht_iter iter;
- assert(ctx);
+ LTTNG_ASSERT(ctx);
rcu_read_lock();
DBG2("Disabling agent application context %s:%s",
struct lttng_event *tmp_events = NULL;
struct lttng_ht_iter iter;
- assert(events);
+ LTTNG_ASSERT(events);
DBG2("Agent listing events for domain %d", domain);
{
struct agent_app *app;
- assert(sock);
+ LTTNG_ASSERT(sock);
app = zmalloc(sizeof(*app));
if (!app) {
struct lttng_ht_iter iter;
struct agent_app *app;
- assert(sock >= 0);
+ LTTNG_ASSERT(sock >= 0);
lttng_ht_lookup(the_agent_apps_ht_by_sock,
(void *) ((unsigned long) sock), &iter);
*/
void agent_add_app(struct agent_app *app)
{
- assert(app);
+ LTTNG_ASSERT(app);
DBG3("Agent adding app sock: %d and pid: %d to ht", app->sock->fd, app->pid);
lttng_ht_add_unique_ulong(the_agent_apps_ht_by_sock, &app->node);
int ret;
struct lttng_ht_iter iter;
- assert(app);
+ LTTNG_ASSERT(app);
DBG3("Agent deleting app pid: %d and sock: %d", app->pid, app->sock->fd);
iter.iter.node = &app->node.node;
ret = lttng_ht_del(the_agent_apps_ht_by_sock, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
*/
void agent_destroy_app(struct agent_app *app)
{
- assert(app);
+ LTTNG_ASSERT(app);
if (app->sock) {
app->sock->ops->close(app->sock);
{
int ret;
- assert(agt);
+ LTTNG_ASSERT(agt);
agt->events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
if (!agt->events) {
*/
void agent_add(struct agent *agt, struct lttng_ht *ht)
{
- assert(agt);
- assert(ht);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(ht);
DBG3("Agent adding from domain %d", agt->domain);
*/
void agent_add_event(struct agent_event *event, struct agent *agt)
{
- assert(event);
- assert(agt);
- assert(agt->events);
+ LTTNG_ASSERT(event);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(agt->events);
DBG3("Agent adding event %s", event->name);
add_unique_agent_event(agt->events, event);
int ret = LTTNG_OK;
struct agent_app_ctx *agent_ctx = NULL;
- assert(ctx);
- assert(agt);
- assert(agt->events);
- assert(ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(agt->events);
+ LTTNG_ASSERT(ctx->ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT);
agent_ctx = create_app_ctx(ctx);
if (!agent_ctx) {
struct lttng_ht *ht;
struct agent_ht_key key;
- assert(name);
- assert(agt);
- assert(agt->events);
- assert(iter);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(agt->events);
+ LTTNG_ASSERT(iter);
ht = agt->events;
key.name = name;
event_rule_logging_get_name_pattern logging_get_name_pattern;
event_rule_logging_get_log_level_rule logging_get_log_level_rule;
- assert(agt);
- assert(agt->events);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(agt->events);
condition = lttng_trigger_get_const_condition(trigger);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
c_status = lttng_condition_event_rule_matches_get_rule(
condition, &rule);
- assert(c_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
switch (lttng_event_rule_get_type(rule)) {
case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
}
domain = lttng_event_rule_get_domain_type(rule);
- assert(domain == LTTNG_DOMAIN_JUL || domain == LTTNG_DOMAIN_LOG4J ||
+ LTTNG_ASSERT(domain == LTTNG_DOMAIN_JUL || domain == LTTNG_DOMAIN_LOG4J ||
domain == LTTNG_DOMAIN_PYTHON);
/* Get the event's pattern name ('name' in the legacy terminology). */
er_status = logging_get_name_pattern(rule, &name);
- assert(er_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(er_status == LTTNG_EVENT_RULE_STATUS_OK);
/* Get the internal filter expression. */
filter_expression = lttng_event_rule_get_filter(rule);
struct lttng_ht *ht;
struct agent_ht_key key;
- assert(name);
- assert(agt);
- assert(agt->events);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(agt->events);
ht = agt->events;
key.name = name;
*/
void agent_destroy_event(struct agent_event *event)
{
- assert(event);
+ LTTNG_ASSERT(event);
free(event->filter);
free(event->filter_expression);
struct lttng_ht_iter iter;
struct agent_app_ctx *ctx;
- assert(agt);
+ LTTNG_ASSERT(agt);
DBG3("Agent destroy");
(void) agent_disable_event(event, agt->domain);
ret = lttng_ht_del(agt->events, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
call_rcu(&node->head, destroy_event_agent_rcu);
}
{
struct agent_app *app;
- assert(sock >= 0);
+ LTTNG_ASSERT(sock >= 0);
/*
* Not finding an application is a very important error that should NEVER
*/
rcu_read_lock();
app = agent_find_app_by_sock(sock);
- assert(app);
+ LTTNG_ASSERT(app);
/* RCU read side lock is assumed to be held by this function. */
agent_delete_app(app);
struct lttng_ht_iter iter;
struct agent_app_ctx *ctx;
- assert(agt);
- assert(app);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(app);
DBG("Agent updating app: pid = %ld", (long) app->pid);
const int ret = lttng_ht_del(
the_trigger_agents_ht_by_domain, &iter);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
agent_destroy(agent);
}
struct lttng_ht_iter iter;
const uint64_t key = (uint64_t) domain_type;
- assert(the_trigger_agents_ht_by_domain);
+ LTTNG_ASSERT(the_trigger_agents_ht_by_domain);
DBG3("Per-event notifier domain agent lookup for domain '%s'",
lttng_domain_type_str(domain_type));
struct buffer_reg_uid *reg;
const struct buffer_reg_uid *key;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
reg = caa_container_of(node, struct buffer_reg_uid, node.node);
- assert(reg);
+ LTTNG_ASSERT(reg);
key = _key;
if (key->session_id != reg->session_id ||
uint64_t xored_key;
const struct buffer_reg_uid *key = _key;
- assert(key);
+ LTTNG_ASSERT(key);
xored_key = (uint64_t)(key->session_id ^ key->bits_per_long ^ key->uid);
return hash_key_u64(&xored_key, seed);
void buffer_reg_init_uid_registry(void)
{
/* Should be called once. */
- assert(!buffer_registry_uid);
+ LTTNG_ASSERT(!buffer_registry_uid);
buffer_registry_uid = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
- assert(buffer_registry_uid);
+ LTTNG_ASSERT(buffer_registry_uid);
buffer_registry_uid->match_fct = ht_match_reg_uid;
buffer_registry_uid->hash_fct = ht_hash_reg_uid;
int ret = 0;
struct buffer_reg_uid *reg = NULL;
- assert(regp);
+ LTTNG_ASSERT(regp);
reg = zmalloc(sizeof(*reg));
if (!reg) {
struct cds_lfht_node *nodep;
struct lttng_ht *ht = buffer_registry_uid;
- assert(reg);
+ LTTNG_ASSERT(reg);
DBG3("Buffer registry per UID adding to global registry with id: %" PRIu64 ,
reg->session_id);
rcu_read_lock();
nodep = cds_lfht_add_unique(ht->ht, ht->hash_fct(reg, lttng_ht_seed),
ht->match_fct, reg, ®->node.node);
- assert(nodep == ®->node.node);
+ LTTNG_ASSERT(nodep == ®->node.node);
rcu_read_unlock();
}
void buffer_reg_init_pid_registry(void)
{
/* Should be called once. */
- assert(!buffer_registry_pid);
+ LTTNG_ASSERT(!buffer_registry_pid);
buffer_registry_pid = lttng_ht_new(0, LTTNG_HT_TYPE_U64);
- assert(buffer_registry_pid);
+ LTTNG_ASSERT(buffer_registry_pid);
DBG3("Global buffer per PID registry initialized");
}
int ret = 0;
struct buffer_reg_pid *reg = NULL;
- assert(regp);
+ LTTNG_ASSERT(regp);
reg = zmalloc(sizeof(*reg));
if (!reg) {
*/
void buffer_reg_pid_add(struct buffer_reg_pid *reg)
{
- assert(reg);
+ LTTNG_ASSERT(reg);
DBG3("Buffer registry per PID adding to global registry with id: %" PRIu64,
reg->session_id);
{
struct buffer_reg_channel *reg;
- assert(regp);
+ LTTNG_ASSERT(regp);
DBG3("Buffer registry channel create with key: %" PRIu64, key);
{
struct buffer_reg_stream *reg;
- assert(regp);
+ LTTNG_ASSERT(regp);
DBG3("Buffer registry creating stream");
void buffer_reg_stream_add(struct buffer_reg_stream *stream,
struct buffer_reg_channel *channel)
{
- assert(stream);
- assert(channel);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(channel);
pthread_mutex_lock(&channel->stream_list_lock);
cds_list_add_tail(&stream->lnode, &channel->streams);
void buffer_reg_channel_add(struct buffer_reg_session *session,
struct buffer_reg_channel *channel)
{
- assert(session);
- assert(channel);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(channel);
rcu_read_lock();
lttng_ht_add_unique_u64(session->channels, &channel->node);
struct buffer_reg_channel *chan = NULL;
struct lttng_ht *ht;
- assert(reg);
+ LTTNG_ASSERT(reg);
switch (reg->domain) {
case LTTNG_DOMAIN_UST:
ht = reg->registry->channels;
break;
default:
- assert(0);
+ abort();
goto end;
}
break;
}
default:
- assert(0);
+ abort();
}
free(regp);
int ret;
struct lttng_ht_iter iter;
- assert(session);
- assert(regp);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(regp);
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(session->channels, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
break;
}
default:
- assert(0);
+ abort();
}
free(regp);
cds_lfht_for_each_entry(regp->channels->ht, &iter.iter, reg_chan,
node.node) {
ret = lttng_ht_del(regp->channels, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
buffer_reg_channel_destroy(reg_chan, domain);
}
rcu_read_unlock();
free(regp->reg.ust);
break;
default:
- assert(0);
+ abort();
}
free(regp);
int ret;
struct lttng_ht_iter iter;
- assert(regp);
+ LTTNG_ASSERT(regp);
rcu_read_lock();
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(buffer_registry_uid, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
rcu_read_unlock();
}
}
break;
default:
- assert(0);
+ abort();
rcu_read_unlock();
return;
}
int ret;
struct lttng_ht_iter iter;
- assert(regp);
+ LTTNG_ASSERT(regp);
iter.iter.node = ®p->node.node;
ret = lttng_ht_del(buffer_registry_pid, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
switch (dom) {
case LTTNG_DOMAIN_KERNEL:
- assert(type == LTTNG_BUFFER_GLOBAL);
+ LTTNG_ASSERT(type == LTTNG_BUFFER_GLOBAL);
chan->attr.subbuf_size =
default_get_kernel_channel_subbuf_size();
chan->attr.num_subbuf = DEFAULT_KERNEL_CHANNEL_SUBBUF_NUM;
int ret;
struct ltt_kernel_channel *kchan;
- assert(ksession);
- assert(channel_name);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(channel_name);
kchan = trace_kernel_get_channel_by_name(channel_name, ksession);
if (kchan == NULL) {
{
int ret;
- assert(ksession);
- assert(kchan);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(kchan);
if (kchan->enabled == 0) {
ret = kernel_enable_channel(kchan);
int ret;
struct lttng_channel *defattr = NULL;
- assert(ksession);
+ LTTNG_ASSERT(ksession);
/* Creating channel attributes if needed */
if (attr == NULL) {
{
int ret = LTTNG_OK;
- assert(usess);
- assert(uchan);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
/* If already enabled, everything is OK */
if (uchan->enabled) {
enum lttng_domain_type domain = LTTNG_DOMAIN_UST;
bool chan_published = false;
- assert(usess);
+ LTTNG_ASSERT(usess);
/* Creating channel attributes if needed */
if (attr == NULL) {
{
int ret = LTTNG_OK;
- assert(usess);
- assert(uchan);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
/* Already disabled */
if (uchan->enabled == 0) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <unistd.h>
};
struct lttcomm_lttng_msg *p_llm;
- assert(cmd_ctx->reply_payload.buffer.size >= sizeof(llm));
+ LTTNG_ASSERT(cmd_ctx->reply_payload.buffer.size >= sizeof(llm));
p_llm = (typeof(p_llm)) cmd_ctx->reply_payload.buffer.data;
const char *dir_name;
struct consumer_output *consumer;
- assert(session);
- assert(session->consumer);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(session->consumer);
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
int ret;
struct ltt_ust_session *lus = NULL;
- assert(session);
- assert(domain);
- assert(session->consumer);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(domain);
+ LTTNG_ASSERT(session->consumer);
switch (domain->type) {
case LTTNG_DOMAIN_JUL:
}
/* Code flow safety */
- assert(session->kernel_session);
+ LTTNG_ASSERT(session->kernel_session);
/* Copy session output to the newly created Kernel session */
ret = copy_session_consumer(LTTNG_DOMAIN_KERNEL, session);
lttcomm_sessiond_command_str(cmd_ctx->lsm.cmd_type),
cmd_ctx->lsm.cmd_type);
- assert(!rcu_read_ongoing());
+ LTTNG_ASSERT(!rcu_read_ongoing());
*sock_error = 0;
goto error;
}
- assert((nb_output > 0 && outputs) || nb_output == 0);
+ LTTNG_ASSERT((nb_output > 0 && outputs) || nb_output == 0);
ret = setup_lttng_msg_no_cmd_header(cmd_ctx, outputs,
nb_output * sizeof(struct lttng_snapshot_output));
free(outputs);
goto error;
}
- assert(return_triggers);
+ LTTNG_ASSERT(return_triggers);
ret = lttng_triggers_serialize(
return_triggers, &cmd_ctx->reply_payload);
lttng_triggers_destroy(return_triggers);
goto error;
}
- assert(results);
+ LTTNG_ASSERT(results);
ret = lttng_error_query_results_serialize(
results, &cmd_ctx->reply_payload);
lttng_error_query_results_destroy(results);
session_unlock_list();
}
init_setup_error:
- assert(!rcu_read_ongoing());
+ LTTNG_ASSERT(!rcu_read_ongoing());
return ret;
}
struct lttcomm_lttng_msg *llm = (typeof(
llm)) cmd_ctx.reply_payload.buffer.data;
- assert(cmd_ctx.reply_payload.buffer.size >= sizeof(*llm));
- assert(cmd_ctx.lttng_msg_size == cmd_ctx.reply_payload.buffer.size);
+ LTTNG_ASSERT(cmd_ctx.reply_payload.buffer.size >= sizeof(*llm));
+ LTTNG_ASSERT(cmd_ctx.lttng_msg_size == cmd_ctx.reply_payload.buffer.size);
llm->fd_count = lttng_payload_view_get_fd_handle_count(&view);
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <sys/stat.h>
struct lttng_uri *kuri = NULL, *uuri = NULL, *uri = NULL;
char tmp_uurl[PATH_MAX], tmp_urls[PATH_MAX];
- assert(session);
- assert(dst);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(dst);
memset(tmp_urls, 0, sizeof(tmp_urls));
memset(tmp_uurl, 0, sizeof(tmp_uurl));
}
usess = session->ust_session;
- assert(discarded_events);
- assert(lost_packets);
+ LTTNG_ASSERT(discarded_events);
+ LTTNG_ASSERT(lost_packets);
if (!usess || !session->has_been_started) {
*discarded_events = 0;
*lost_packets += uchan->per_pid_closed_app_lost;
} else {
ERR("Unsupported buffer type");
- assert(0);
+ abort();
ret = -1;
goto end;
}
* LTTNG_UST_MMAP is the only supported UST
* output mode.
*/
- assert(0);
+ abort();
break;
}
const struct agent_event *agent_event;
struct lttng_ht_iter iter;
- assert(agt);
+ LTTNG_ASSERT(agt);
DBG3("Listing agent events");
case LTTNG_KERNEL_ABI_ALL:
/* fall-through. */
default:
- assert(0);
+ abort();
break;
}
int ret;
enum lttng_error_code ret_code = LTTNG_OK;
- assert(uri);
+ LTTNG_ASSERT(uri);
if (consumer == NULL) {
DBG("No consumer detected. Don't add URI. Stopping.");
struct lttng_ht_iter iter;
struct consumer_socket *socket;
- assert(session);
+ LTTNG_ASSERT(session);
rcu_read_lock();
if (status != LTTNG_OK) {
goto relayd_comm_error;
}
- assert(rsock);
+ LTTNG_ASSERT(rsock);
/* Set the network sequence index if not set. */
if (consumer->net_seq_index == (uint64_t) -1ULL) {
{
enum lttng_error_code status = LTTNG_OK;
- assert(consumer);
- assert(sock);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(sock);
/* Sending control relayd socket. */
if (!sock->control_sock_sent) {
struct lttng_ht_iter iter;
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
- assert(session);
+ LTTNG_ASSERT(session);
usess = session->ust_session;
ksess = session->kernel_session;
size_t len;
struct lttng_channel attr;
- assert(session);
- assert(_attr);
- assert(domain);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(_attr);
+ LTTNG_ASSERT(domain);
attr = *_attr;
len = lttng_strnlen(attr.name, sizeof(attr.name));
struct agent *agt;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
switch (event->type) {
case LTTNG_EVENT_ALL:
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
- assert(session->kernel_session);
+ LTTNG_ASSERT(session->kernel_session);
if (session->kernel_session->channel_count == 0) {
/* Create default channel */
struct ltt_ust_session *usess = session->ust_session;
unsigned int chan_count;
- assert(usess);
+ LTTNG_ASSERT(usess);
chan_count = lttng_ht_get_count(usess->domain_global.channels);
if (chan_count == 0) {
trace_kernel_get_channel_by_name(DEFAULT_CHANNEL_NAME,
session->kernel_session);
/* Created previously, this should NOT fail. */
- assert(kchan);
+ LTTNG_ASSERT(kchan);
kernel_destroy_channel(kchan);
}
session->ust_session->domain_global.channels,
DEFAULT_CHANNEL_NAME);
/* Created previously, this should NOT fail. */
- assert(uchan);
+ LTTNG_ASSERT(uchan);
/* Remove from the channel list of the session. */
trace_ust_delete_channel(session->ust_session->domain_global.channels,
uchan);
int ret = 0, channel_created = 0;
struct lttng_channel *attr = NULL;
- assert(session);
- assert(event);
- assert(channel_name);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(event);
+ LTTNG_ASSERT(channel_name);
/* If we have a filter, we must have its filter expression */
- assert(!(!!filter_expression ^ !!filter));
+ LTTNG_ASSERT(!(!!filter_expression ^ !!filter));
/* Normalize event name as a globbing pattern */
strutils_normalize_star_glob_pattern(event->name);
struct ltt_ust_channel *uchan;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
/*
* If a non-default channel has been created in the
/* Get the newly created channel reference back */
uchan = trace_ust_find_channel_by_name(
usess->domain_global.channels, channel_name);
- assert(uchan);
+ LTTNG_ASSERT(uchan);
}
if (uchan->domain != LTTNG_DOMAIN_UST && !internal_event) {
struct lttng_domain tmp_dom;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
if (!agent_tracing_is_enabled()) {
DBG("Attempted to enable an event in an agent domain but the agent thread is not running");
break;
default:
/* The switch/case we are in makes this impossible */
- assert(0);
+ abort();
}
{
const bool session_cleared_after_last_stop =
session->cleared_after_last_stop;
- assert(session);
+ LTTNG_ASSERT(session);
/* Ease our life a bit ;) */
ksession = session->kernel_session;
ret = LTTNG_ERR_CREATE_DIR_FAIL;
goto error;
}
- assert(!session->current_trace_chunk);
+ LTTNG_ASSERT(!session->current_trace_chunk);
ret = session_set_trace_chunk(session, trace_chunk,
NULL);
lttng_trace_chunk_put(trace_chunk);
struct ltt_kernel_session *ksession;
struct ltt_ust_session *usess;
- assert(session);
+ LTTNG_ASSERT(session);
DBG("Begin stop session \"%s\" (id %" PRIu64 ")", session->name, session->id);
/* Short cut */
struct ltt_kernel_session *ksess = session->kernel_session;
struct ltt_ust_session *usess = session->ust_session;
- assert(session);
- assert(uris);
- assert(nb_uri > 0);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(uris);
+ LTTNG_ASSERT(nb_uri > 0);
/* Can't set consumer URI if the session is active. */
if (session->active) {
}
/* Safety net */
- assert(session);
+ LTTNG_ASSERT(session);
DBG("Begin destroy session %s (id %" PRIu64 ")", session->name,
session->id);
ret = lttng_strncpy(destroy_completion_handler.shm_path,
session->shm_path,
sizeof(destroy_completion_handler.shm_path));
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
int ret, sock;
struct consumer_socket *socket = NULL;
- assert(session);
- assert(cdata);
- assert(sock_path);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(cdata);
+ LTTNG_ASSERT(sock_path);
switch (domain) {
case LTTNG_DOMAIN_KERNEL:
{
struct ltt_kernel_session *ksess = session->kernel_session;
- assert(ksess);
+ LTTNG_ASSERT(ksess);
/* Can't register a consumer if there is already one */
if (ksess->consumer_fds_sent != 0) {
struct ltt_kernel_session *ksess = session->kernel_session;
struct ltt_ust_session *usess = session->ust_session;
- assert(session);
+ LTTNG_ASSERT(session);
DBG("Data pending for session %s", session->name);
int ret;
struct snapshot_output *new_output;
- assert(session);
- assert(output);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(output);
DBG("Cmd snapshot add output for session %s", session->name);
int ret;
struct snapshot_output *sout = NULL;
- assert(session);
- assert(output);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(output);
rcu_read_lock();
struct lttng_ht_iter iter;
struct snapshot_output *output;
- assert(session);
- assert(outputs);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(outputs);
DBG("Cmd snapshot list outputs for session %s", session->name);
rcu_read_lock();
cds_lfht_for_each_entry(session->snapshot.output_ht->ht, &iter.iter,
output, node.node) {
- assert(output->consumer);
+ LTTNG_ASSERT(output->consumer);
list[idx].id = output->id;
list[idx].max_size = output->max_size;
if (lttng_strncpy(list[idx].name, output->name,
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
if (session->live_timer != 0) {
ret = LTTNG_ERR_LIVE_SESSION;
ret = LTTNG_ERR_PER_PID_SESSION;
goto end;
default:
- assert(0);
+ abort();
ret = LTTNG_ERR_UNK;
goto end;
}
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
ret = check_regenerate_metadata_support(session);
if (ret) {
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
if (!session->active) {
ret = LTTNG_ERR_SESSION_NOT_STARTED;
trigger);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
- assert(condition);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_owner);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
DBG("Running register trigger command: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
trigger_name, (int) trigger_owner,
lttng_trigger_get_underlying_domain_type_restriction(
trigger);
- assert(condition);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
session_lock_list();
* This trigger was never registered in the first place. Calling
* this function under those circumstances is an internal error.
*/
- assert(agt);
+ LTTNG_ASSERT(agt);
ret_code = trigger_agent_disable(trigger, agt);
if (ret_code != LTTNG_OK) {
goto end_unlock_session_list;
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ? trigger_name : "(anonymous)";
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
DBG("Running unregister trigger command: trigger name = '%s', trigger owner uid = %d, command creds uid = %d",
trigger_name, (int) trigger_owner,
goto end;
}
- assert(sessiond_trigger);
+ LTTNG_ASSERT(sessiond_trigger);
/*
* From this point on, no matter what, consider the trigger
abort();
}
- assert(query_target_trigger);
+ LTTNG_ASSERT(query_target_trigger);
ret_code = notification_thread_command_get_trigger(notification_thread,
query_target_trigger, &matching_trigger);
trigger_name : "(anonymous)";
trigger_status = lttng_trigger_get_owner_uid(matching_trigger,
&trigger_owner);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
results = lttng_error_query_results_create();
if (!results) {
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
const char *base_path;
- assert(output);
- assert(session);
+ LTTNG_ASSERT(output);
+ LTTNG_ASSERT(session);
DBG2("Set relayd object from snapshot output");
{
enum lttng_error_code status;
- assert(ksess);
- assert(output);
- assert(session);
+ LTTNG_ASSERT(ksess);
+ LTTNG_ASSERT(output);
+ LTTNG_ASSERT(session);
status = kernel_snapshot_record(
ksess, output, wait, nb_packets_per_stream);
{
enum lttng_error_code status;
- assert(usess);
- assert(output);
- assert(session);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(output);
+ LTTNG_ASSERT(session);
status = ust_app_snapshot_record(
usess, output, wait, nb_packets_per_stream);
ret_code = LTTNG_ERR_CREATE_DIR_FAIL;
goto error;
}
- assert(!session->current_trace_chunk);
+ LTTNG_ASSERT(!session->current_trace_chunk);
ret = session_set_trace_chunk(session, snapshot_trace_chunk, NULL);
lttng_trace_chunk_put(snapshot_trace_chunk);
snapshot_trace_chunk = NULL;
char datetime[16];
struct snapshot_output *tmp_output = NULL;
- assert(session);
- assert(output);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(output);
DBG("Cmd snapshot record for session %s", session->name);
const char *shm_path)
{
/* Safety net */
- assert(session);
+ LTTNG_ASSERT(session);
/*
* Can only set shm path before session is started.
bool failed_to_rotate = false;
enum lttng_error_code rotation_fail_code = LTTNG_OK;
- assert(session);
+ LTTNG_ASSERT(session);
if (!session->has_been_started) {
cmd_ret = LTTNG_ERR_START_SESSION_ONCE;
session->rotation_state = LTTNG_ROTATION_STATE_ONGOING;
chunk_status = lttng_trace_chunk_get_id(chunk_being_archived,
&ongoing_rotation_chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
ret = session_close_trace_chunk(session, chunk_being_archived,
command, session->last_chunk_path);
chunk_status = lttng_trace_chunk_get_id(
session->chunk_being_archived,
&chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
rotation_state = rotation_id == chunk_id ?
LTTNG_ROTATION_STATE_ONGOING :
int ret;
uint64_t *parameter_value;
- assert(session);
+ LTTNG_ASSERT(session);
DBG("Cmd rotate set schedule session %s", session->name);
struct lttng_condition_session_rotation, parent);
condition_type = (unsigned long) condition->parent.type;
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
- assert(condition->session_name);
+ LTTNG_ASSERT(condition->session_name);
hash ^= hash_key_str(condition->session_name, lttng_ht_seed);
return hash;
}
condition_type = (unsigned long) condition->type;
condition_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
return hash ^ lttng_event_rule_hash(event_rule);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int ret;
char *pathname;
- assert(consumer);
- assert(session_path);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(session_path);
health_code_update();
int fd;
ssize_t size;
- assert(socket);
- assert(socket->fd_ptr);
- assert(msg);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(socket->fd_ptr);
+ LTTNG_ASSERT(msg);
/* Consumer socket is invalid. Stopping. */
fd = *socket->fd_ptr;
int fd;
ssize_t size;
- assert(socket);
- assert(socket->fd_ptr);
- assert(msg);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(socket->fd_ptr);
+ LTTNG_ASSERT(msg);
/* Consumer socket is invalid. Stopping. */
fd = *socket->fd_ptr;
int ret;
struct lttcomm_consumer_status_msg reply;
- assert(sock);
+ LTTNG_ASSERT(sock);
ret = consumer_socket_recv(sock, &reply, sizeof(reply));
if (ret < 0) {
int ret;
struct lttcomm_consumer_status_channel reply;
- assert(sock);
- assert(stream_count);
- assert(key);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(stream_count);
+ LTTNG_ASSERT(key);
ret = consumer_socket_recv(sock, &reply, sizeof(reply));
if (ret < 0) {
int ret;
struct lttcomm_consumer_msg msg;
- assert(consumer);
- assert(sock);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(sock);
DBG2("Sending destroy relayd command to consumer sock %d", *sock->fd_ptr);
struct lttng_ht_iter iter;
struct consumer_socket *socket;
- assert(consumer);
+ LTTNG_ASSERT(consumer);
/* Destroy any relayd connection */
if (consumer->type == CONSUMER_DST_NET) {
int ret = 0;
struct consumer_socket *socket;
- assert(data);
+ LTTNG_ASSERT(data);
if (output == NULL || data->cmd_sock < 0) {
/*
consumer_fd = uatomic_read(&the_ust_consumerd32_fd);
break;
default:
- assert(0);
+ abort();
goto end;
}
{
struct consumer_socket *socket = NULL;
- assert(fd);
+ LTTNG_ASSERT(fd);
socket = zmalloc(sizeof(struct consumer_socket));
if (socket == NULL) {
void consumer_add_socket(struct consumer_socket *sock,
struct consumer_output *consumer)
{
- assert(sock);
- assert(consumer);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(consumer);
lttng_ht_add_unique_ulong(consumer->socks, &sock->node);
}
int ret;
struct lttng_ht_iter iter;
- assert(sock);
- assert(consumer);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(consumer);
iter.iter.node = &sock->node.node;
ret = lttng_ht_del(consumer->socks, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
*/
void consumer_destroy_socket(struct consumer_socket *sock)
{
- assert(sock);
+ LTTNG_ASSERT(sock);
/*
* We DO NOT close the file descriptor here since it is global to the
int ret;
struct consumer_output *output;
- assert(src);
+ LTTNG_ASSERT(src);
output = consumer_create_output(src->type);
if (output == NULL) {
struct lttng_ht_iter iter;
struct consumer_socket *socket, *copy_sock;
- assert(dst);
- assert(src);
+ LTTNG_ASSERT(dst);
+ LTTNG_ASSERT(src);
rcu_read_lock();
cds_lfht_for_each_entry(src->socks->ht, &iter.iter, socket, node.node) {
struct lttng_uri *dst_uri = NULL;
/* Code flow error safety net. */
- assert(output);
- assert(uri);
+ LTTNG_ASSERT(output);
+ LTTNG_ASSERT(uri);
switch (uri->stype) {
case LTTNG_STREAM_CONTROL:
{
int ret;
- assert(fds);
- assert(sock);
- assert(nb_fd > 0);
- assert(pthread_mutex_trylock(sock->lock) == EBUSY);
+ LTTNG_ASSERT(fds);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(nb_fd > 0);
+ LTTNG_ASSERT(pthread_mutex_trylock(sock->lock) == EBUSY);
ret = lttcomm_send_fds_unix_sock(*sock->fd_ptr, fds, nb_fd);
if (ret < 0) {
{
int ret;
- assert(msg);
- assert(sock);
- assert(pthread_mutex_trylock(sock->lock) == EBUSY);
+ LTTNG_ASSERT(msg);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(pthread_mutex_trylock(sock->lock) == EBUSY);
ret = consumer_socket_send(sock, msg, sizeof(struct lttcomm_consumer_msg));
if (ret < 0) {
{
int ret;
- assert(msg);
- assert(sock);
+ LTTNG_ASSERT(msg);
+ LTTNG_ASSERT(sock);
ret = consumer_send_msg(sock, msg);
if (ret < 0) {
struct lttng_trace_chunk *trace_chunk,
const struct lttng_credentials *buffer_credentials)
{
- assert(msg);
+ LTTNG_ASSERT(msg);
/* Zeroed structure */
memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
enum lttng_trace_chunk_status chunk_status;
chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
LTTNG_OPTIONAL_SET(&msg->u.ask_channel.chunk_id, chunk_id);
}
msg->u.ask_channel.buffer_credentials.uid =
unsigned int monitor_timer_interval,
struct lttng_trace_chunk *trace_chunk)
{
- assert(msg);
+ LTTNG_ASSERT(msg);
/* Zeroed structure */
memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
enum lttng_trace_chunk_status chunk_status;
chunk_status = lttng_trace_chunk_get_id(trace_chunk, &chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
LTTNG_OPTIONAL_SET(&msg->u.channel.chunk_id, chunk_id);
}
uint64_t stream_key,
int32_t cpu)
{
- assert(msg);
+ LTTNG_ASSERT(msg);
memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
enum lttng_consumer_command cmd,
uint64_t channel_key, uint64_t net_seq_idx)
{
- assert(msg);
+ LTTNG_ASSERT(msg);
memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
{
int ret;
- assert(msg);
- assert(dst);
- assert(sock);
- assert(fds);
+ LTTNG_ASSERT(msg);
+ LTTNG_ASSERT(dst);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(fds);
ret = consumer_send_msg(sock, msg);
if (ret < 0) {
struct lttcomm_consumer_msg msg;
/* Code flow error. Safety net. */
- assert(rsock);
- assert(consumer);
- assert(consumer_sock);
+ LTTNG_ASSERT(rsock);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(consumer_sock);
memset(&msg, 0, sizeof(msg));
/* Bail out if consumer is disabled */
struct lttng_ht_iter iter;
struct lttcomm_consumer_msg msg;
- assert(consumer);
+ LTTNG_ASSERT(consumer);
DBG3("Consumer data pending for id %" PRIu64, session_id);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG2("Consumer flush channel key %" PRIu64, key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG2("Consumer clear quiescent channel key %" PRIu64, key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG2("Consumer close metadata channel key %" PRIu64, metadata_key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG2("Consumer setup metadata channel key %" PRIu64, metadata_key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG2("Consumer push metadata to consumer socket %d", *socket->fd_ptr);
enum lttng_error_code status = LTTNG_OK;
struct lttcomm_consumer_msg msg;
- assert(socket);
- assert(output);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(output);
DBG("Consumer snapshot channel key %" PRIu64, key);
struct lttng_ht_iter iter;
struct lttcomm_consumer_msg msg;
- assert(consumer);
+ LTTNG_ASSERT(consumer);
DBG3("Consumer discarded events id %" PRIu64, session_id);
struct lttng_ht_iter iter;
struct lttcomm_consumer_msg msg;
- assert(consumer);
+ LTTNG_ASSERT(consumer);
DBG3("Consumer lost packets id %" PRIu64, session_id);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG("Consumer rotate channel key %" PRIu64, key);
.u.open_channel_packets.key = key,
};
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG("Consumer open channel packets: channel key = %" PRIu64, key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG("Consumer clear channel %" PRIu64, key);
.cmd_type = LTTNG_CONSUMER_INIT,
};
- assert(socket);
+ LTTNG_ASSERT(socket);
DBG("Sending consumer initialization command");
lttng_uuid_copy(msg.u.init.sessiond_uuid, sessiond_uuid);
.u.create_trace_chunk.session_id = session_id,
};
- assert(socket);
- assert(chunk);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(chunk);
if (relayd_id != -1ULL) {
LTTNG_OPTIONAL_SET(&msg.u.create_trace_chunk.relayd_id,
*/
domain_dirfd = lttng_directory_handle_get_dirfd(
domain_handle);
- assert(domain_dirfd >= 0);
+ LTTNG_ASSERT(domain_dirfd >= 0);
msg.u.create_trace_chunk.credentials.value.uid =
lttng_credentials_get_uid(&chunk_credentials);
const char *close_command_name = "none";
struct lttng_dynamic_buffer path_reception_buffer;
- assert(socket);
+ LTTNG_ASSERT(socket);
lttng_dynamic_buffer_init(&path_reception_buffer);
if (relayd_id != -1ULL) {
* (consumerd and relayd). They are used internally for
* backward-compatibility purposes.
*/
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
msg.u.close_trace_chunk.chunk_id = chunk_id;
chunk_status = lttng_trace_chunk_get_close_timestamp(chunk,
* Otherwise, the close timestamp would never be transmitted to the
* peers.
*/
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
msg.u.close_trace_chunk.close_timestamp = (uint64_t) close_timestamp;
if (msg.u.close_trace_chunk.close_command.is_set) {
uint64_t chunk_id;
const char *consumer_reply_str;
- assert(socket);
+ LTTNG_ASSERT(socket);
if (relayd_id != -1ULL) {
LTTNG_OPTIONAL_SET(&msg.u.trace_chunk_exists.relayd_id,
int ret;
struct ltt_kernel_channel *kchan;
- assert(ksession);
- assert(kctx);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(kctx);
DBG("Adding kernel context to all channels");
{
int ret;
- assert(kchan);
- assert(kctx);
+ LTTNG_ASSERT(kchan);
+ LTTNG_ASSERT(kctx);
DBG("Add kernel context to channel '%s'", kchan->channel->name);
int ret;
struct ltt_ust_context *uctx = NULL;
- assert(usess);
- assert(uchan);
- assert(ctx);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
+ LTTNG_ASSERT(ctx);
/* Check if context is duplicate */
cds_list_for_each_entry(uctx, &uchan->ctx_list, list) {
case LTTNG_DOMAIN_UST:
break;
default:
- assert(0);
+ abort();
}
/* Create ltt UST context */
struct ltt_kernel_channel *kchan;
struct ltt_kernel_context *kctx;
- assert(ksession);
- assert(ctx);
- assert(channel_name);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(channel_name);
kctx = trace_kernel_create_context(NULL);
if (!kctx) {
struct lttng_ht *chan_ht;
struct ltt_ust_channel *uchan = NULL;
- assert(usess);
- assert(ctx);
- assert(channel_name);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(channel_name);
rcu_read_lock();
}
rcu_read_lock();
- assert(app_sock >= 0);
+ LTTNG_ASSERT(app_sock >= 0);
app = ust_app_find_by_sock(app_sock);
if (app == NULL) {
/*
struct lttng_poll_event events;
struct ust_reg_wait_node *wait_node = NULL, *tmp_wait_node;
- assert(wait_queue);
+ LTTNG_ASSERT(wait_queue);
lttng_poll_init(&events);
cds_list_for_each_entry_safe(wait_node, tmp_wait_node,
&wait_queue->head, head) {
- assert(wait_node->app);
+ LTTNG_ASSERT(wait_node->app);
ret = lttng_poll_add(&events, wait_node->app->sock,
LPOLLHUP | LPOLLERR);
if (ret < 0) {
trigger_status = lttng_trigger_get_owner_uid(trigger,
trigger_owner_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
}
static inline
{
enum event_notifier_error_accounting_status status;
- assert(state);
+ LTTNG_ASSERT(state);
state->number_indices = index_count;
static
void fini_error_accounting_state(struct error_accounting_state *state)
{
- assert(state);
+ LTTNG_ASSERT(state);
/*
* Will assert if some error counter indices were not released (an
uint64_t local_error_counter_index;
enum event_notifier_error_accounting_status status;
- assert(state);
+ LTTNG_ASSERT(state);
/* Allocate a new index for that counter. */
index_alloc_status = lttng_index_allocator_alloc(state->index_allocator,
counter_aggregate.index.number_dimensions = 1;
counter_aggregate.index.dimension_indexes[0] = error_counter_index;
- assert(kernel_error_accounting_entry.error_counter_fd);
+ LTTNG_ASSERT(kernel_error_accounting_entry.error_counter_fd);
ret = kernctl_counter_get_aggregate_value(
kernel_error_accounting_entry.error_counter_fd,
}
/* Error count can't be negative. */
- assert(counter_aggregate.value.value >= 0);
+ LTTNG_ASSERT(counter_aggregate.value.value >= 0);
*count = (uint64_t) counter_aggregate.value.value;
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
}
del_ret = lttng_ht_del(state->indices_ht, &iter);
- assert(!del_ret);
+ LTTNG_ASSERT(!del_ret);
call_rcu(&index_entry->rcu_head, free_index_ht_entry);
}
struct cds_lfht_node *node_ptr;
struct ltt_ust_ht_key key;
- assert(ht);
- assert(ht->ht);
- assert(event);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(event);
key.name = event->attr.name;
key.filter = (struct lttng_bytecode *) event->filter;
node_ptr = cds_lfht_add_unique(ht->ht,
ht->hash_fct(event->node.key, lttng_ht_seed),
trace_ust_ht_match_event, &key, &event->node.node);
- assert(node_ptr == &event->node.node);
+ LTTNG_ASSERT(node_ptr == &event->node.node);
}
/*
int ret, error = 0, found = 0;
struct ltt_kernel_event *kevent;
- assert(kchan);
+ LTTNG_ASSERT(kchan);
/* For each event in the kernel session */
cds_list_for_each_entry(kevent, &kchan->events_list.head, list) {
int ret;
struct ltt_kernel_event *kevent;
- assert(kchan);
- assert(event);
+ LTTNG_ASSERT(kchan);
+ LTTNG_ASSERT(event);
kevent = trace_kernel_find_event(event->name, kchan,
event->type, filter);
int ret = LTTNG_OK, to_create = 0;
struct ltt_ust_event *uevent;
- assert(usess);
- assert(uchan);
- assert(event);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
+ LTTNG_ASSERT(event);
rcu_read_lock();
if (uevent->enabled) {
/* It's already enabled so everything is OK */
- assert(!to_create);
+ LTTNG_ASSERT(!to_create);
ret = LTTNG_ERR_UST_EVENT_ENABLED;
goto end;
}
struct lttng_ht_iter iter;
struct lttng_ht *ht;
- assert(usess);
- assert(uchan);
- assert(event_name);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
+ LTTNG_ASSERT(event_name);
ht = uchan->events;
do {
uevent = caa_container_of(node, struct ltt_ust_event, node);
- assert(uevent);
+ LTTNG_ASSERT(uevent);
if (uevent->enabled == 0) {
/* It's already disabled so everything is OK */
struct ltt_ust_event *uevent = NULL;
struct lttng_event *events = NULL;
- assert(usess);
- assert(uchan);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(uchan);
rcu_read_lock();
{
int ret;
- assert(usess);
+ LTTNG_ASSERT(usess);
DBG("Event agent enabling ALL events for session %" PRIu64, usess->id);
int ret, created = 0;
struct agent_event *aevent;
- assert(event);
- assert(agt);
+ LTTNG_ASSERT(event);
+ LTTNG_ASSERT(agt);
aevent = agent_find_event(event->name, event->loglevel_type,
event->loglevel, filter_expression, agt);
filter = NULL;
filter_expression = NULL;
created = 1;
- assert(!AGENT_EVENT_IS_ENABLED(aevent));
+ LTTNG_ASSERT(!AGENT_EVENT_IS_ENABLED(aevent));
}
if (created && aevent->filter) {
struct lttng_bytecode *filter,
char *filter_expression)
{
- assert(usess);
- assert(event);
- assert(agt);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(event);
+ LTTNG_ASSERT(agt);
DBG("Enabling agent event: event pattern = '%s', session id = %" PRIu64 ", loglevel type = %d, loglevel = %d, filter expression = '%s'",
event->name, usess->id, event->loglevel_type,
uid_t trigger_owner_uid = 0;
const char *trigger_name;
- assert(trigger);
- assert(agt);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(agt);
t_status = lttng_trigger_get_name(trigger, &trigger_name);
if (t_status != LTTNG_TRIGGER_STATUS_OK) {
}
t_status = lttng_trigger_get_owner_uid(trigger, &trigger_owner_uid);
- assert(t_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(t_status == LTTNG_TRIGGER_STATUS_OK);
condition = lttng_trigger_get_const_condition(trigger);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
c_status = lttng_condition_event_rule_matches_get_rule(
condition, &rule);
- assert(c_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
switch (lttng_event_rule_get_type(rule)) {
case LTTNG_EVENT_RULE_TYPE_JUL_LOGGING:
}
d_type = lttng_event_rule_get_domain_type(rule);
- assert(d_type == agt->domain);
+ LTTNG_ASSERT(d_type == agt->domain);
event = lttng_event_rule_generate_lttng_event(rule);
if (!event) {
default_event_name = DEFAULT_PYTHON_EVENT_NAME;
break;
default:
- assert(0);
+ abort();
}
return default_event_name;
{
int ret;
- assert(agt);
- assert(trigger);
- assert(aevent);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(aevent);
/*
* Actual ust event un-registration happens on the trigger
struct ltt_ust_channel *uchan = NULL;
const char *ust_event_name, *ust_channel_name;
- assert(agt);
- assert(usess);
- assert(aevent);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(aevent);
DBG("Event agent disabling %s (loglevel type %d, loglevel value %d) for session %" PRIu64,
aevent->name, aevent->loglevel_type, aevent->loglevel_value,
uevent = trace_ust_find_event(uchan->events, (char *) ust_event_name,
aevent->filter, LTTNG_UST_ABI_LOGLEVEL_ALL, -1, NULL);
/* If the agent event exists, it must be available on the UST side. */
- assert(uevent);
+ LTTNG_ASSERT(uevent);
if (usess->active) {
ret = ust_app_disable_event_glb(usess, uchan, uevent);
int ret = LTTNG_OK;
struct agent_event *aevent;
- assert(trigger);
- assert(agt);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(agt);
DBG("Event agent disabling for trigger %" PRIu64,
lttng_trigger_get_tracer_token(trigger));
struct lttng_ht_iter iter;
struct lttng_ht_node_str *node;
- assert(agt);
- assert(usess);
- assert(event_name);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(event_name);
DBG("Event agent disabling %s (all loglevels) for session %" PRIu64, event_name, usess->id);
struct agent_event *aevent;
struct lttng_ht_iter iter;
- assert(agt);
- assert(usess);
+ LTTNG_ASSERT(agt);
+ LTTNG_ASSERT(usess);
/*
* Disable event on agent application. Continue to disable all other events
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/hashtable/hashtable.h>
#include <common/common.h>
char tmp_path[PATH_MAX];
char *pathname = NULL;
- assert(consumer);
+ LTTNG_ASSERT(consumer);
/* Get the right path name destination */
if (consumer->type == CONSUMER_DST_LOCAL ||
size_t consumer_path_offset = 0;
/* Safety net */
- assert(channel);
- assert(ksession);
- assert(ksession->consumer);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(ksession->consumer);
consumer = ksession->consumer;
channel_attr_extended = (struct lttng_channel_extended *)
health_code_update();
rcu_read_lock();
session = session_find_by_id(ksession->id);
- assert(session);
- assert(pthread_mutex_trylock(&session->lock));
- assert(session_trylock_list());
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
+ LTTNG_ASSERT(session_trylock_list());
status = notification_thread_command_add_channel(
the_notification_thread_handle, session->name,
rcu_read_lock();
/* Safety net */
- assert(ksession);
- assert(ksession->consumer);
- assert(sock);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(ksession->consumer);
+ LTTNG_ASSERT(sock);
DBG("Sending metadata %d to kernel consumer",
ksession->metadata_stream_fd);
struct lttcomm_consumer_msg lkm;
struct consumer_output *consumer;
- assert(channel);
- assert(stream);
- assert(session);
- assert(session->consumer);
- assert(sock);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(session->consumer);
+ LTTNG_ASSERT(sock);
DBG("Sending stream %d of channel %s to kernel consumer",
stream->fd, channel->channel->name);
struct lttcomm_consumer_msg lkm;
struct consumer_output *consumer;
- assert(sock);
- assert(session);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(session);
DBG("Sending streams_sent");
/* Get consumer output pointer */
struct ltt_kernel_stream *stream;
/* Safety net */
- assert(channel);
- assert(ksession);
- assert(ksession->consumer);
- assert(sock);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ksession);
+ LTTNG_ASSERT(ksession->consumer);
+ LTTNG_ASSERT(sock);
rcu_read_lock();
struct ltt_kernel_channel *chan;
/* Safety net */
- assert(session);
- assert(session->consumer);
- assert(sock);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(session->consumer);
+ LTTNG_ASSERT(sock);
/* Bail out if consumer is disabled */
if (!session->consumer->enabled) {
int ret;
struct lttcomm_consumer_msg msg;
- assert(channel);
- assert(socket);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(socket);
DBG("Sending kernel consumer destroy channel key %" PRIu64, channel->key);
int ret;
struct lttcomm_consumer_msg msg;
- assert(metadata);
- assert(socket);
+ LTTNG_ASSERT(metadata);
+ LTTNG_ASSERT(socket);
DBG("Sending kernel consumer destroy channel key %" PRIu64, metadata->key);
{
int ret;
- assert(chan);
- assert(ctx);
+ LTTNG_ASSERT(chan);
+ LTTNG_ASSERT(ctx);
DBG("Adding context to channel %s", chan->channel->name);
ret = kernctl_add_context(chan->fd, &ctx->ctx);
int ret;
struct ltt_kernel_session *lks;
- assert(session);
+ LTTNG_ASSERT(session);
/* Allocate data structure */
lks = trace_kernel_create_session();
int ret;
struct ltt_kernel_channel *lkc;
- assert(session);
- assert(chan);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(chan);
/* Allocate kernel channel */
lkc = trace_kernel_create_channel(chan);
int ret;
int local_fd = -1;
- assert(event_notifier_group_fd);
+ LTTNG_ASSERT(event_notifier_group_fd);
/* Kernel event notifier group creation. */
ret = kernctl_create_event_notifier_group(kernel_tracer_fd);
const struct lttng_userspace_probe_location_lookup_method *lookup = NULL;
enum lttng_userspace_probe_location_lookup_method_type lookup_method_type;
- assert(lttng_userspace_probe_location_get_type(probe_location) ==
+ LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
lookup = lttng_userspace_probe_location_get_lookup_method(
lookup_method_type =
lttng_userspace_probe_location_lookup_method_get_type(lookup);
- assert(lookup_method_type ==
+ LTTNG_ASSERT(lookup_method_type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
symbol = lttng_userspace_probe_location_function_get_function_name(
int ret = 0;
int fd, i;
- assert(lttng_userspace_probe_location_get_type(probe_location) ==
+ LTTNG_ASSERT(lttng_userspace_probe_location_get_type(probe_location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
lookup = lttng_userspace_probe_location_get_lookup_method(probe_location);
lookup_method_type =
lttng_userspace_probe_location_lookup_method_get_type(lookup);
- assert(lookup_method_type ==
+ LTTNG_ASSERT(lookup_method_type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
int ret;
const struct lttng_userspace_probe_location *location = NULL;
- assert(ev);
- assert(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
+ LTTNG_ASSERT(ev);
+ LTTNG_ASSERT(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
location = lttng_event_get_userspace_probe_location(ev);
if (!location) {
enum lttng_event_rule_type event_rule_type;
const struct lttng_userspace_probe_location *location = NULL;
- assert(rule);
- assert(creds);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(creds);
event_rule_type = lttng_event_rule_get_type(rule);
- assert(event_rule_type == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE);
+ LTTNG_ASSERT(event_rule_type == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE);
status = lttng_event_rule_kernel_uprobe_get_location(rule, &location);
if (status != LTTNG_EVENT_RULE_STATUS_OK || !location) {
enum lttng_error_code ret;
struct ltt_kernel_event *event;
- assert(ev);
- assert(channel);
+ LTTNG_ASSERT(ev);
+ LTTNG_ASSERT(channel);
/* We pass ownership of filter_expression and filter */
ret = trace_kernel_create_event(ev, filter_expression,
{
int ret;
- assert(chan);
+ LTTNG_ASSERT(chan);
ret = kernctl_disable(chan->fd);
if (ret < 0) {
{
int ret;
- assert(chan);
+ LTTNG_ASSERT(chan);
ret = kernctl_enable(chan->fd);
if (ret < 0 && ret != -EEXIST) {
{
int ret;
- assert(event);
+ LTTNG_ASSERT(event);
ret = kernctl_enable(event->fd);
if (ret < 0) {
{
int ret;
- assert(event);
+ LTTNG_ASSERT(event);
ret = kernctl_disable(event->fd);
if (ret < 0) {
{
int ret;
- assert(event);
+ LTTNG_ASSERT(event);
rcu_read_lock();
cds_lfht_del(kernel_token_to_event_notifier_rule_ht, &event->ht_node);
int ret;
struct ltt_kernel_metadata *lkm = NULL;
- assert(session);
+ LTTNG_ASSERT(session);
/* Allocate kernel metadata */
lkm = trace_kernel_create_metadata();
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
ret = kernctl_start_session(session->fd);
if (ret < 0) {
int ret;
struct ltt_kernel_stream *stream;
- assert(channel);
+ LTTNG_ASSERT(channel);
DBG("Flush buffer for channel %s", channel->channel->name);
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
ret = kernctl_stop_session(session->fd);
if (ret < 0) {
int ret;
struct ltt_kernel_stream *lks;
- assert(channel);
+ LTTNG_ASSERT(channel);
while ((ret = kernctl_create_stream(channel->fd)) >= 0) {
lks = trace_kernel_create_stream(channel->channel->name,
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
ret = kernctl_create_stream(session->metadata->fd);
if (ret < 0) {
FILE *fp;
struct lttng_event *elist;
- assert(events);
+ LTTNG_ASSERT(events);
fd = kernctl_tracepoint_list(kernel_tracer_fd);
if (fd < 0) {
{
struct ltt_kernel_session *ksess = NULL;
- assert(kchan);
- assert(kchan->channel);
+ LTTNG_ASSERT(kchan);
+ LTTNG_ASSERT(kchan->channel);
DBG3("Kernel destroy channel %s", kchan->channel->name);
char *trace_path = NULL;
size_t consumer_path_offset = 0;
- assert(ksess);
- assert(ksess->consumer);
- assert(output);
+ LTTNG_ASSERT(ksess);
+ LTTNG_ASSERT(ksess->consumer);
+ LTTNG_ASSERT(output);
DBG("Kernel snapshot record started");
*/
int kernel_syscall_mask(int chan_fd, char **syscall_mask, uint32_t *nr_bits)
{
- assert(syscall_mask);
- assert(nr_bits);
+ LTTNG_ASSERT(syscall_mask);
+ LTTNG_ASSERT(nr_bits);
return kernctl_syscall_mask(chan_fd, syscall_mask, nr_bits);
}
struct lttng_ht_iter iter;
struct ltt_kernel_session *ksess = session->kernel_session;
- assert(ksess);
- assert(ksess->consumer);
+ LTTNG_ASSERT(ksess);
+ LTTNG_ASSERT(ksess->consumer);
DBG("Rotate kernel session %s started (session %" PRIu64 ")",
session->name, session->id);
enum lttng_trace_chunk_status chunk_status;
rcu_read_lock();
- assert(ksess->current_trace_chunk);
+ LTTNG_ASSERT(ksess->current_trace_chunk);
/*
* Create the index subdirectory which will take care
if (kernel_token_to_event_notifier_rule_ht) {
const int ret = cds_lfht_destroy(
kernel_token_to_event_notifier_rule_ht, NULL);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
}
DBG2("Closing kernel event notifier group file descriptor");
struct lttng_ht_iter iter;
struct ltt_kernel_session *ksess = session->kernel_session;
- assert(ksess);
- assert(ksess->consumer);
+ LTTNG_ASSERT(ksess);
+ LTTNG_ASSERT(ksess->consumer);
DBG("Clear kernel session %s (session %" PRIu64 ")",
session->name, session->id);
int local_fd = -1, ret;
enum lttng_error_code error_code_ret;
- assert(event_notifier_group_notification_fd);
+ LTTNG_ASSERT(event_notifier_group_notification_fd);
ret = kernctl_create_event_notifier_group_notification_fd(
kernel_tracer_event_notifier_group_fd);
const struct lttng_event_rule *event_rule = NULL;
enum lttng_condition_status cond_status;
- assert(trigger);
+ LTTNG_ASSERT(trigger);
condition = lttng_trigger_get_const_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
condition_type = lttng_condition_get_type(condition);
- assert(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+ LTTNG_ASSERT(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
/* Does not acquire a reference. */
condition_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
- assert(event_rule);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(event_rule);
event_rule_type = lttng_event_rule_get_type(event_rule);
- assert(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
+ LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
error_code_ret = trace_kernel_create_event_notifier_rule(trigger, token,
lttng_condition_event_rule_matches_get_error_counter_index(
/* Set the capture bytecode if any. */
cond_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &capture_bytecode_count);
- assert(cond_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
for (i = 0; i < capture_bytecode_count; i++) {
const struct lttng_bytecode *capture_bytecode =
lttng_trigger_get_const_condition(trigger);
const uint64_t token = lttng_trigger_get_tracer_token(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
/* Does not acquire a reference to the event rule. */
status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
domain_type = lttng_event_rule_get_domain_type(event_rule);
- assert(domain_type == LTTNG_DOMAIN_KERNEL);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
ret = kernel_create_event_notifier_rule(trigger, cmd_creds, token);
if (ret != LTTNG_OK) {
int ret;
ret = lttng_ht_del(ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
free(ksyscall);
}
ht_cleanup_push(ht);
struct lttng_ht_iter iter;
struct syscall *ksyscall = NULL;
- assert(ht);
- assert(name);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(name);
lttng_ht_lookup(ht, (void *) name, &iter);
node = lttng_ht_iter_get_node_str(&iter);
static void update_event_syscall_bitness(struct lttng_event *events,
unsigned int index, unsigned int syscall_index)
{
- assert(events);
+ LTTNG_ASSERT(events);
if (syscall_table[index].bitness == 32) {
events[syscall_index].flags |= LTTNG_EVENT_FLAG_SYSCALL_32;
int ret;
struct syscall *ksyscall;
- assert(ht);
+ LTTNG_ASSERT(ht);
ksyscall = zmalloc(sizeof(*ksyscall));
if (!ksyscall) {
/* Hash table used to filter duplicate out. */
struct lttng_ht *syscalls_ht = NULL;
- assert(_events);
+ LTTNG_ASSERT(_events);
DBG("Syscall table listing.");
ret = -EINVAL;
goto error;
}
- assert(path);
+ LTTNG_ASSERT(path);
DBG2("Creating consumer directory: %s", path);
}
trigger_status = lttng_triggers_get_count(triggers, &trigger_count);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
for (i = 0; i < trigger_count; i++) {
uid_t trigger_owner;
const struct lttng_trigger *trigger =
lttng_triggers_get_at_index(triggers, i);
- assert(trigger);
+ LTTNG_ASSERT(trigger);
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_owner);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
trigger_name = trigger_status == LTTNG_TRIGGER_STATUS_OK ?
uatomic_set(&the_ust_consumerd_state, CONSUMER_ERROR);
} else {
/* Code flow error... */
- assert(0);
+ abort();
}
if (consumer_data->err_sock >= 0) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
int ret;
char *tmp_list, *cur_list, *saveptr;
- assert(list);
+ LTTNG_ASSERT(list);
cur_list = tmp_list = strdup(list);
if (!tmp_list) {
enum lttng_error_code ret_code;
struct notification_thread_command cmd = {};
- assert(trigger);
+ LTTNG_ASSERT(trigger);
init_notification_thread_command(&cmd);
cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER;
enum lttng_error_code ret_code;
struct notification_thread_command cmd = {};
- assert(tracer_event_source_fd >= 0);
+ LTTNG_ASSERT(tracer_event_source_fd >= 0);
init_notification_thread_command(&cmd);
enum lttng_error_code ret_code;
struct notification_thread_command cmd = {};
- assert(handle);
- assert(triggers);
+ LTTNG_ASSERT(handle);
+ LTTNG_ASSERT(triggers);
init_notification_thread_command(&cmd);
cmd.type = NOTIFICATION_COMMAND_TYPE_QUIT;
ret = run_command_wait(handle, &cmd);
- assert(!ret && cmd.reply_code == LTTNG_OK);
+ LTTNG_ASSERT(!ret && cmd.reply_code == LTTNG_OK);
}
int notification_thread_client_communication_update(
{
struct lttng_event_notifier_notification *notification = NULL;
- assert(domain != LTTNG_DOMAIN_NONE);
- assert((payload && payload_size) || (!payload && !payload_size));
+ LTTNG_ASSERT(domain != LTTNG_DOMAIN_NONE);
+ LTTNG_ASSERT((payload && payload_size) || (!payload && !payload_size));
notification = zmalloc(sizeof(struct lttng_event_notifier_notification));
if (notification == NULL) {
#include <time.h>
#include <unistd.h>
-#include <assert.h>
#include <inttypes.h>
#include <fcntl.h>
struct notification_client_list *client_list;
const struct lttng_condition *condition;
- assert(condition_key);
+ LTTNG_ASSERT(condition_key);
client_list = caa_container_of(node, struct notification_client_list,
notification_trigger_clients_ht_node);
struct session_info *session_info = _data;
int ret;
- assert(session_info);
+ LTTNG_ASSERT(session_info);
if (session_info->channel_infos_ht) {
ret = cds_lfht_destroy(session_info->channel_infos_ht, NULL);
if (ret) {
{
struct session_info *session_info;
- assert(name);
+ LTTNG_ASSERT(name);
session_info = zmalloc(sizeof(*session_info));
if (!session_info) {
free(client_list_element);
}
- assert(cds_list_empty(&list->triggers_list));
+ LTTNG_ASSERT(cds_list_empty(&list->triggers_list));
pthread_mutex_destroy(&list->lock);
call_rcu(&list->rcu_node, free_notification_client_list_rcu);
lttng_trigger_get_const_condition(
element->trigger);
- assert(current_condition);
+ LTTNG_ASSERT(current_condition);
if (!lttng_condition_is_equal(condition,
current_condition)) {
continue;
channel_key,
&iter);
node = cds_lfht_iter_get_node(&iter);
- assert(node);
+ LTTNG_ASSERT(node);
channel_info = caa_container_of(node, struct channel_info,
channels_ht_node);
uid_t object_uid = 0;
gid_t object_gid = 0;
- assert(trigger);
- assert(condition);
- assert(client);
- assert(state);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(client);
+ LTTNG_ASSERT(state);
switch (get_condition_binding_object(condition)) {
case LTTNG_OBJECT_TYPE_SESSION:
status = lttng_condition_buffer_usage_get_domain_type(condition,
&condition_domain);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
if (channel_info->key.domain != condition_domain) {
goto fail;
}
status = lttng_condition_buffer_usage_get_session_name(
condition, &condition_session_name);
- assert((status == LTTNG_CONDITION_STATUS_OK) && condition_session_name);
+ LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_session_name);
status = lttng_condition_buffer_usage_get_channel_name(
condition, &condition_channel_name);
- assert((status == LTTNG_CONDITION_STATUS_OK) && condition_channel_name);
+ LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_channel_name);
if (strcmp(channel_info->session_info->name, condition_session_name)) {
goto fail;
status = lttng_condition_session_consumed_size_get_session_name(
condition, &condition_session_name);
- assert((status == LTTNG_CONDITION_STATUS_OK) && condition_session_name);
+ LTTNG_ASSERT((status == LTTNG_CONDITION_STATUS_OK) && condition_session_name);
if (strcmp(channel_info->session_info->name, condition_session_name)) {
goto fail;
goto end;
}
- assert(condition_session_name);
+ LTTNG_ASSERT(condition_session_name);
applies = !strcmp(condition_session_name, session_name);
break;
}
name, uid, gid);
session = caa_container_of(node, struct session_info,
sessions_ht_node);
- assert(session->uid == uid);
- assert(session->gid == gid);
+ LTTNG_ASSERT(session->uid == uid);
+ LTTNG_ASSERT(session->gid == gid);
session_info_get(session);
goto end;
}
&key,
&iter);
node = cds_lfht_iter_get_node(&iter);
- assert(node);
+ LTTNG_ASSERT(node);
channel_info = caa_container_of(node, struct channel_info,
channels_ht_node);
cds_lfht_del(state->channels_ht, node);
trigger = trigger_list_element->trigger;
condition = lttng_trigger_get_const_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
condition_type = lttng_condition_get_type(condition);
if (condition_type == LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING &&
{
int ret = 0;
- assert(source_element->is_fd_in_poll_set);
+ LTTNG_ASSERT(source_element->is_fd_in_poll_set);
DBG3("Removing tracer event source from poll set: tracer_event_source_fd = %d, domain = '%s'",
source_element->fd,
source_element = find_tracer_event_source_element(state,
tracer_event_source_fd);
- assert(source_element);
+ LTTNG_ASSERT(source_element);
ret = remove_tracer_event_source_from_pollset(state, source_element);
if (ret) {
source_element = find_tracer_event_source_element(state,
tracer_event_source_fd);
- assert(source_element);
+ LTTNG_ASSERT(source_element);
/* Remove the tracer source from the list. */
cds_list_del(&source_element->node);
trigger_status = lttng_trigger_get_owner_uid(trigger,
trigger_owner_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
}
static int handle_notification_thread_command_get_trigger(
ret = lttng_condition_buffer_usage_get_domain_type(condition,
&domain);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
if (domain != LTTNG_DOMAIN_KERNEL) {
is_supported = true;
lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
domain = lttng_event_rule_get_domain_type(event_rule);
if (domain != LTTNG_DOMAIN_KERNEL) {
&channel->key,
&lookup_iter);
node = cds_lfht_iter_get_node(&lookup_iter);
- assert(node);
+ LTTNG_ASSERT(node);
trigger_list = caa_container_of(node,
struct lttng_channel_trigger_list,
channel_triggers_ht_node);
lttng_trigger_get_const_action(trigger);
enum lttng_action_type action_type;
- assert(action);
+ LTTNG_ASSERT(action);
action_type = lttng_action_get_type(action);
if (action_type == LTTNG_ACTION_TYPE_NOTIFY) {
is_notify = true;
}
action_status = lttng_action_list_get_count(action, &count);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
for (i = 0; i < count; i++) {
const struct lttng_action *inner_action =
}
status = lttng_trigger_get_name(trigger, name);
- assert(status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
taken = trigger_name_taken(state, trigger);
} while (taken || state->trigger_id.name_offset == UINT64_MAX);
struct notification_thread_state *state,
struct lttng_trigger_ht_element *trigger_ht_element)
{
- assert(state);
- assert(trigger_ht_element);
+ LTTNG_ASSERT(state);
+ LTTNG_ASSERT(trigger_ht_element);
cds_lfht_del(state->triggers_ht, &trigger_ht_element->node);
cds_lfht_del(state->triggers_by_name_uid_ht, &trigger_ht_element->node_by_name_uid);
}
condition = lttng_trigger_get_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
/* Some conditions require tracers to implement a minimal ABI version. */
if (!condition_is_supported(condition)) {
* notification_trigger_clients_ht.
*/
client_list = get_client_list_from_condition(state, condition);
- assert(client_list);
+ LTTNG_ASSERT(client_list);
pthread_mutex_lock(&client_list->lock);
cds_list_del(&trigger_ht_element->client_list_trigger_node);
* If both data and fds are equal to zero, we are in an invalid
* state.
*/
- assert(fds_to_send_count != 0);
+ LTTNG_ASSERT(fds_to_send_count != 0);
goto send_fds;
}
*/
const struct lttng_notification_channel_message *msg;
- assert(sizeof(*msg) == client->communication.inbound.payload.buffer.size);
+ LTTNG_ASSERT(sizeof(*msg) == client->communication.inbound.payload.buffer.size);
msg = (const struct lttng_notification_channel_message *)
client->communication.inbound.payload.buffer.data;
}
receive_fds:
- assert(client->communication.inbound.bytes_to_receive == 0);
+ LTTNG_ASSERT(client->communication.inbound.bytes_to_receive == 0);
/* Receive fds. */
if (client->communication.inbound.fds_to_receive != 0) {
expected_size = sizeof(int) *
client->communication.inbound
.fds_to_receive;
- assert(ret == expected_size);
+ LTTNG_ASSERT(ret == expected_size);
client->communication.inbound.fds_to_receive = 0;
} else if (ret == 0) {
/* Received nothing. */
}
/* At this point the message is complete.*/
- assert(client->communication.inbound.bytes_to_receive == 0 &&
+ LTTNG_ASSERT(client->communication.inbound.bytes_to_receive == 0 &&
client->communication.inbound.fds_to_receive == 0);
ret = client_dispatch_message(client, state);
if (ret) {
ret = 0;
trigger = trigger_list_element->trigger;
condition = lttng_trigger_get_const_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
/*
* Check if any client is subscribed to the result of this
goto end;
}
- assert(cds_list_empty(&handle->cmd_queue.list));
+ LTTNG_ASSERT(cds_list_empty(&handle->cmd_queue.list));
pthread_mutex_destroy(&handle->cmd_queue.lock);
sem_destroy(&handle->ready);
if (state->client_socket_ht) {
ret = handle_notification_thread_client_disconnect_all(state);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = cds_lfht_destroy(state->client_socket_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->client_id_ht) {
ret = cds_lfht_destroy(state->client_id_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->triggers_ht) {
ret = handle_notification_thread_trigger_unregister_all(state);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = cds_lfht_destroy(state->triggers_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->channel_triggers_ht) {
ret = cds_lfht_destroy(state->channel_triggers_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->channel_state_ht) {
ret = cds_lfht_destroy(state->channel_state_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->notification_trigger_clients_ht) {
ret = cds_lfht_destroy(state->notification_trigger_clients_ht,
NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->channels_ht) {
ret = cds_lfht_destroy(state->channels_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->sessions_ht) {
ret = cds_lfht_destroy(state->sessions_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->triggers_by_name_uid_ht) {
ret = cds_lfht_destroy(state->triggers_by_name_uid_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->trigger_tokens_ht) {
ret = cds_lfht_destroy(state->trigger_tokens_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
* Must be destroyed after all channels have been destroyed.
*/
if (state->session_triggers_ht) {
ret = cds_lfht_destroy(state->session_triggers_ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
if (state->notification_channel_socket >= 0) {
notification_channel_socket_destroy(
state->notification_channel_socket);
}
- assert(cds_list_empty(&state->tracer_event_sources_list));
+ LTTNG_ASSERT(cds_list_empty(&state->tracer_event_sources_list));
if (state->executor) {
action_executor_destroy(state->executor);
{
struct notification_event_tracer_event_source_element *source_element;
- assert(domain);
+ LTTNG_ASSERT(domain);
cds_list_for_each_entry(source_element,
&state->tracer_event_sources_list, node) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <common/common.h>
#include <common/utils.h>
lttng_pipe_destroy(queue->event_pipe);
pthread_mutex_lock(&queue->lock);
- assert(cds_list_empty(&queue->list));
+ LTTNG_ASSERT(cds_list_empty(&queue->list));
pthread_mutex_unlock(&queue->lock);
pthread_mutex_destroy(&queue->lock);
free(queue);
bool chunk_exists_on_peer = false;
enum lttng_trace_chunk_status chunk_status;
- assert(session->chunk_being_archived);
+ LTTNG_ASSERT(session->chunk_being_archived);
/*
* Check for a local pending rotation on all consumers (32-bit
chunk_status = lttng_trace_chunk_get_id(
session->chunk_being_archived,
&chunk_being_archived_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
DBG("Rotation of trace archive %" PRIu64 " of session \"%s\" is complete on all consumers",
chunk_being_archived_id,
session->name);
chunk_status = lttng_trace_chunk_get_id(session->chunk_being_archived,
&chunk_being_archived_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
DBG("Checking for pending rotation on session \"%s\", trace archive %" PRIu64,
session->name, chunk_being_archived_id);
*/
chunk_status = lttng_trace_chunk_get_name(session->chunk_being_archived,
&archived_chunk_name, NULL);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
free(session->last_archived_chunk_name);
session->last_archived_chunk_name = strdup(archived_chunk_name);
if (!session->last_archived_chunk_name) {
chunk_status = lttng_trace_chunk_get_id(
session->chunk_being_archived,
&chunk_being_archived_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
DBG("Rotation of trace archive %" PRIu64 " is still pending for session %s",
chunk_being_archived_id, session->name);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <urcu/uatomic.h>
symbol_name = addr ? NULL : event->event->u.kretprobe.symbol_name;
break;
default:
- assert(1);
+ LTTNG_ASSERT(1);
ERR("Unsupported kernel instrumentation type.");
ret = LTTNG_ERR_INVALID;
goto end;
{
int ret;
- assert(writer);
- assert(ctx);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(ctx);
/* Perf contexts are saved as event_perf_context_type */
ret = config_writer_open_element(writer, config_element_context_perf);
{
int ret;
- assert(writer);
- assert(ctx);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(ctx);
/* Application contexts are saved as application_context_type */
ret = config_writer_open_element(writer, config_element_context_app);
int ret;
const char *context_type_string;
- assert(writer);
- assert(ctx);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(ctx);
/* Save context as event_context_type_type */
context_type_string = get_ust_context_type_string(
int ret;
struct ltt_ust_context *ctx;
- assert(writer);
- assert(ctx_list);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(ctx_list);
ret = config_writer_open_element(writer, config_element_contexts);
if (ret) {
{
int ret;
- assert(writer);
- assert(kchan);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(kchan);
ret = config_writer_open_element(writer, config_element_channel);
if (ret) {
{
int ret;
- assert(writer);
- assert(ust_chan);
- assert(session);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(ust_chan);
+ LTTNG_ASSERT(session);
ret = config_writer_open_element(writer, config_element_channel);
if (ret) {
int ret;
struct ltt_kernel_channel *kchan;
- assert(writer);
- assert(session);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session);
ret = config_writer_write_element_string(writer, config_element_type,
config_domain_type_kernel);
str_dom = config_domain_type_python;
break;
default:
- assert(0);
+ abort();
}
return str_dom;
{
tracker = kernel_get_process_attr_tracker(
sess->kernel_session, process_attr);
- assert(tracker);
+ LTTNG_ASSERT(tracker);
break;
}
case LTTNG_DOMAIN_UST:
{
tracker = trace_ust_get_process_attr_tracker(
sess->ust_session, process_attr);
- assert(tracker);
+ LTTNG_ASSERT(tracker);
break;
}
case LTTNG_DOMAIN_JUL:
lttng_process_attr_tracker_values_get_at_index(
values, i);
- assert(value);
+ LTTNG_ASSERT(value);
ret = config_writer_open_element(
writer, element_target_id);
if (ret) {
break;
case LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME:
name = value->value.user_name;
- assert(name);
+ LTTNG_ASSERT(name);
break;
case LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME:
name = value->value.group_name;
- assert(name);
+ LTTNG_ASSERT(name);
break;
default:
abort();
struct lttng_ht_iter iter;
const char *config_domain_name;
- assert(writer);
- assert(session);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session);
ret = config_writer_open_element(writer,
config_element_domain);
{
int ret = LTTNG_OK;
- assert(writer);
- assert(session);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session);
if (!session->kernel_session && !session->ust_session) {
goto end;
{
int ret;
- assert(writer);
- assert(output);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(output);
ret = config_writer_open_element(writer, config_element_consumer_output);
if (ret) {
struct lttng_ht_iter iter;
struct snapshot_output *output;
- assert(writer);
- assert(snapshot);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(snapshot);
ret = config_writer_open_element(writer, config_element_snapshot_outputs);
if (ret) {
{
int ret;
- assert(writer);
- assert(session);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session);
if ((session->snapshot_mode && session->snapshot.nb_output == 0) ||
(!session->snapshot_mode && !session->consumer)) {
const char *provided_path;
int file_open_flags = O_CREAT | O_WRONLY | O_TRUNC;
- assert(session);
- assert(attr);
- assert(creds);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(attr);
+ LTTNG_ASSERT(creds);
session_name_len = strlen(session->name);
memset(config_file_path, 0, sizeof(config_file_path));
int ret;
char *tok, *tmp_name;
- assert(name);
+ LTTNG_ASSERT(name);
tmp_name = strdup(name);
if (!tmp_name) {
*/
static uint64_t add_session_list(struct ltt_session *ls)
{
- assert(ls);
+ LTTNG_ASSERT(ls);
cds_list_add(&ls->list, <t_session_list.head);
return ltt_session_list.next_uuid++;
*/
static void del_session_list(struct ltt_session *ls)
{
- assert(ls);
+ LTTNG_ASSERT(ls);
cds_list_del(&ls->list);
}
{
int ret;
- assert(ls);
+ LTTNG_ASSERT(ls);
if (!ltt_sessions_ht_by_id) {
ret = ltt_sessions_ht_alloc();
}
/* Should always be present with ltt_sessions_ht_by_id. */
- assert(ltt_sessions_ht_by_name);
+ LTTNG_ASSERT(ltt_sessions_ht_by_name);
lttng_ht_node_init_u64(&ls->node, ls->id);
lttng_ht_add_unique_u64(ltt_sessions_ht_by_id, &ls->node);
goto end;
}
- assert(ltt_sessions_ht_by_name);
+ LTTNG_ASSERT(ltt_sessions_ht_by_name);
count = lttng_ht_get_count(ltt_sessions_ht_by_id);
- assert(count == lttng_ht_get_count(ltt_sessions_ht_by_name));
+ LTTNG_ASSERT(count == lttng_ht_get_count(ltt_sessions_ht_by_name));
end:
return count ? 0 : 1;
}
struct lttng_ht_iter iter;
int ret;
- assert(ls);
- assert(ltt_sessions_ht_by_id);
- assert(ltt_sessions_ht_by_name);
+ LTTNG_ASSERT(ls);
+ LTTNG_ASSERT(ltt_sessions_ht_by_id);
+ LTTNG_ASSERT(ltt_sessions_ht_by_name);
iter.iter.node = &ls->node.node;
ret = lttng_ht_del(ltt_sessions_ht_by_id, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
iter.iter.node = &ls->node_by_name.node;
ret = lttng_ht_del(ltt_sessions_ht_by_name, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
if (ltt_sessions_ht_empty()) {
DBG("Empty ltt_sessions_ht_by_id/name, destroying hast tables");
*/
void session_lock(struct ltt_session *session)
{
- assert(session);
+ LTTNG_ASSERT(session);
pthread_mutex_lock(&session->lock);
}
*/
void session_unlock(struct ltt_session *session)
{
- assert(session);
+ LTTNG_ASSERT(session);
pthread_mutex_unlock(&session->lock);
}
goto end;
}
chunk_status = lttng_trace_chunk_get_id(new_trace_chunk, &chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
refs_to_acquire = 1;
refs_to_acquire += !!session->ust_session;
if (consumer_output_override) {
output = consumer_output_override;
} else {
- assert(session->ust_session || session->kernel_session);
+ LTTNG_ASSERT(session->ust_session || session->kernel_session);
output = session->ust_session ?
session->ust_session->consumer :
session->kernel_session->consumer;
struct ltt_session *session = container_of(ref, typeof(*session), ref);
const bool session_published = session->published;
- assert(!session->chunk_being_archived);
+ LTTNG_ASSERT(!session->chunk_being_archived);
usess = session->ust_session;
ksess = session->kernel_session;
* may cause the removal of the session from the session_list.
*/
ASSERT_LOCKED(ltt_session_list.lock);
- assert(session->ref.refcount);
+ LTTNG_ASSERT(session->ref.refcount);
urcu_ref_put(&session->ref, session_release);
}
*/
void session_destroy(struct ltt_session *session)
{
- assert(!session->destroyed);
+ LTTNG_ASSERT(!session->destroyed);
session->destroyed = true;
session_put(session);
}
{
struct ltt_session *iter;
- assert(name);
+ LTTNG_ASSERT(name);
ASSERT_LOCKED(ltt_session_list.lock);
DBG2("Trying to find session by name %s", name);
*/
bool session_access_ok(struct ltt_session *session, uid_t uid)
{
- assert(session);
+ LTTNG_ASSERT(session);
return (uid == session->uid) || uid == 0;
}
chunk_status = lttng_trace_chunk_get_id(
session->chunk_being_archived,
&chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
LTTNG_OPTIONAL_SET(&session->last_archived_chunk_id,
chunk_id);
lttng_trace_chunk_put(session->chunk_being_archived);
#include "version.h"
#include "sessiond-config.h"
-#include <assert.h>
#include "lttng-ust-ctl.h"
#include <common/defaults.h>
#include <limits.h>
LTTNG_HIDDEN
void config_string_set(struct config_string *config_str, char *value)
{
- assert(config_str);
+ LTTNG_ASSERT(config_str);
if (config_str->should_free) {
free(config_str->value);
config_str->should_free = false;
bool is_root = (getuid() == 0);
char *str;
- assert(config);
+ LTTNG_ASSERT(config);
memcpy(config, &sessiond_config_build_defaults, sizeof(*config));
if (is_root) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <string.h>
#include <urcu/uatomic.h>
int ret;
struct lttng_ht_iter iter;
- assert(snapshot);
- assert(snapshot->output_ht);
- assert(output);
+ LTTNG_ASSERT(snapshot);
+ LTTNG_ASSERT(snapshot->output_ht);
+ LTTNG_ASSERT(output);
iter.iter.node = &output->node.node;
rcu_read_lock();
ret = lttng_ht_del(snapshot->output_ht, &iter);
rcu_read_unlock();
- assert(!ret);
+ LTTNG_ASSERT(!ret);
/*
* This is safe because the ownership of a snapshot object is in a session
* for which the session lock need to be acquired to read and modify it.
void snapshot_add_output(struct snapshot *snapshot,
struct snapshot_output *output)
{
- assert(snapshot);
- assert(snapshot->output_ht);
- assert(output);
+ LTTNG_ASSERT(snapshot);
+ LTTNG_ASSERT(snapshot->output_ht);
+ LTTNG_ASSERT(output);
rcu_read_lock();
lttng_ht_add_unique_ulong(snapshot->output_ht, &output->node);
*/
void snapshot_output_destroy(struct snapshot_output *obj)
{
- assert(obj);
+ LTTNG_ASSERT(obj);
if (obj->consumer) {
consumer_output_send_destroy_relayd(obj->consumer);
struct lttng_ht_iter iter;
struct snapshot_output *output = NULL;
- assert(snapshot);
- assert(name);
+ LTTNG_ASSERT(snapshot);
+ LTTNG_ASSERT(name);
cds_lfht_for_each_entry(snapshot->output_ht->ht, &iter.iter, output,
node.node) {
struct lttng_ht_iter iter;
struct snapshot_output *output = NULL;
- assert(snapshot);
+ LTTNG_ASSERT(snapshot);
lttng_ht_lookup(snapshot->output_ht, (void *)((unsigned long) id), &iter);
node = lttng_ht_iter_get_node_ulong(&iter);
{
int ret;
- assert(obj);
+ LTTNG_ASSERT(obj);
memset(obj, 0, sizeof(struct snapshot));
{
int ret;
- assert(events);
+ LTTNG_ASSERT(events);
ret = lttng_poll_create(events, size, LTTNG_CLOEXEC);
if (ret < 0) {
if (!thread) {
return;
}
- assert(thread->ref.refcount);
+ LTTNG_ASSERT(thread->ref.refcount);
urcu_ref_put(&thread->ref, lttng_thread_release);
}
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <signal.h>
#define UINT_TO_PTR(value) \
({ \
- assert(value <= UINTPTR_MAX); \
+ LTTNG_ASSERT(value <= UINTPTR_MAX); \
(void *) (uintptr_t) value; \
})
#define PTR_TO_UINT(ptr) ((uintptr_t) ptr)
{
int ret;
- assert(session);
- assert(session->rotation_pending_check_timer_enabled);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(session->rotation_pending_check_timer_enabled);
DBG("Disabling session rotation pending check timer on session %" PRIu64,
session->id);
{
int ret = 0;
- assert(session);
+ LTTNG_ASSERT(session);
if (!session->rotation_schedule_timer_enabled) {
goto end;
{
struct ltt_kernel_channel *chan;
- assert(session);
- assert(name);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(name);
/*
* If we receive an empty string for channel name, it means the
struct ltt_kernel_event *ev;
int found = 0;
- assert(name);
- assert(channel);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(channel);
cds_list_for_each_entry(ev, &channel->events_list.head, list) {
if (type != LTTNG_EVENT_ALL && ev->type != type) {
struct ltt_kernel_event *ev;
int found = 0;
- assert(name);
- assert(channel);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(channel);
cds_list_for_each_entry(ev, &channel->events_list.head, list) {
if (type != LTTNG_EVENT_ALL && ev->type != type) {
struct ltt_kernel_channel *lkc;
struct lttng_channel_extended *extended = NULL;
- assert(chan);
+ LTTNG_ASSERT(chan);
lkc = zmalloc(sizeof(struct ltt_kernel_channel));
if (lkc == NULL) {
{
struct ltt_kernel_context *kctx_copy;
- assert(kctx);
+ LTTNG_ASSERT(kctx);
kctx_copy = zmalloc(sizeof(*kctx_copy));
if (!kctx_copy) {
PERROR("zmalloc ltt_kernel_context");
struct ltt_kernel_event *local_kernel_event;
struct lttng_userspace_probe_location *userspace_probe_location = NULL;
- assert(ev);
+ LTTNG_ASSERT(ev);
local_kernel_event = zmalloc(sizeof(struct ltt_kernel_event));
attr = zmalloc(sizeof(struct lttng_kernel_abi_event));
const struct lttng_condition *condition = NULL;
const struct lttng_event_rule *event_rule = NULL;
- assert(event_notifier_rule);
+ LTTNG_ASSERT(event_notifier_rule);
condition = lttng_trigger_get_const_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
condition_type = lttng_condition_get_type(condition);
- assert(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
+ LTTNG_ASSERT(condition_type == LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
condition_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
- assert(event_rule);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(event_rule);
event_rule_type = lttng_event_rule_get_type(event_rule);
- assert(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
+ LTTNG_ASSERT(event_rule_type != LTTNG_EVENT_RULE_TYPE_UNKNOWN);
local_kernel_token_event_rule =
zmalloc(sizeof(struct ltt_kernel_event_notifier_rule));
{
k_status = lttng_kernel_probe_location_address_get_address(
location, &address);
- assert(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
+ LTTNG_ASSERT(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
break;
}
case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
{
k_status = lttng_kernel_probe_location_symbol_get_offset(
location, &offset);
- assert(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
+ LTTNG_ASSERT(k_status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
symbol_name = lttng_kernel_probe_location_symbol_get_name(
location);
break;
kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_ABI_SYM_NAME_LEN - 1] = '\0';
status = lttng_event_rule_kernel_kprobe_get_event_name(rule, &name);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
ret_code = LTTNG_OK;
break;
}
status = lttng_event_rule_kernel_uprobe_get_event_name(
rule, &name);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
ret_code = LTTNG_OK;
break;
}
lttng_event_rule_kernel_tracepoint_get_name_pattern(
rule, &name);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
kernel_event_notifier->event.instrumentation =
LTTNG_KERNEL_ABI_TRACEPOINT;
lttng_event_rule_kernel_syscall_get_emission_site(rule);
enum lttng_kernel_abi_syscall_entryexit entryexit;
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(emission_site != LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(emission_site != LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_UNKNOWN);
switch(emission_site) {
case LTTNG_EVENT_RULE_KERNEL_SYSCALL_EMISSION_SITE_ENTRY:
int ret;
struct ltt_kernel_stream *lks;
- assert(name);
+ LTTNG_ASSERT(name);
lks = zmalloc(sizeof(struct ltt_kernel_stream));
if (lks == NULL) {
*/
void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
DBG("[trace] Closing stream fd %d", stream->fd);
/* Close kernel fd */
*/
void trace_kernel_destroy_event(struct ltt_kernel_event *event)
{
- assert(event);
+ LTTNG_ASSERT(event);
if (event->fd >= 0) {
int ret;
void trace_kernel_destroy_event_notifier_rule(
struct ltt_kernel_event_notifier_rule *event)
{
- assert(event);
+ LTTNG_ASSERT(event);
if (event->fd >= 0) {
const int ret = close(event->fd);
*/
void trace_kernel_destroy_context(struct ltt_kernel_context *ctx)
{
- assert(ctx);
+ LTTNG_ASSERT(ctx);
if (ctx->in_list) {
cds_list_del(&ctx->list);
int ret;
enum lttng_error_code status;
- assert(channel);
+ LTTNG_ASSERT(channel);
DBG("[trace] Closing channel fd %d", channel->fd);
/* Close kernel fd */
status = notification_thread_command_remove_channel(
the_notification_thread_handle, channel->key,
LTTNG_DOMAIN_KERNEL);
- assert(status == LTTNG_OK);
+ LTTNG_ASSERT(status == LTTNG_OK);
}
free(channel->channel->attr.extended.ptr);
free(channel->channel);
*/
void trace_kernel_destroy_metadata(struct ltt_kernel_metadata *metadata)
{
- assert(metadata);
+ LTTNG_ASSERT(metadata);
DBG("[trace] Closing metadata fd %d", metadata->fd);
/* Close kernel fd */
struct ltt_kernel_channel *channel, *ctmp;
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
DBG("[trace] Closing session fd %d", session->fd);
/* Close kernel fds */
struct ltt_ust_event *event;
const char *name;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct ltt_ust_event, node.node);
name = _key;
int ev_loglevel_value;
int ll_match;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct ltt_ust_event, node.node);
key = _key;
struct lttng_ht_iter iter;
struct ltt_ust_ht_key key;
- assert(name);
- assert(ht);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(ht);
key.name = name;
key.filter = filter;
struct lttng_ht_iter iter;
uint64_t key;
- assert(session);
+ LTTNG_ASSERT(session);
DBG3("Trace ust agent lookup for domain %d", domain_type);
{
struct ltt_ust_channel *luc;
- assert(chan);
+ LTTNG_ASSERT(chan);
luc = zmalloc(sizeof(struct ltt_ust_channel));
if (luc == NULL) {
size_t i;
int ret = 0;
- assert(exclusion);
+ LTTNG_ASSERT(exclusion);
for (i = 0; i < exclusion->count; ++i) {
size_t j;
struct ltt_ust_event *local_ust_event;
enum lttng_error_code ret = LTTNG_OK;
- assert(ev);
+ LTTNG_ASSERT(ev);
if (exclusion && validate_exclusion(exclusion)) {
ret = LTTNG_ERR_INVALID;
}
break;
case LTTNG_UST_ABI_CONTEXT_APP_CONTEXT:
- assert(uctx->ctx.u.app_ctx.provider_name);
- assert(uctx->ctx.u.app_ctx.ctx_name);
+ LTTNG_ASSERT(uctx->ctx.u.app_ctx.provider_name);
+ LTTNG_ASSERT(uctx->ctx.u.app_ctx.ctx_name);
if (strcmp(uctx->ctx.u.app_ctx.provider_name,
ctx->u.app_ctx.provider_name) ||
strcmp(uctx->ctx.u.app_ctx.ctx_name,
struct ltt_ust_context *uctx = NULL;
int utype;
- assert(ctx);
+ LTTNG_ASSERT(ctx);
utype = trace_ust_context_type_event_to_ust(ctx->ctx);
if (utype < 0) {
node.node) {
int ret = lttng_ht_del(id_tracker->ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
destroy_id_tracker_node(tracker_node);
}
rcu_read_unlock();
goto end;
}
ret = lttng_ht_del(id_tracker->ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
destroy_id_tracker_node(tracker_node);
end:
struct lttng_ht_iter iter;
struct ltt_ust_context *ctx;
- assert(ht);
+ LTTNG_ASSERT(ht);
rcu_read_lock();
cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
*/
void trace_ust_destroy_event(struct ltt_ust_event *event)
{
- assert(event);
+ LTTNG_ASSERT(event);
DBG2("Trace destroy UST event %s", event->attr.name);
free(event->filter_expression);
*/
void trace_ust_destroy_context(struct ltt_ust_context *ctx)
{
- assert(ctx);
+ LTTNG_ASSERT(ctx);
if (ctx->ctx.ctx == LTTNG_UST_ABI_CONTEXT_APP_CONTEXT) {
free(ctx->ctx.u.app_ctx.provider_name);
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
- assert(events);
+ LTTNG_ASSERT(events);
rcu_read_lock();
cds_lfht_for_each_entry(events->ht, &iter.iter, node, node) {
ret = lttng_ht_del(events, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
call_rcu(&node->head, destroy_event_rcu);
}
rcu_read_unlock();
*/
static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel)
{
- assert(channel);
+ LTTNG_ASSERT(channel);
DBG2("Trace destroy UST channel %s", channel->name);
int ret;
struct lttng_ht_iter iter;
- assert(ht);
- assert(channel);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(channel);
iter.iter.node = &channel->node.node;
ret = lttng_ht_del(ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/*
struct lttng_ht_node_str *node;
struct lttng_ht_iter iter;
- assert(channels);
+ LTTNG_ASSERT(channels);
rcu_read_lock();
cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
*/
static void destroy_domain_global(struct ltt_ust_domain_global *dom)
{
- assert(dom);
+ LTTNG_ASSERT(dom);
destroy_channels(dom->channels);
}
struct buffer_reg_uid *reg, *sreg;
struct lttng_ht_iter iter;
- assert(session);
+ LTTNG_ASSERT(session);
DBG2("Trace UST destroy session %" PRIu64, session->id);
cds_lfht_for_each_entry(session->agents->ht, &iter.iter, agt, node.node) {
int ret = lttng_ht_del(session->agents, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
agent_destroy(agt);
}
rcu_read_unlock();
}
rcu_read_unlock();
ret = cds_lfht_destroy(tracker->inclusion_set_ht, NULL);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
tracker->inclusion_set_ht = NULL;
}
static int process_attr_tracker_create_inclusion_set(
struct process_attr_tracker *tracker)
{
- assert(!tracker->inclusion_set_ht);
+ LTTNG_ASSERT(!tracker->inclusion_set_ht);
tracker->inclusion_set_ht = cds_lfht_new(DEFAULT_HT_SIZE, 1, 0,
CDS_LFHT_AUTO_RESIZE | CDS_LFHT_ACCOUNTING, NULL);
return tracker->inclusion_set_ht ? 0 : -1;
struct cds_lfht_iter iter;
struct cds_lfht_node *node;
- assert(tracker->policy == LTTNG_TRACKING_POLICY_INCLUDE_SET);
+ LTTNG_ASSERT(tracker->policy == LTTNG_TRACKING_POLICY_INCLUDE_SET);
rcu_read_lock();
cds_lfht_lookup(tracker->inclusion_set_ht,
trigger_name : "(anonymous)";
status = lttng_trigger_get_owner_uid(trigger,
&trigger_owner);
- assert(status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
/*
* Only add discarded tracer messages count for applicable conditions.
trigger_name : "(anonymous)";
status = lttng_trigger_get_owner_uid(trigger,
&trigger_owner);
- assert(status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
action_status = lttng_action_add_error_query_results(
lttng_trigger_get_action(trigger), results);
const struct ust_app_ht_key *key;
int ev_loglevel_value;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct ust_app_event, node.node);
key = _key;
struct ust_app_ht_key key;
struct lttng_ht *ht;
- assert(ua_chan);
- assert(ua_chan->events);
- assert(event);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(ua_chan->events);
+ LTTNG_ASSERT(event);
ht = ua_chan->events;
key.name = event->attr.name;
node_ptr = cds_lfht_add_unique(ht->ht,
ht->hash_fct(event->node.key, lttng_ht_seed),
ht_match_ust_app_event, &key, &event->node.node);
- assert(node_ptr == &event->node.node);
+ LTTNG_ASSERT(node_ptr == &event->node.node);
}
/*
caa_container_of(head, struct ust_app_notify_sock_obj, head);
/* Must have a valid fd here. */
- assert(obj->fd >= 0);
+ LTTNG_ASSERT(obj->fd >= 0);
ret = close(obj->fd);
if (ret) {
* session.
*
* A registry per UID object MUST exists before calling this function or else
- * it assert() if not found. RCU read side lock must be acquired.
+ * it LTTNG_ASSERT() if not found. RCU read side lock must be acquired.
*/
static struct ust_registry_session *get_session_registry(
struct ust_app_session *ua_sess)
{
struct ust_registry_session *registry = NULL;
- assert(ua_sess);
+ LTTNG_ASSERT(ua_sess);
switch (ua_sess->buffer_type) {
case LTTNG_BUFFER_PER_PID:
break;
}
default:
- assert(0);
+ abort();
};
error:
{
int ret;
- assert(ua_ctx);
+ LTTNG_ASSERT(ua_ctx);
if (ua_ctx->obj) {
pthread_mutex_lock(&app->sock_lock);
{
int ret;
- assert(ua_event);
+ LTTNG_ASSERT(ua_event);
free(ua_event->filter);
if (ua_event->exclusion != NULL)
{
int ret;
- assert(ua_event_notifier_rule);
+ LTTNG_ASSERT(ua_event_notifier_rule);
if (ua_event_notifier_rule->exclusion != NULL) {
free(ua_event_notifier_rule->exclusion);
{
int ret = 0;
- assert(stream);
+ LTTNG_ASSERT(stream);
if (stream->obj) {
pthread_mutex_lock(&app->sock_lock);
void delete_ust_app_stream(int sock, struct ust_app_stream *stream,
struct ust_app *app)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
(void) release_ust_app_stream(sock, stream, app);
free(stream);
struct ust_app_stream *stream, *stmp;
struct ust_registry_session *registry;
- assert(ua_chan);
+ LTTNG_ASSERT(ua_chan);
DBG3("UST app deleting channel %s", ua_chan->name);
cds_lfht_for_each_entry(ua_chan->ctx->ht, &iter.iter, ua_ctx, node.node) {
cds_list_del(&ua_ctx->list);
ret = lttng_ht_del(ua_chan->ctx, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
delete_ust_app_ctx(sock, ua_ctx, app);
}
cds_lfht_for_each_entry(ua_chan->events->ht, &iter.iter, ua_event,
node.node) {
ret = lttng_ht_del(ua_chan->events, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
delete_ust_app_event(sock, ua_event, app);
}
/* Remove channel from application UST object descriptor. */
iter.iter.node = &ua_chan->ust_objd_node.node;
ret = lttng_ht_del(app->ust_objd, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
pthread_mutex_lock(&app->sock_lock);
ret = lttng_ust_ctl_release_object(sock, ua_chan->obj);
pthread_mutex_unlock(&app->sock_lock);
ssize_t ret_val;
uint64_t metadata_key, metadata_version;
- assert(registry);
- assert(socket);
+ LTTNG_ASSERT(registry);
+ LTTNG_ASSERT(socket);
metadata_key = registry->metadata_key;
ssize_t ret;
struct consumer_socket *socket;
- assert(registry);
- assert(consumer);
+ LTTNG_ASSERT(registry);
+ LTTNG_ASSERT(consumer);
pthread_mutex_lock(®istry->lock);
if (registry->metadata_closed) {
uint64_t metadata_key;
bool registry_was_already_closed;
- assert(registry);
- assert(consumer);
+ LTTNG_ASSERT(registry);
+ LTTNG_ASSERT(consumer);
rcu_read_lock();
struct ust_app_channel *ua_chan;
struct ust_registry_session *registry;
- assert(ua_sess);
+ LTTNG_ASSERT(ua_sess);
pthread_mutex_lock(&ua_sess->lock);
- assert(!ua_sess->deleted);
+ LTTNG_ASSERT(!ua_sess->deleted);
ua_sess->deleted = true;
registry = get_session_registry(ua_sess);
cds_lfht_for_each_entry(ua_sess->channels->ht, &iter.iter, ua_chan,
node.node) {
ret = lttng_ht_del(ua_sess->channels, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
delete_ust_app_channel(sock, ua_chan, app);
}
/* Remove session from application UST object descriptor. */
iter.iter.node = &ua_sess->ust_objd_node.node;
ret = lttng_ht_del(app->ust_sessions_objd, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
pthread_mutex_unlock(&ua_sess->lock);
cds_lfht_for_each_entry (app->token_to_event_notifier_rule_ht->ht,
&iter.iter, event_notifier_rule, node.node) {
ret = lttng_ht_del(app->token_to_event_notifier_rule_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
delete_ust_app_event_notifier_rule(
app->sock, event_notifier_rule, app);
int ret;
struct lttng_ht_iter iter;
- assert(app);
- assert(ua_sess);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(ua_sess);
iter.iter.node = &ua_sess->node.node;
ret = lttng_ht_del(app->sessions, &iter);
ua_event_notifier_rule->token);
condition = lttng_trigger_get_condition(trigger);
- assert(condition);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
cond_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(cond_status == LTTNG_CONDITION_STATUS_OK);
- assert(event_rule);
+ LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(event_rule);
ua_event_notifier_rule->error_counter_index =
lttng_condition_event_rule_matches_get_error_counter_index(condition);
goto error;
}
- assert(sizeof(struct lttng_bytecode) ==
+ LTTNG_ASSERT(sizeof(struct lttng_bytecode) ==
sizeof(struct lttng_ust_abi_filter_bytecode));
memcpy(filter, orig_f, sizeof(*filter) + orig_f->len);
error:
goto error;
}
- assert(sizeof(struct lttng_bytecode) ==
+ LTTNG_ASSERT(sizeof(struct lttng_bytecode) ==
sizeof(struct lttng_ust_abi_capture_bytecode));
memcpy(capture, orig_f, sizeof(*capture) + orig_f->len);
error:
struct ust_app_event *event = NULL;
struct ust_app_ht_key key;
- assert(name);
- assert(ht);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(ht);
/* Setup key for event lookup. */
key.name = name;
struct lttng_ht_node_u64 *node;
struct ust_app_event_notifier_rule *event_notifier_rule = NULL;
- assert(ht);
+ LTTNG_ASSERT(ht);
lttng_ht_lookup(ht, &token, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
goto end;
}
- assert(sizeof(struct lttng_event_exclusion) ==
+ LTTNG_ASSERT(sizeof(struct lttng_event_exclusion) ==
sizeof(struct lttng_ust_abi_event_exclusion));
memcpy(ust_exclusion, exclusion, exclusion_alloc_size);
end:
int ret;
struct lttng_ust_abi_event_exclusion *ust_exclusions = NULL;
- assert(exclusions && exclusions->count > 0);
+ LTTNG_ASSERT(exclusions && exclusions->count > 0);
health_code_update();
int ret;
struct ust_app_stream *stream, *stmp;
- assert(app);
- assert(ua_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
health_code_update();
switch (ret) {
case -LTTNG_UST_ERR_PERM:
/* Code flow problem */
- assert(0);
+ abort();
case -LTTNG_UST_ERR_EXIST:
/* It's OK for our use case. */
ret = 0;
} else {
const struct lttng_log_level_rule *log_level_rule;
- assert(lttng_event_rule_get_type(rule) ==
+ LTTNG_ASSERT(lttng_event_rule_get_type(rule) ==
LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT);
status = lttng_event_rule_user_tracepoint_get_name_pattern(rule, &pattern);
abort();
}
- assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
} else {
/* At this point this is a fatal error. */
abort();
enum lttng_event_rule_type event_rule_type;
health_code_update();
- assert(app->event_notifier_group.object);
+ LTTNG_ASSERT(app->event_notifier_group.object);
condition = lttng_trigger_get_const_condition(
ua_event_notifier_rule->trigger);
- assert(condition);
- assert(lttng_condition_get_type(condition) ==
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(lttng_condition_get_type(condition) ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
condition_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
- assert(event_rule);
+ LTTNG_ASSERT(event_rule);
event_rule_type = lttng_event_rule_get_type(event_rule);
- assert(event_rule_type == LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT ||
+ LTTNG_ASSERT(event_rule_type == LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT ||
event_rule_type == LTTNG_EVENT_RULE_TYPE_JUL_LOGGING ||
event_rule_type ==
LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING ||
/* Set the capture bytecodes. */
cond_status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &capture_bytecode_count);
- assert(cond_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(cond_status == LTTNG_CONDITION_STATUS_OK);
for (i = 0; i < capture_bytecode_count; i++) {
const struct lttng_bytecode *capture_bytecode =
app->bits_per_long);
break;
default:
- assert(0);
+ abort();
goto error;
}
if (ret < 0) {
PERROR("asprintf UST shadow copy session");
- assert(0);
+ abort();
goto error;
}
app->uid, app->bits_per_long);
break;
default:
- assert(0);
+ abort();
goto error;
}
if (ret < 0) {
PERROR("sprintf UST shadow copy session");
- assert(0);
+ abort();
goto error;
}
strncat(ua_sess->shm_path, tmp_shm_path,
int ret = 0;
struct buffer_reg_pid *reg_pid;
- assert(ua_sess);
- assert(app);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(app);
rcu_read_lock();
int ret = 0;
struct buffer_reg_uid *reg_uid;
- assert(usess);
- assert(app);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(app);
rcu_read_lock();
int ret, created = 0;
struct ust_app_session *ua_sess;
- assert(usess);
- assert(app);
- assert(ua_sess_ptr);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(ua_sess_ptr);
health_code_update();
}
break;
default:
- assert(0);
+ abort();
ret = -EINVAL;
goto error;
}
struct ust_app_ctx *ctx;
const struct lttng_ust_context_attr *key;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
ctx = caa_container_of(node, struct ust_app_ctx, node.node);
key = _key;
struct lttng_ht_node_ulong *node;
struct ust_app_ctx *app_ctx = NULL;
- assert(uctx);
- assert(ht);
+ LTTNG_ASSERT(uctx);
+ LTTNG_ASSERT(ht);
/* Lookup using the lttng_ust_context_type and a custom match fct. */
cds_lfht_lookup(ht->ht, ht->hash_fct((void *) uctx->ctx, lttng_ht_seed),
unsigned int nb_fd = 0;
struct consumer_socket *socket;
- assert(usess);
- assert(ua_sess);
- assert(ua_chan);
- assert(registry);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(registry);
rcu_read_lock();
health_code_update();
{
int ret;
- assert(reg_stream);
- assert(stream);
+ LTTNG_ASSERT(reg_stream);
+ LTTNG_ASSERT(stream);
/* Duplicating a stream requires 2 new fds. Reserve them. */
ret = lttng_fd_get(LTTNG_FD_APPS, 2);
{
int ret;
- assert(buf_reg_chan);
- assert(ua_chan);
+ LTTNG_ASSERT(buf_reg_chan);
+ LTTNG_ASSERT(ua_chan);
/* Duplicating a channel requires 1 new fd. Reserve it. */
ret = lttng_fd_get(LTTNG_FD_APPS, 1);
int ret = 0;
struct ust_app_stream *stream, *stmp;
- assert(buf_reg_chan);
- assert(ua_chan);
+ LTTNG_ASSERT(buf_reg_chan);
+ LTTNG_ASSERT(ua_chan);
DBG2("UST app setup buffer registry stream");
int ret;
struct buffer_reg_channel *buf_reg_chan = NULL;
- assert(reg_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(reg_sess);
+ LTTNG_ASSERT(ua_chan);
DBG2("UST app creating buffer registry channel for %s", ua_chan->name);
if (ret < 0) {
goto error_create;
}
- assert(buf_reg_chan);
+ LTTNG_ASSERT(buf_reg_chan);
buf_reg_chan->consumer_key = ua_chan->key;
buf_reg_chan->subbuf_size = ua_chan->attr.subbuf_size;
buf_reg_chan->num_subbuf = ua_chan->attr.num_subbuf;
{
int ret;
- assert(reg_sess);
- assert(buf_reg_chan);
- assert(ua_chan);
- assert(ua_chan->obj);
+ LTTNG_ASSERT(reg_sess);
+ LTTNG_ASSERT(buf_reg_chan);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(ua_chan->obj);
DBG2("UST app setup buffer registry channel for %s", ua_chan->name);
int ret;
struct buffer_reg_stream *reg_stream;
- assert(buf_reg_chan);
- assert(app);
- assert(ua_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(buf_reg_chan);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
DBG("UST app sending buffer registry channel to ust sock %d", app->sock);
enum lttng_error_code notification_ret;
struct ust_registry_channel *ust_reg_chan;
- assert(app);
- assert(usess);
- assert(ua_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
DBG("UST app creating channel %s with per UID buffers", ua_chan->name);
* object. If none can be find, there is a code flow problem or a
* teardown race.
*/
- assert(reg_uid);
+ LTTNG_ASSERT(reg_uid);
buf_reg_chan = buffer_reg_channel_find(ua_chan->tracing_channel_id,
reg_uid);
}
session = session_find_by_id(ua_sess->tracing_id);
- assert(session);
- assert(pthread_mutex_trylock(&session->lock));
- assert(session_trylock_list());
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
+ LTTNG_ASSERT(session_trylock_list());
/*
* Create the buffers on the consumer side. This call populates the
pthread_mutex_lock(®_uid->registry->reg.ust->lock);
ust_reg_chan = ust_registry_channel_find(reg_uid->registry->reg.ust,
ua_chan->tracing_channel_id);
- assert(ust_reg_chan);
+ LTTNG_ASSERT(ust_reg_chan);
ust_reg_chan->consumer_key = ua_chan->key;
ust_reg_chan = NULL;
pthread_mutex_unlock(®_uid->registry->reg.ust->lock);
uint64_t chan_reg_key;
struct ust_registry_channel *ust_reg_chan;
- assert(app);
- assert(usess);
- assert(ua_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
DBG("UST app creating channel %s with per PID buffers", ua_chan->name);
registry = get_session_registry(ua_sess);
/* The UST app session lock is held, registry shall not be null. */
- assert(registry);
+ LTTNG_ASSERT(registry);
/* Create and add a new channel registry to session. */
ret = ust_registry_channel_add(registry, ua_chan->key);
}
session = session_find_by_id(ua_sess->tracing_id);
- assert(session);
+ LTTNG_ASSERT(session);
- assert(pthread_mutex_trylock(&session->lock));
- assert(session_trylock_list());
+ LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
+ LTTNG_ASSERT(session_trylock_list());
/* Create and get channel on the consumer side. */
ret = do_consumer_create_channel(usess, ua_sess, ua_chan,
chan_reg_key = ua_chan->key;
pthread_mutex_lock(®istry->lock);
ust_reg_chan = ust_registry_channel_find(registry, chan_reg_key);
- assert(ust_reg_chan);
+ LTTNG_ASSERT(ust_reg_chan);
ust_reg_chan->consumer_key = ua_chan->key;
pthread_mutex_unlock(®istry->lock);
{
int ret;
- assert(app);
- assert(usess);
- assert(usess->active);
- assert(ua_sess);
- assert(ua_chan);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(usess->active);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
/* Handle buffer type before sending the channel to the application. */
switch (usess->buffer_type) {
break;
}
default:
- assert(0);
+ abort();
ret = -EINVAL;
goto error;
}
struct ust_registry_session *registry;
struct ltt_session *session = NULL;
- assert(ua_sess);
- assert(app);
- assert(consumer);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(consumer);
registry = get_session_registry(ua_sess);
/* The UST app session is held registry shall not be null. */
- assert(registry);
+ LTTNG_ASSERT(registry);
pthread_mutex_lock(®istry->lock);
registry->metadata_key = metadata->key;
session = session_find_by_id(ua_sess->tracing_id);
- assert(session);
+ LTTNG_ASSERT(session);
- assert(pthread_mutex_trylock(&session->lock));
- assert(session_trylock_list());
+ LTTNG_ASSERT(pthread_mutex_trylock(&session->lock));
+ LTTNG_ASSERT(session_trylock_list());
/*
* Ask the metadata channel creation to the consumer. The metadata object
struct ust_app *lta = NULL;
struct lttng_pipe *event_notifier_event_source_pipe = NULL;
- assert(msg);
- assert(sock >= 0);
+ LTTNG_ASSERT(msg);
+ LTTNG_ASSERT(sock >= 0);
DBG3("UST app creating application for socket %d", sock);
*/
void ust_app_add(struct ust_app *app)
{
- assert(app);
- assert(app->notify_sock >= 0);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(app->notify_sock >= 0);
app->registration_time = time(NULL);
{
int ret;
- assert(app);
+ LTTNG_ASSERT(app);
pthread_mutex_lock(&app->sock_lock);
ret = lttng_ust_ctl_tracer_version(app->sock, &app->version);
enum lttng_error_code lttng_ret;
enum event_notifier_error_accounting_status event_notifier_error_accounting_status;
- assert(app);
+ LTTNG_ASSERT(app);
if (!ust_app_supports_notifiers(app)) {
ret = -ENOSYS;
/* Get the node reference for a call_rcu */
lttng_ht_lookup(ust_app_ht_by_sock, (void *)((unsigned long) sock), &ust_app_sock_iter);
node = lttng_ht_iter_get_node_ulong(&ust_app_sock_iter);
- assert(node);
+ LTTNG_ASSERT(node);
lta = caa_container_of(node, struct ust_app, sock_n);
DBG("PID %d unregistering with sock %d", lta->pid, sock);
/* Remove application from PID hash table */
ret = lttng_ht_del(ust_app_ht_by_sock, &ust_app_sock_iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
/*
* Remove application from notify hash table. The thread handling the
* Assert that all notifiers are gone as all triggers
* are unregistered prior to this clean-up.
*/
- assert(lttng_ht_get_count(app->token_to_event_notifier_rule_ht) == 0);
+ LTTNG_ASSERT(lttng_ht_get_count(app->token_to_event_notifier_rule_ht) == 0);
ust_app_notify_sock_unregister(app->notify_sock);
}
if (ust_app_ht) {
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
ret = lttng_ht_del(ust_app_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
call_rcu(&app->pid_n.head, delete_ust_app_rcu);
}
}
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);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
}
struct ust_app_session *ua_sess;
struct ust_app_channel *ua_chan;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
DBG2("UST app disabling channel %s from global domain for session id %" PRIu64,
uchan->name, usess->id);
lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
/* If the session if found for the app, the channel must be there */
- assert(ua_chan_node);
+ LTTNG_ASSERT(ua_chan_node);
ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
/* The channel must not be already disabled */
- assert(ua_chan->enabled == 1);
+ LTTNG_ASSERT(ua_chan->enabled == 1);
/* Disable channel onto application */
ret = disable_ust_app_channel(ua_sess, ua_chan, app);
struct ust_app *app;
struct ust_app_session *ua_sess;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
DBG2("UST app enabling channel %s to global domain for session id %" PRIu64,
uchan->name, usess->id);
struct ust_app_channel *ua_chan;
struct ust_app_event *ua_event;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
DBG("UST app disabling event %s for all apps in channel "
"%s for session id %" PRIu64,
uevent->attr.name, uchan->name, usess->id);
int ret = 0;
struct ust_app_channel *ua_chan = NULL;
- assert(ua_sess);
+ LTTNG_ASSERT(ua_sess);
ASSERT_LOCKED(ua_sess->lock);
if (!strncmp(uchan->name, DEFAULT_METADATA_NAME,
struct ust_app_channel *ua_chan;
struct ust_app_event *ua_event;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
DBG("UST app enabling event %s for all apps for session id %" PRIu64,
uevent->attr.name, usess->id);
struct ust_app_session *ua_sess;
struct ust_app_channel *ua_chan;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
DBG("UST app creating event %s for all apps for session id %" PRIu64,
uevent->attr.name, usess->id);
lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
/* If the channel is not found, there is a code flow error */
- assert(ua_chan_node);
+ LTTNG_ASSERT(ua_chan_node);
ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
registry = get_session_registry(ua_sess);
/* The UST app session is held registry shall not be null. */
- assert(registry);
+ LTTNG_ASSERT(registry);
/* Push metadata for application before freeing the application. */
(void) push_metadata(registry, ua_sess->consumer);
break;
case LTTNG_BUFFER_PER_UID:
default:
- assert(0);
+ abort();
break;
}
}
default:
ret = -1;
- assert(0);
+ abort();
break;
}
break;
case LTTNG_BUFFER_PER_UID:
default:
- assert(0);
+ abort();
ret = -1;
break;
}
}
default:
ret = -1;
- assert(0);
+ abort();
break;
}
goto end;
}
- assert(triggers);
+ LTTNG_ASSERT(triggers);
t_status = lttng_triggers_get_count(triggers, &count);
if (t_status != LTTNG_TRIGGER_STATUS_OK) {
uint64_t token;
trigger = lttng_triggers_borrow_mutable_at_index(triggers, i);
- assert(trigger);
+ LTTNG_ASSERT(trigger);
token = lttng_trigger_get_tracer_token(trigger);
condition = lttng_trigger_get_condition(trigger);
condition_status =
lttng_condition_event_rule_matches_borrow_rule_mutable(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
if (lttng_event_rule_get_domain_type(event_rule) == LTTNG_DOMAIN_KERNEL) {
/* Skip kernel related triggers. */
lttng_triggers_get_at_index(
triggers, i);
- assert(trigger);
+ LTTNG_ASSERT(trigger);
notification_thread_token =
lttng_trigger_get_tracer_token(trigger);
*/
ret = lttng_ht_del(app->token_to_event_notifier_rule_ht,
&app_trigger_iter);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
/* Callee logs errors. */
(void) disable_ust_object(app, event_notifier_rule->obj);
struct cds_lfht_iter uchan_iter;
struct ltt_ust_channel *uchan;
- assert(usess);
- assert(ua_sess);
- assert(app);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(app);
cds_lfht_for_each_entry(usess->domain_global.channels->ht, &uchan_iter,
uchan, node.node) {
* The application's configuration should only be synchronized for
* active sessions.
*/
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
ret = find_or_create_ust_app_session(usess, app, &ua_sess, NULL);
if (ret < 0) {
}
goto end;
}
- assert(ua_sess);
+ LTTNG_ASSERT(ua_sess);
pthread_mutex_lock(&ua_sess->lock);
if (ua_sess->deleted) {
*/
void ust_app_global_update(struct ltt_ust_session *usess, struct ust_app *app)
{
- assert(usess);
- assert(usess->active);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(usess->active);
DBG2("UST app global update for app sock %d for session id %" PRIu64,
app->sock, usess->id);
struct ust_app_session *ua_sess;
struct ust_app *app;
- assert(usess->active);
+ LTTNG_ASSERT(usess->active);
rcu_read_lock();
cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
int ret;
uint32_t pid, ppid, uid, gid;
- assert(msg);
+ LTTNG_ASSERT(msg);
ret = lttng_ust_ctl_recv_reg_msg(sock, &msg->type, &msg->major, &msg->minor,
&pid, &ppid, &uid, &gid,
struct lttng_ht_iter iter;
struct ust_app_session *ua_sess = NULL;
- assert(app);
+ LTTNG_ASSERT(app);
lttng_ht_lookup(app->ust_sessions_objd, (void *)((unsigned long) objd), &iter);
node = lttng_ht_iter_get_node_ulong(&iter);
struct lttng_ht_iter iter;
struct ust_app_channel *ua_chan = NULL;
- assert(app);
+ LTTNG_ASSERT(app);
lttng_ht_lookup(app->ust_objd, (void *)((unsigned long) objd), &iter);
node = lttng_ht_iter_get_node_ulong(&iter);
goto error_rcu_unlock;
}
- assert(ua_chan->session);
+ LTTNG_ASSERT(ua_chan->session);
ua_sess = ua_chan->session;
/* Get right session registry depending on the session buffer type. */
pthread_mutex_lock(®istry->lock);
ust_reg_chan = ust_registry_channel_find(registry, chan_reg_key);
- assert(ust_reg_chan);
+ LTTNG_ASSERT(ust_reg_chan);
if (!ust_reg_chan->register_done) {
/*
goto error_rcu_unlock;
}
- assert(ua_chan->session);
+ LTTNG_ASSERT(ua_chan->session);
ua_sess = ua_chan->session;
registry = get_session_registry(ua_sess);
}
default:
/* Should NEVER happen. */
- assert(0);
+ abort();
}
error:
struct ust_app *app;
struct ust_app_notify_sock_obj *obj;
- assert(sock >= 0);
+ LTTNG_ASSERT(sock >= 0);
rcu_read_lock();
struct ust_app *app;
char *trace_path = NULL;
- assert(usess);
- assert(output);
+ LTTNG_ASSERT(usess);
+ LTTNG_ASSERT(output);
rcu_read_lock();
break;
}
default:
- assert(0);
+ abort();
break;
}
struct ust_app *app;
struct lttng_ht_iter iter;
- assert(usess);
+ LTTNG_ASSERT(usess);
switch (usess->buffer_type) {
case LTTNG_BUFFER_PER_UID:
break;
}
default:
- assert(0);
+ abort();
break;
}
lttng_ht_lookup(ua_sess->channels, (void *) uchan->name, &uiter);
ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
/* If the session is found for the app, the channel must be there */
- assert(ua_chan_node);
+ LTTNG_ASSERT(ua_chan_node);
ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
struct ust_app *app;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
rcu_read_lock();
break;
}
default:
- assert(0);
+ abort();
break;
}
char *pathname_index;
int fmt_ret;
- assert(usess->current_trace_chunk);
+ LTTNG_ASSERT(usess->current_trace_chunk);
rcu_read_lock();
switch (usess->buffer_type) {
struct ust_app *app;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
rcu_read_lock();
break;
}
default:
- assert(0);
+ abort();
break;
}
struct lttng_ht_iter iter;
struct ltt_ust_session *usess = session->ust_session;
- assert(usess);
+ LTTNG_ASSERT(usess);
rcu_read_lock();
bool is_local_trace;
size_t consumer_path_offset = 0;
- assert(ua_sess);
- assert(ua_chan);
- assert(socket);
- assert(consumer);
- assert(registry);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(registry);
DBG2("Asking UST consumer for channel");
*/
} else {
ust_reg_chan = ust_registry_channel_find(registry, chan_reg_key);
- assert(ust_reg_chan);
+ LTTNG_ASSERT(ust_reg_chan);
chan_id = ust_reg_chan->chan_id;
if (ua_sess->shm_path[0]) {
strncpy(shm_path, ua_sess->shm_path, sizeof(shm_path));
goto error;
}
/* Communication protocol error. */
- assert(key == ua_chan->key);
+ LTTNG_ASSERT(key == ua_chan->key);
/* We need at least one where 1 stream for 1 cpu. */
if (ua_sess->output_traces) {
- assert(ua_chan->expected_stream_count > 0);
+ LTTNG_ASSERT(ua_chan->expected_stream_count > 0);
}
DBG2("UST ask channel %" PRIu64 " successfully done with %u stream(s)", key,
{
int ret;
- assert(ua_sess);
- assert(ua_chan);
- assert(consumer);
- assert(socket);
- assert(registry);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(consumer);
+ LTTNG_ASSERT(socket);
+ LTTNG_ASSERT(registry);
if (!consumer->enabled) {
ret = -LTTNG_ERR_NO_CONSUMER;
int ret;
struct lttcomm_consumer_msg msg;
- assert(ua_chan);
- assert(socket);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(socket);
memset(&msg, 0, sizeof(msg));
msg.cmd_type = LTTNG_CONSUMER_GET_CHANNEL;
}
/* This MUST match or else we have a synchronization problem. */
- assert(ua_chan->expected_stream_count == ua_chan->streams.count);
+ LTTNG_ASSERT(ua_chan->expected_stream_count == ua_chan->streams.count);
/* Wait for confirmation that we can proceed with the streams. */
ret = consumer_recv_status_reply(socket);
int ret;
struct lttcomm_consumer_msg msg;
- assert(ua_chan);
- assert(socket);
+ LTTNG_ASSERT(ua_chan);
+ LTTNG_ASSERT(socket);
memset(&msg, 0, sizeof(msg));
msg.cmd_type = LTTNG_CONSUMER_DESTROY_CHANNEL;
{
int ret;
- assert(app);
- assert(stream);
- assert(channel);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(channel);
DBG2("UST consumer send stream to app %d", app->sock);
{
int ret;
- assert(app);
- assert(ua_sess);
- assert(channel);
- assert(channel->obj);
+ LTTNG_ASSERT(app);
+ LTTNG_ASSERT(ua_sess);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->obj);
DBG2("UST app send channel to sock %d pid %d (name: %s, key: %" PRIu64 ")",
app->sock, app->pid, channel->name, channel->tracing_channel_id);
struct ust_registry_session *ust_reg;
struct lttcomm_consumer_msg msg;
- assert(socket);
+ LTTNG_ASSERT(socket);
rcu_read_lock();
health_code_update();
}
ust_reg = reg_pid->registry->reg.ust;
}
- assert(ust_reg);
+ LTTNG_ASSERT(ust_reg);
pthread_mutex_lock(&ust_reg->lock);
ret_push = ust_app_push_metadata(ust_reg, socket, 1);
if (count & (count - 1)) {
order++;
}
- assert(order >= 0);
+ LTTNG_ASSERT(order >= 0);
return order;
}
clock_uuid_s[LTTNG_UUID_STR_LEN];
int ret = 0;
- assert(session);
+ LTTNG_ASSERT(session);
lttng_uuid_to_str(session->uuid, uuid_s);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <common/common.h>
struct ust_registry_event *event;
int i;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
event = caa_container_of(node, struct ust_registry_event, node.node);
- assert(event);
+ LTTNG_ASSERT(event);
key = _key;
/* It has to be a perfect match. First, compare the event names. */
uint64_t hashed_key;
const struct ust_registry_event *key = _key;
- assert(key);
+ LTTNG_ASSERT(key);
hashed_key = (uint64_t) hash_key_str(key->name, seed);
int ret = 0;
size_t i;
- assert(strcmp(reg_enum_a->name, reg_enum_b->name) == 0);
+ LTTNG_ASSERT(strcmp(reg_enum_a->name, reg_enum_b->name) == 0);
if (reg_enum_a->nr_entries != reg_enum_b->nr_entries) {
ret = -1;
goto end;
struct ust_registry_enum *_enum;
const struct ust_registry_enum *key;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
_enum = caa_container_of(node, struct ust_registry_enum,
node.node);
- assert(_enum);
+ LTTNG_ASSERT(_enum);
key = _key;
if (strncmp(_enum->name, key->name, LTTNG_UST_ABI_SYM_NAME_LEN)) {
struct ust_registry_enum *_enum;
const struct ust_registry_enum *key = _key;
- assert(node);
- assert(_key);
+ LTTNG_ASSERT(node);
+ LTTNG_ASSERT(_key);
_enum = caa_container_of(node, struct ust_registry_enum, node.node);
- assert(_enum);
+ LTTNG_ASSERT(_enum);
if (_enum->id != key->id) {
goto no_match;
{
struct ust_registry_enum *key = _key;
- assert(key);
+ LTTNG_ASSERT(key);
return hash_key_str(key->name, seed);
}
struct ust_registry_event *event = NULL;
struct ust_registry_event key;
- assert(chan);
- assert(name);
- assert(sig);
+ LTTNG_ASSERT(chan);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(sig);
/* Setup key for the match function. */
strncpy(key.name, name, sizeof(key.name));
struct ust_registry_event *event = NULL;
struct ust_registry_channel *chan;
- assert(session);
- assert(name);
- assert(sig);
- assert(event_id_p);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(sig);
+ LTTNG_ASSERT(event_id_p);
rcu_read_lock();
destroy_event(event);
event = caa_container_of(nptr, struct ust_registry_event,
node.node);
- assert(event);
+ LTTNG_ASSERT(event);
event_id = event->id;
} else {
ERR("UST registry create event add unique failed for event: %s, "
int ret;
struct lttng_ht_iter iter;
- assert(chan);
- assert(event);
+ LTTNG_ASSERT(chan);
+ LTTNG_ASSERT(event);
/* Delete the node first. */
iter.iter.node = &event->node.node;
ret = lttng_ht_del(chan->ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
call_rcu(&event->node.head, destroy_event_rcu);
struct cds_lfht_node *nodep;
struct ust_registry_enum *reg_enum = NULL, *old_reg_enum;
- assert(session);
- assert(enum_name);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(enum_name);
rcu_read_lock();
ht_hash_enum(reg_enum, lttng_ht_seed),
ht_match_enum_id, reg_enum,
®_enum->node.node);
- assert(nodep == ®_enum->node.node);
+ LTTNG_ASSERT(nodep == ®_enum->node.node);
}
DBG("UST registry reply with enum %s with id %" PRIu64 " in sess_objd: %u",
enum_name, reg_enum->id, session_objd);
int ret;
struct lttng_ht_iter iter;
- assert(reg_session);
- assert(reg_enum);
+ LTTNG_ASSERT(reg_session);
+ LTTNG_ASSERT(reg_enum);
/* Delete the node first. */
iter.iter.node = ®_enum->node.node;
ret = lttng_ht_del(reg_session->enums, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
call_rcu(®_enum->rcu_head, destroy_enum_rcu);
}
struct ust_registry_event *event;
enum lttng_error_code cmd_ret;
- assert(chan);
+ LTTNG_ASSERT(chan);
if (notif) {
cmd_ret = notification_thread_command_remove_channel(
int ret = 0;
struct ust_registry_channel *chan;
- assert(session);
+ LTTNG_ASSERT(session);
chan = zmalloc(sizeof(*chan));
if (!chan) {
struct lttng_ht_iter iter;
struct ust_registry_channel *chan = NULL;
- assert(session);
- assert(session->channels);
+ LTTNG_ASSERT(session);
+ LTTNG_ASSERT(session->channels);
DBG3("UST registry channel finding key %" PRIu64, key);
struct ust_registry_channel *chan;
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
rcu_read_lock();
chan = ust_registry_channel_find(session, key);
iter.iter.node = &chan->node.node;
ret = lttng_ht_del(session->channels, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
rcu_read_unlock();
destroy_channel(chan, notif);
int ret;
struct ust_registry_session *session;
- assert(sessionp);
+ LTTNG_ASSERT(sessionp);
session = zmalloc(sizeof(*session));
if (!session) {
/* On error, EBUSY can be returned if lock. Code flow error. */
ret = pthread_mutex_destroy(®->lock);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
if (reg->channels) {
rcu_read_lock();
node.node) {
/* Delete the node from the ht and free it. */
ret = lttng_ht_del(reg->channels, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
destroy_channel(chan, true);
}
rcu_read_unlock();
/* All good. Don't send back the write positive ret value. */
ret = 0;
error:
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
int loglevels_match(int a_loglevel_type, int a_loglevel_value,
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <urcu/list.h>
} else if (opt_log4j) {
return LTTNG_DOMAIN_LOG4J;
} else {
- assert(0);
+ abort();
}
}
const char *field_name;
load_expr_op = load_expr_op->next;
- assert(load_expr_op);
- assert(load_expr_op->type == IR_LOAD_EXPRESSION_GET_SYMBOL);
+ LTTNG_ASSERT(load_expr_op);
+ LTTNG_ASSERT(load_expr_op->type == IR_LOAD_EXPRESSION_GET_SYMBOL);
field_name = load_expr_op->u.symbol;
- assert(field_name);
+ LTTNG_ASSERT(field_name);
event_expr = load_expr_child_type == IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT ?
lttng_event_expr_event_payload_field_create(field_name) :
const char *field_name;
load_expr_op = load_expr_op->next;
- assert(load_expr_op);
- assert(load_expr_op->type == IR_LOAD_EXPRESSION_GET_SYMBOL);
+ LTTNG_ASSERT(load_expr_op);
+ LTTNG_ASSERT(load_expr_op->type == IR_LOAD_EXPRESSION_GET_SYMBOL);
field_name = load_expr_op->u.symbol;
- assert(field_name);
+ LTTNG_ASSERT(field_name);
/*
* The field name needs to be of the form PROVIDER:TYPE. We
{
struct lttng_event_expr *event_expr = NULL;
- assert(ir->op == IR_OP_LOAD);
+ LTTNG_ASSERT(ir->op == IR_OP_LOAD);
switch (ir->data_type) {
case IR_DATA_EXPRESSION:
{
struct lttng_event_expr *event_expr = NULL;
- assert(ir->op == IR_OP_ROOT);
+ LTTNG_ASSERT(ir->op == IR_OP_ROOT);
ir = ir->u.root.child;
switch (ir->op) {
break;
}
- assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+ LTTNG_ASSERT(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
if (item->type == ARGPAR_ITEM_TYPE_OPT) {
const struct argpar_item_opt *item_opt =
* Update *argc and *argv so our caller can keep parsing what follows.
*/
consumed_args = argpar_state_get_ingested_orig_args(state);
- assert(consumed_args >= 0);
+ LTTNG_ASSERT(consumed_args >= 0);
*argc -= consumed_args;
*argv += consumed_args;
goto error;
}
- assert(kernel_probe_location);
+ LTTNG_ASSERT(kernel_probe_location);
res.er = lttng_event_rule_kernel_kprobe_create(kernel_probe_location);
if (!res.er) {
ERR("Failed to create kprobe event rule.");
lttng_dynamic_array_get_element(
&res.capture_descriptors.array, i);
- assert(expr);
- assert(*expr);
+ LTTNG_ASSERT(expr);
+ LTTNG_ASSERT(*expr);
status = lttng_condition_event_rule_matches_append_capture_descriptor(
c, *expr);
if (status != LTTNG_CONDITION_STATUS_OK) {
char *policy_type_str;
char *policy_value_str;
- assert(policy_str);
+ LTTNG_ASSERT(policy_str);
lttng_dynamic_pointer_array_init(&tokens, NULL);
/* Rate policy fields are separated by ':'. */
break;
}
- assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+ LTTNG_ASSERT(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
if (item->type == ARGPAR_ITEM_TYPE_OPT) {
const struct argpar_item_opt *item_opt =
} else {
const struct argpar_item_non_opt *item_non_opt;
- assert(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
+ LTTNG_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
item_non_opt = (const struct argpar_item_non_opt *) item;
enum lttng_action_status action_status;
struct lttng_rate_policy *policy = NULL;
- assert(set_session_name_cb);
- assert(set_rate_policy_cb);
+ LTTNG_ASSERT(set_session_name_cb);
+ LTTNG_ASSERT(set_rate_policy_cb);
const struct argpar_opt_descr rate_policy_opt_descrs[] = {
{ OPT_RATE_POLICY, '\0', "rate-policy", true },
break;
}
- assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+ LTTNG_ASSERT(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
if (item->type == ARGPAR_ITEM_TYPE_OPT) {
const struct argpar_item_opt *item_opt =
(const struct argpar_item_opt *) item;
break;
}
- assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+ LTTNG_ASSERT(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
if (item->type == ARGPAR_ITEM_TYPE_OPT) {
const struct argpar_item_opt *item_opt =
} else {
const struct argpar_item_non_opt *item_non_opt;
- assert(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
+ LTTNG_ASSERT(item->type == ARGPAR_ITEM_TYPE_NON_OPT);
item_non_opt = (const struct argpar_item_non_opt *) item;
break;
}
- assert(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
+ LTTNG_ASSERT(status == ARGPAR_STATE_PARSE_NEXT_STATUS_OK);
if (argpar_item->type == ARGPAR_ITEM_TYPE_NON_OPT) {
const struct argpar_item_non_opt *item_non_opt =
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <ctype.h>
#include <popt.h>
#include <stdio.h>
struct lttng_session *sessions;
/* session_name should not be null */
- assert(session_name);
- assert(writer);
+ LTTNG_ASSERT(session_name);
+ LTTNG_ASSERT(writer);
count = lttng_list_sessions(&sessions);
if (count < 0) {
int i;
bool error_occurred = false;
- assert(count >= 0);
+ LTTNG_ASSERT(count >= 0);
if (count == 0) {
MSG("No session found, nothing to do.");
}
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <common/mi-lttng.h>
#include <lttng/domain-internal.h>
{
int ret;
- assert(writer);
- assert(channel_name);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(channel_name);
/* Open channel element */
ret = mi_lttng_writer_open_element(writer, config_element_channel);
dom.type = LTTNG_DOMAIN_UST;
} else {
/* Checked by the caller. */
- assert(0);
+ abort();
}
handle = lttng_create_handle(session_name, &dom);
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <common/mi-lttng.h>
#include <lttng/domain-internal.h>
{
int ret;
- assert(writer);
- assert(event_name);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(event_name);
/* Open event element */
ret = mi_lttng_writer_open_element(writer, config_element_event);
dom.type = LTTNG_DOMAIN_PYTHON;
} else {
/* Checked by the caller. */
- assert(0);
+ abort();
}
channel_name = opt_channel_name;
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
-#include <assert.h>
#include <ctype.h>
#include <common/sessiond-comm/sessiond-comm.h>
}
} else {
/* Checked by the caller. */
- assert(0);
+ abort();
}
set_default_attr(&dom);
/* Mi open channels element */
if (lttng_opt_mi) {
- assert(writer);
+ LTTNG_ASSERT(writer);
ret = mi_lttng_channels_open(writer);
if (ret) {
ret = CMD_ERROR;
}
order = get_count_order_u64(chan_opts.attr.subbuf_size);
- assert(order >= 0);
+ LTTNG_ASSERT(order >= 0);
rounded_size = 1ULL << order;
if (rounded_size < chan_opts.attr.subbuf_size) {
ERR("The subbuf size (%" PRIu64 ") is rounded and overflows!",
}
/* Should now be power of 2 */
- assert(!((chan_opts.attr.subbuf_size - 1) & chan_opts.attr.subbuf_size));
+ LTTNG_ASSERT(!((chan_opts.attr.subbuf_size - 1) & chan_opts.attr.subbuf_size));
DBG("Channel subbuf size set to %" PRIu64, chan_opts.attr.subbuf_size);
break;
}
order = get_count_order_u64(chan_opts.attr.num_subbuf);
- assert(order >= 0);
+ LTTNG_ASSERT(order >= 0);
rounded_size = 1ULL << order;
if (rounded_size < chan_opts.attr.num_subbuf) {
ERR("The number of subbuffers (%" PRIu64 ") is rounded and overflows!",
}
/* Should now be power of 2 */
- assert(!((chan_opts.attr.num_subbuf - 1) & chan_opts.attr.num_subbuf));
+ LTTNG_ASSERT(!((chan_opts.attr.num_subbuf - 1) & chan_opts.attr.num_subbuf));
DBG("Channel subbuf num set to %" PRIu64, chan_opts.attr.num_subbuf);
break;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <popt.h>
#include <stdio.h>
#include <stdlib.h>
size_t i;
const size_t count = lttng_dynamic_pointer_array_get_count(exclusions);
- assert(writer);
+ LTTNG_ASSERT(writer);
if (count == 0) {
ret = 0;
dom.buf_type = LTTNG_BUFFER_PER_UID;
} else {
/* Checked by the caller. */
- assert(0);
+ abort();
}
if (opt_exclude) {
/* Exclusions supported */
break;
default:
- assert(0);
+ abort();
}
}
if (opt_loglevel) {
int name_search_ret;
- assert(opt_userspace || opt_jul || opt_log4j || opt_python);
+ LTTNG_ASSERT(opt_userspace || opt_jul || opt_log4j || opt_python);
if (opt_userspace) {
enum lttng_loglevel loglevel;
goto error;
}
} else {
- assert(opt_userspace || opt_jul || opt_log4j || opt_python);
+ LTTNG_ASSERT(opt_userspace || opt_jul || opt_log4j || opt_python);
if (opt_userspace) {
ev->loglevel = -1;
} else if (opt_jul) {
}
break;
case LTTNG_EVENT_USERSPACE_PROBE:
- assert(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
+ LTTNG_ASSERT(ev->type == LTTNG_EVENT_USERSPACE_PROBE);
ret = parse_userspace_probe_opts(opt_userspace_probe, &uprobe_loc);
if (ret) {
strncpy(ev->name, event_name, LTTNG_SYMBOL_NAME_LEN);
ev->name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
} else {
- assert(0);
+ abort();
}
if (!opt_filter) {
exclusion_string);
break;
default:
- assert(0);
+ abort();
}
}
free(exclusion_string);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include "../command.h"
#include <common/utils.h>
/* Show command's help */
cmd_argv[0] = cmd->name;
cmd_argv[1] = "--help";
- assert(cmd->func);
+ LTTNG_ASSERT(cmd->func);
ret = cmd->func(2, cmd_argv);
end:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <common/mi-lttng.h>
#include <common/time.h>
/* Fall-through. */
default:
/* We should never have "all" events in list. */
- assert(0);
+ abort();
break;
}
condition_status =
lttng_condition_session_consumed_size_get_session_name(
condition, &session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
lttng_condition_session_consumed_size_get_threshold(
condition, &threshold);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
MSG(" session name: %s", session_name);
MSG(" threshold: %" PRIu64 " bytes", threshold);
condition_status = lttng_condition_buffer_usage_get_session_name(
condition, &session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
condition_status = lttng_condition_buffer_usage_get_channel_name(
condition, &channel_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
condition_status = lttng_condition_buffer_usage_get_domain_type(
condition, &domain_type);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
MSG(" session name: %s", session_name);
MSG(" channel name: %s", channel_name);
} else {
double threshold_ratio;
- assert(condition_status == LTTNG_CONDITION_STATUS_UNSET);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_UNSET);
condition_status =
lttng_condition_buffer_usage_get_threshold_ratio(
condition, &threshold_ratio);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
MSG(" threshold (ratio): %.2f", threshold_ratio);
}
condition_status = lttng_condition_session_rotation_get_session_name(
condition, &session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
MSG(" session name: %s", session_name);
}
event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern(
event_rule, &pattern);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
_MSG(" rule: %s (type: user tracepoint", pattern);
if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
_MSG(", filter: %s", filter);
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
event_rule_status = lttng_event_rule_user_tracepoint_get_log_level_rule(
abort();
}
- assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
pretty_loglevel_name = get_pretty_loglevel_name(
LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT, log_level);
_MSG(", log level %s %d", log_level_op, log_level);
}
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
event_rule, &exclusions_count);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
if (exclusions_count > 0) {
_MSG(", exclusions: ");
for (i = 0; i < exclusions_count; i++) {
event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
event_rule, i, &exclusion);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
_MSG("%s%s", i > 0 ? "," : "", exclusion);
}
event_rule_status = lttng_event_rule_kernel_tracepoint_get_name_pattern(
event_rule, &pattern);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
_MSG(" rule: %s (type: kernel tracepoint", pattern);
if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
_MSG(", filter: %s", filter);
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
MSG(")");
event_rule_status = logging_get_name_pattern(
event_rule, &pattern);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
_MSG(" rule: %s (type: %s:logging", pattern, type_str);
if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
_MSG(", filter: %s", filter);
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
event_rule_status = logging_get_log_level_rule(
abort();
}
- assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
pretty_loglevel_name = get_pretty_loglevel_name(
event_rule_type, log_level);
_MSG(", log level %s %d", log_level_op, log_level);
}
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
MSG(")");
const char *name;
const struct lttng_kernel_probe_location *location;
- assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE);
+ LTTNG_ASSERT(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE);
event_rule_status = lttng_event_rule_kernel_kprobe_get_event_name(event_rule, &name);
if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) {
const struct lttng_userspace_probe_location *location;
enum lttng_userspace_probe_location_type userspace_probe_location_type;
- assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE);
+ LTTNG_ASSERT(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE);
event_rule_status = lttng_event_rule_kernel_uprobe_get_event_name(
event_rule, &name);
enum lttng_event_rule_status event_rule_status;
enum lttng_event_rule_kernel_syscall_emission_site emission_site;
- assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL);
+ LTTNG_ASSERT(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL);
emission_site =
lttng_event_rule_kernel_syscall_get_emission_site(event_rule);
event_rule_status = lttng_event_rule_kernel_syscall_get_name_pattern(
event_rule, &pattern);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
_MSG(" rule: %s (type: kernel:syscall:%s", pattern,
lttng_event_rule_kernel_syscall_emission_site_str(
if (event_rule_status == LTTNG_EVENT_RULE_STATUS_OK) {
_MSG(", filter: %s", filter);
} else {
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_UNSET);
}
MSG(")");
parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
event_expr);
- assert(parent_expr != NULL);
+ LTTNG_ASSERT(parent_expr != NULL);
print_one_event_expr(parent_expr);
status = lttng_event_expr_array_field_element_get_index(
event_expr, &index);
- assert(status == LTTNG_EVENT_EXPR_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
_MSG("[%u]", index);
enum lttng_error_query_results_status results_status;
results_status = lttng_error_query_results_get_count(results, &count);
- assert(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
+ LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
- assert(results);
+ LTTNG_ASSERT(results);
print_indentation(base_indentation_level);
_MSG("errors:");
results_status = lttng_error_query_results_get_result(
results, &result, i);
- assert(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
+ LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
result_status = lttng_error_query_result_get_name(
result, &result_name);
- assert(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+ LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
result_status = lttng_error_query_result_get_description(
result, &result_description);
- assert(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+ LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
if (lttng_error_query_result_get_type(result) ==
LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER) {
result_status = lttng_error_query_result_counter_get_value(
result, &result_value);
- assert(result_status ==
+ LTTNG_ASSERT(result_status ==
LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
if (result_value == 0) {
continue;
condition_status = lttng_condition_event_rule_matches_get_rule(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
print_event_rule(event_rule);
condition_status =
lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &cap_desc_count);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
if (cap_desc_count > 0) {
MSG(" captures:");
struct lttng_action_path *action_path = lttng_action_path_create(
action_path_indexes, action_path_length);
- assert(action_path);
+ LTTNG_ASSERT(action_path);
query = lttng_error_query_action_create(trigger, action_path);
- assert(query);
+ LTTNG_ASSERT(query);
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
/*
* Anonymous triggers are not listed; this would be an internal error.
*/
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
error_query_ret = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, &results);
const char *value;
action_type = lttng_action_get_type(action);
- assert(action_type != LTTNG_ACTION_TYPE_LIST);
+ LTTNG_ASSERT(action_type != LTTNG_ACTION_TYPE_LIST);
switch (action_type) {
case LTTNG_ACTION_TYPE_NOTIFY:
case LTTNG_ACTION_TYPE_START_SESSION:
action_status = lttng_action_start_session_get_session_name(
action, &value);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
_MSG("start session `%s`", value);
action_status = lttng_action_start_session_get_rate_policy(
case LTTNG_ACTION_TYPE_STOP_SESSION:
action_status = lttng_action_stop_session_get_session_name(
action, &value);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
_MSG("stop session `%s`", value);
action_status = lttng_action_stop_session_get_rate_policy(
case LTTNG_ACTION_TYPE_ROTATE_SESSION:
action_status = lttng_action_rotate_session_get_session_name(
action, &value);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
_MSG("rotate session `%s`", value);
action_status = lttng_action_rotate_session_get_rate_policy(
action_status = lttng_action_snapshot_session_get_session_name(
action, &value);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
_MSG("snapshot session `%s`", value);
action_status = lttng_action_snapshot_session_get_output(
bool starts_with_file, starts_with_net, starts_with_net6;
ctrl_url = lttng_snapshot_output_get_ctrl_url(output);
- assert(ctrl_url && strlen(ctrl_url) > 0);
+ LTTNG_ASSERT(ctrl_url && strlen(ctrl_url) > 0);
data_url = lttng_snapshot_output_get_data_url(output);
- assert(data_url);
+ LTTNG_ASSERT(data_url);
starts_with_file = strncmp(ctrl_url, "file://", strlen("file://")) == 0;
starts_with_net = strncmp(ctrl_url, "net://", strlen("net://")) == 0;
} else if (starts_with_net || starts_with_net6) {
_MSG(", url: %s", ctrl_url);
} else {
- assert(strlen(data_url) > 0);
+ LTTNG_ASSERT(strlen(data_url) > 0);
_MSG(", control url: %s, data url: %s", ctrl_url, data_url);
}
name = lttng_snapshot_output_get_name(output);
- assert(name);
+ LTTNG_ASSERT(name);
if (strlen(name) > 0) {
_MSG(", name: %s", name);
}
struct lttng_error_query *query =
lttng_error_query_trigger_create(trigger);
- assert(query);
+ LTTNG_ASSERT(query);
/*
* Anonymous triggers are not listed; this would be an internal error.
*/
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
error_query_ret = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, &results);
struct lttng_error_query *query =
lttng_error_query_condition_create(trigger);
- assert(query);
+ LTTNG_ASSERT(query);
/*
* Anonymous triggers are not listed; this would be an internal error.
*/
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
error_query_ret = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, &results);
goto end;
}
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
MSG("- name: %s", name);
MSG(" owner uid: %d", trigger_uid);
MSG(" actions:");
action_status = lttng_action_list_get_count(action, &count);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
for (i = 0; i < count; i++) {
const uint64_t action_path_index = i;
/* Anonymous triggers are not reachable here. */
trigger_status = lttng_trigger_get_name(trigger_a, &name_a);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_name(trigger_b, &name_b);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
return strcmp(name_a, name_b);
}
struct lttng_error_query *query =
lttng_error_query_trigger_create(trigger);
- assert(results);
- assert(query);
+ LTTNG_ASSERT(results);
+ LTTNG_ASSERT(query);
ret_code = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, results);
uid_t trigger_uid;
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
ERR("Failed to query errors of trigger '%s' (owner uid: %d): %s",
trigger_name, (int) trigger_uid,
struct lttng_error_query *query =
lttng_error_query_action_create(trigger, action_path);
- assert(results);
- assert(query);
+ LTTNG_ASSERT(results);
+ LTTNG_ASSERT(query);
ret_code = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, results);
uid_t trigger_uid;
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
ERR("Failed to query errors of an action for trigger '%s' (owner uid: %d): %s",
trigger_name, (int) trigger_uid,
struct lttng_error_query *query =
lttng_error_query_condition_create(trigger);
- assert(results);
- assert(query);
+ LTTNG_ASSERT(results);
+ LTTNG_ASSERT(query);
ret_code = lttng_error_query_execute(
query, lttng_session_daemon_command_endpoint, results);
uid_t trigger_uid;
trigger_status = lttng_trigger_get_name(trigger, &trigger_name);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
ERR("Failed to query errors of of condition for condition of trigger '%s' (owner uid: %d): %s",
trigger_name, (int) trigger_uid,
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <common/mi-lttng.h>
#include <common/config/session-config.h>
static int mi_partial_session(const char *session_name)
{
int ret;
- assert(the_writer);
- assert(session_name);
+ LTTNG_ASSERT(the_writer);
+ LTTNG_ASSERT(session_name);
/* Open session element */
ret = mi_lttng_writer_open_element(the_writer, config_element_session);
static int mi_load_print(const char *session_name)
{
int ret;
- assert(the_writer);
+ LTTNG_ASSERT(the_writer);
if (the_opt_load_all) {
/* We use a wildcard to represent all sessions */
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <ctype.h>
#include <popt.h>
#include <stdio.h>
{
int i = 0;
- assert(argv);
+ LTTNG_ASSERT(argv);
while (argv[i] != NULL) {
i++;
}
argc = count_arguments(argv);
- assert(argc >= 1);
+ LTTNG_ASSERT(argc >= 1);
cmd = &actions[i];
while (cmd->func != NULL) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <ctype.h>
#include <popt.h>
#include <stdio.h>
{
int i = 0;
- assert(argv);
+ LTTNG_ASSERT(argv);
while (argv[i] != NULL) {
i++;
}
argc = count_arguments(argv);
- assert(argc >= 1);
+ LTTNG_ASSERT(argc >= 1);
cmd = &actions[i];
while (cmd->func != NULL) {
}
trigger_status = lttng_triggers_get_count(triggers, &triggers_count);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
for (i = 0; i < triggers_count; i++) {
const struct lttng_trigger *trigger;
trigger_status = lttng_trigger_get_owner_uid(
trigger, &trigger_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
if (trigger_uid == uid && strcmp(trigger_name, name) == 0) {
trigger_to_remove = trigger;
#include <unistd.h>
#include <inttypes.h>
#include <ctype.h>
-#include <assert.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/mi-lttng.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <assert.h>
#include <common/mi-lttng.h>
static int mi_partial_session(const char *session_name)
{
int ret;
- assert(writer);
- assert(session_name);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session_name);
/* Open session element */
ret = mi_lttng_writer_open_element(writer, config_element_session);
static int mi_save_print(const char *session_name)
{
int ret;
- assert(writer);
+ LTTNG_ASSERT(writer);
if (opt_save_all) {
/* We use a wildcard to represent all sessions */
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <common/mi-lttng.h>
{
int ret;
- assert(writer);
- assert(session_name);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session_name);
/*
* Open a sessions element
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <popt.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <common/utils.h>
#include <common/mi-lttng.h>
{
int i = 0;
- assert(argv);
+ LTTNG_ASSERT(argv);
while (argv[i] != NULL) {
i++;
argc = count_arguments(argv);
/* popt should have passed NULL if no arguments are present. */
- assert(argc > 0);
+ LTTNG_ASSERT(argc > 0);
cmd = &actions[i];
while (cmd->func != NULL) {
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/mi-lttng.h>
static int mi_print_session(char *session_name, int enabled)
{
int ret;
- assert(writer);
- assert(session_name);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(session_name);
/* Open session element */
ret = mi_lttng_writer_open_element(writer, config_element_session);
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-#include <assert.h>
#include <urcu/list.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
-#include <assert.h>
struct loglevel_name_value {
const char *name;
struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
struct lttng_dynamic_pointer_array tokens;
- assert(opt);
+ LTTNG_ASSERT(opt);
/*
* userspace probe fields are separated by ':'.
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
break;
default:
/* Should not have an unknown event type or else define it. */
- assert(0);
+ abort();
}
return str_event_type;
char page_name[32];
ret = sprintf(page_name, "lttng-%s", cmd_name);
- assert(ret > 0 && ret < 32);
+ LTTNG_ASSERT(ret > 0 && ret < 32);
ret = utils_show_help(1, page_name, help_msg);
if (ret && !help_msg) {
ERR("Cannot view man page `lttng-%s(1)`", cmd_name);
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/mi-lttng.h>
#include <lttng/action/action-internal.h>
return;
}
- assert(action->destroy);
+ LTTNG_ASSERT(action->destroy);
urcu_ref_put(&action->ref, action_destroy_ref);
}
goto end;
}
- assert(*action);
+ LTTNG_ASSERT(*action);
consumed_len = sizeof(struct lttng_action_comm) +
specific_action_consumed_len;
goto end;
}
- assert(a->equal);
+ LTTNG_ASSERT(a->equal);
is_equal = a->equal(a, b);
end:
return is_equal;
struct lttng_action_path *action_path = NULL;
struct lttng_error_query_results *error_query_results = NULL;
- assert(action);
- assert(writer);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(writer);
/* Open action. */
ret = mi_lttng_writer_open_element(writer, mi_lttng_element_action);
goto close_action_element;
}
- assert(action->mi_serialize);
+ LTTNG_ASSERT(action->mi_serialize);
ret_code = action->mi_serialize(action, writer);
if (ret_code != LTTNG_OK) {
goto end;
action_path = lttng_action_path_create(
action_path_indexes_raw_pointer,
action_path_indexes_size);
- assert(action_path);
+ LTTNG_ASSERT(action_path);
ret_code = error_query_callbacks->action_cb(
trigger, action_path, &error_query_results);
*
*/
-#include <assert.h>
#include <common/buffer-view.h>
#include <common/dynamic-buffer.h>
#include <common/error.h>
goto end;
}
- assert(*firing_policy);
+ LTTNG_ASSERT(*firing_policy);
consumed_len = sizeof(struct lttng_firing_policy_comm) +
specific_firing_policy_consumed_len;
goto end;
}
- assert(a->equal);
+ LTTNG_ASSERT(a->equal);
is_equal = a->equal(a, b);
end:
return is_equal;
firing_policy_every_n_from_firing_policy_const(
const struct lttng_firing_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(policy, const struct lttng_firing_policy_every_n,
parent);
const struct lttng_firing_policy_every_n *every_n_policy;
struct lttng_firing_policy_every_n_comm comm = {};
- assert(policy);
- assert(payload);
+ LTTNG_ASSERT(policy);
+ LTTNG_ASSERT(payload);
every_n_policy = firing_policy_every_n_from_firing_policy_const(policy);
comm.interval = every_n_policy->interval;
const struct lttng_firing_policy *policy, uint64_t counter)
{
const struct lttng_firing_policy_every_n *every_n_policy;
- assert(policy);
+ LTTNG_ASSERT(policy);
bool execute = false;
every_n_policy = firing_policy_every_n_from_firing_policy_const(policy);
firing_policy_once_after_n_from_firing_policy_const(
const struct lttng_firing_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(policy, struct lttng_firing_policy_once_after_n,
parent);
const struct lttng_firing_policy_once_after_n *once_after_n_policy;
struct lttng_firing_policy_once_after_n_comm comm = {};
- assert(policy);
- assert(payload);
+ LTTNG_ASSERT(policy);
+ LTTNG_ASSERT(payload);
once_after_n_policy =
firing_policy_once_after_n_from_firing_policy_const(
struct lttng_firing_policy *lttng_firing_policy_copy(
const struct lttng_firing_policy *source)
{
- assert(source->copy);
+ LTTNG_ASSERT(source->copy);
return source->copy(source);
}
{
const struct lttng_firing_policy_once_after_n *once_after_n_policy;
bool execute = false;
- assert(policy);
+ LTTNG_ASSERT(policy);
once_after_n_policy =
firing_policy_once_after_n_from_firing_policy_const(
*
*/
-#include <assert.h>
#include <common/dynamic-array.h>
#include <common/error.h>
#include <common/macros.h>
static struct lttng_action_list *action_list_from_action(
const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_list, parent);
}
static const struct lttng_action_list *action_list_from_action_const(
const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_list, parent);
}
struct lttng_action_list *action_list;
bool valid;
- assert(IS_LIST_ACTION(action));
+ LTTNG_ASSERT(IS_LIST_ACTION(action));
action_list = action_list_from_action(action);
lttng_dynamic_pointer_array_get_pointer(
&action_list->actions, i);
- assert(child);
+ LTTNG_ASSERT(child);
if (!lttng_action_validate(child)) {
valid = false;
const struct lttng_action *child_b =
lttng_action_list_get_at_index(_b, i);
- assert(child_a);
- assert(child_b);
+ LTTNG_ASSERT(child_a);
+ LTTNG_ASSERT(child_b);
if (!lttng_action_is_equal(child_a, child_b)) {
goto end;
int ret;
unsigned int i, count;
- assert(action);
- assert(payload);
- assert(IS_LIST_ACTION(action));
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(payload);
+ LTTNG_ASSERT(IS_LIST_ACTION(action));
action_list = action_list_from_action(action);
lttng_dynamic_pointer_array_get_pointer(
&action_list->actions, i);
- assert(child);
+ LTTNG_ASSERT(child);
ret = lttng_action_serialize(child, payload);
if (ret) {
unsigned int i, count;
enum lttng_error_code ret_code;
- assert(action);
- assert(IS_LIST_ACTION(action));
- assert(writer);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_LIST_ACTION(action));
+ LTTNG_ASSERT(writer);
/* Open action list. */
ret = mi_lttng_writer_open_element(
lttng_action_list_get_at_index(action, i);
const uint64_t index = (uint64_t) i;
- assert(child);
+ LTTNG_ASSERT(child);
/*
* Add the index to the action path.
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
static struct lttng_action_notify *action_notify_from_action(
struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_notify, parent);
}
static const struct lttng_action_notify *action_notify_from_action_const(
const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_notify, parent);
}
enum lttng_error_code ret_code;
const struct lttng_rate_policy *policy = NULL;
- assert(action);
- assert(IS_NOTIFY_ACTION(action));
- assert(writer);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_NOTIFY_ACTION(action));
+ LTTNG_ASSERT(writer);
status = lttng_action_notify_get_rate_policy(action, &policy);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(policy != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(policy != NULL);
/* Open action notify. */
ret = mi_lttng_writer_open_element(
int ret;
size_t i, src_count;
- assert(src);
- assert(dst);
+ LTTNG_ASSERT(src);
+ LTTNG_ASSERT(dst);
lttng_dynamic_array_init(&dst->indexes, sizeof(uint64_t), NULL);
src_count = lttng_dynamic_array_get_count(&src->indexes);
*
*/
-#include <assert.h>
#include <common/buffer-view.h>
#include <common/dynamic-buffer.h>
#include <common/error.h>
goto end;
}
- assert(*rate_policy);
+ LTTNG_ASSERT(*rate_policy);
consumed_len = sizeof(struct lttng_rate_policy_comm) +
specific_rate_policy_consumed_len;
goto end;
}
- assert(a->equal);
+ LTTNG_ASSERT(a->equal);
is_equal = a->equal(a, b);
end:
return is_equal;
static struct lttng_rate_policy_every_n *rate_policy_every_n_from_rate_policy(
struct lttng_rate_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(policy, struct lttng_rate_policy_every_n, parent);
}
rate_policy_every_n_from_rate_policy_const(
const struct lttng_rate_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(policy, struct lttng_rate_policy_every_n, parent);
}
struct lttng_rate_policy_every_n *every_n_policy;
struct lttng_rate_policy_every_n_comm comm = {};
- assert(policy);
- assert(payload);
+ LTTNG_ASSERT(policy);
+ LTTNG_ASSERT(payload);
every_n_policy = rate_policy_every_n_from_rate_policy(policy);
comm.interval = every_n_policy->interval;
enum lttng_error_code ret_code;
const struct lttng_rate_policy_every_n *every_n_policy = NULL;
- assert(rate_policy);
- assert(IS_EVERY_N_RATE_POLICY(rate_policy));
- assert(writer);
+ LTTNG_ASSERT(rate_policy);
+ LTTNG_ASSERT(IS_EVERY_N_RATE_POLICY(rate_policy));
+ LTTNG_ASSERT(writer);
every_n_policy = rate_policy_every_n_from_rate_policy_const(
rate_policy);
const struct lttng_rate_policy *policy, uint64_t counter)
{
const struct lttng_rate_policy_every_n *every_n_policy;
- assert(policy);
+ LTTNG_ASSERT(policy);
bool execute = false;
every_n_policy = rate_policy_every_n_from_rate_policy_const(policy);
static struct lttng_rate_policy_once_after_n *
rate_policy_once_after_n_from_rate_policy(struct lttng_rate_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(
policy, struct lttng_rate_policy_once_after_n, parent);
rate_policy_once_after_n_from_rate_policy_const(
const struct lttng_rate_policy *policy)
{
- assert(policy);
+ LTTNG_ASSERT(policy);
return container_of(
policy, struct lttng_rate_policy_once_after_n, parent);
struct lttng_rate_policy_once_after_n *once_after_n_policy;
struct lttng_rate_policy_once_after_n_comm comm = {};
- assert(policy);
- assert(payload);
+ LTTNG_ASSERT(policy);
+ LTTNG_ASSERT(payload);
once_after_n_policy = rate_policy_once_after_n_from_rate_policy(policy);
comm.threshold = once_after_n_policy->threshold;
enum lttng_error_code ret_code;
const struct lttng_rate_policy_once_after_n *once_after_n_policy = NULL;
- assert(rate_policy);
- assert(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy));
- assert(writer);
+ LTTNG_ASSERT(rate_policy);
+ LTTNG_ASSERT(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy));
+ LTTNG_ASSERT(writer);
once_after_n_policy = rate_policy_once_after_n_from_rate_policy_const(
rate_policy);
struct lttng_rate_policy *lttng_rate_policy_copy(
const struct lttng_rate_policy *source)
{
- assert(source->copy);
+ LTTNG_ASSERT(source->copy);
return source->copy(source);
}
{
const struct lttng_rate_policy_once_after_n *once_after_n_policy;
bool execute = false;
- assert(policy);
+ LTTNG_ASSERT(policy);
once_after_n_policy =
rate_policy_once_after_n_from_rate_policy_const(policy);
int ret;
enum lttng_error_code ret_code;
- assert(rate_policy);
- assert(writer);
- assert(rate_policy->mi_serialize);
+ LTTNG_ASSERT(rate_policy);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(rate_policy->mi_serialize);
/* Open rate policy element. */
ret = mi_lttng_writer_open_element(
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
static struct lttng_action_rotate_session *action_rotate_session_from_action(
struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_rotate_session, parent);
}
static const struct lttng_action_rotate_session *
action_rotate_session_from_action_const(const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_rotate_session, parent);
}
b = action_rotate_session_from_action_const(_b);
/* Action is not valid if this is not true. */
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
size_t session_name_len;
int ret;
- assert(action);
- assert(payload);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(payload);
action_rotate_session = action_rotate_session_from_action(action);
- assert(action_rotate_session->session_name);
+ LTTNG_ASSERT(action_rotate_session->session_name);
DBG("Serializing rotate session action: session-name: %s",
action_rotate_session->session_name);
goto end;
}
- assert(policy);
+ LTTNG_ASSERT(policy);
status = lttng_action_rotate_session_set_rate_policy(action, policy);
if (status != LTTNG_ACTION_STATUS_OK) {
consumed_len = -1;
const char *session_name = NULL;
const struct lttng_rate_policy *policy = NULL;
- assert(action);
- assert(IS_ROTATE_SESSION_ACTION(action));
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_ROTATE_SESSION_ACTION(action));
status = lttng_action_rotate_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(session_name != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(session_name != NULL);
status = lttng_action_notify_get_rate_policy(action, &policy);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(policy != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(policy != NULL);
/* Open action rotate session element. */
ret = mi_lttng_writer_open_element(
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
static struct lttng_action_snapshot_session *
action_snapshot_session_from_action(struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(
action, struct lttng_action_snapshot_session, parent);
static const struct lttng_action_snapshot_session *
action_snapshot_session_from_action_const(const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(
action, struct lttng_action_snapshot_session, parent);
b = action_snapshot_session_from_action_const(_b);
/* Action is not valid if this is not true. */
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
int ret;
size_t size_before_comm;
- assert(action);
- assert(payload);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(payload);
size_before_comm = payload->buffer.size;
goto end;
}
- assert(action_snapshot_session->session_name);
+ LTTNG_ASSERT(action_snapshot_session->session_name);
DBG("Serializing snapshot session action: session-name: %s",
action_snapshot_session->session_name);
const struct lttng_snapshot_output *output = NULL;
const struct lttng_rate_policy *policy = NULL;
- assert(action);
- assert(IS_SNAPSHOT_SESSION_ACTION(action));
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_SNAPSHOT_SESSION_ACTION(action));
status = lttng_action_snapshot_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(session_name != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(session_name != NULL);
status = lttng_action_snapshot_session_get_rate_policy(action, &policy);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(policy != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(policy != NULL);
/* Open action snapshot session element. */
ret = mi_lttng_writer_open_element(
/* Output if any. */
status = lttng_action_snapshot_session_get_output(action, &output);
if (status == LTTNG_ACTION_STATUS_OK) {
- assert(output != NULL);
+ LTTNG_ASSERT(output != NULL);
ret_code = lttng_snapshot_output_mi_serialize(output, writer);
if (ret_code != LTTNG_OK) {
goto end;
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
static struct lttng_action_start_session *action_start_session_from_action(
struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_start_session, parent);
}
static const struct lttng_action_start_session *
action_start_session_from_action_const(const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_start_session, parent);
}
b = container_of(_b, struct lttng_action_start_session, parent);
/* Action is not valid if this is not true. */
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
size_t session_name_len;
int ret;
- assert(action);
- assert(payload);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(payload);
action_start_session = action_start_session_from_action(action);
- assert(action_start_session->session_name);
+ LTTNG_ASSERT(action_start_session->session_name);
DBG("Serializing start session action: session-name: %s",
action_start_session->session_name);
goto end;
}
- assert(policy);
+ LTTNG_ASSERT(policy);
status = lttng_action_start_session_set_rate_policy(action, policy);
if (status != LTTNG_ACTION_STATUS_OK) {
consumed_len = -1;
const char *session_name = NULL;
const struct lttng_rate_policy *policy = NULL;
- assert(action);
- assert(IS_START_SESSION_ACTION(action));
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_START_SESSION_ACTION(action));
status = lttng_action_start_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(session_name != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(session_name != NULL);
status = lttng_action_start_session_get_rate_policy(action, &policy);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(policy != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(policy != NULL);
/* Open action start session element. */
ret = mi_lttng_writer_open_element(
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
static struct lttng_action_stop_session *action_stop_session_from_action(
struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_stop_session, parent);
}
static const struct lttng_action_stop_session *
action_stop_session_from_action_const(const struct lttng_action *action)
{
- assert(action);
+ LTTNG_ASSERT(action);
return container_of(action, struct lttng_action_stop_session, parent);
}
b = action_stop_session_from_action_const(_b);
/* Action is not valid if this is not true. */
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
size_t session_name_len;
int ret;
- assert(action);
- assert(payload);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(payload);
action_stop_session = action_stop_session_from_action(action);
- assert(action_stop_session->session_name);
+ LTTNG_ASSERT(action_stop_session->session_name);
DBG("Serializing stop session action: session-name: %s",
action_stop_session->session_name);
goto end;
}
- assert(policy);
+ LTTNG_ASSERT(policy);
status = lttng_action_stop_session_set_rate_policy(action, policy);
if (status != LTTNG_ACTION_STATUS_OK) {
consumed_len = -1;
const char *session_name = NULL;
const struct lttng_rate_policy *policy = NULL;
- assert(action);
- assert(IS_STOP_SESSION_ACTION(action));
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(IS_STOP_SESSION_ACTION(action));
status = lttng_action_stop_session_get_session_name(
action, &session_name);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(session_name != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(session_name != NULL);
status = lttng_action_stop_session_get_rate_policy(action, &policy);
- assert(status == LTTNG_ACTION_STATUS_OK);
- assert(policy != NULL);
+ LTTNG_ASSERT(status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(policy != NULL);
/* Open action stop session. */
ret = mi_lttng_writer_open_element(
* Copyright 2019 Philippe Proulx <pproulx@efficios.com>
*/
-#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#define argpar_calloc(_type, _nmemb) ((_type *) calloc((_nmemb), sizeof(_type)))
#define argpar_zalloc(_type) argpar_calloc(_type, 1)
-#define ARGPAR_ASSERT(_cond) assert(_cond)
+#define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
#ifdef __MINGW_PRINTF_FORMAT
# define ARGPAR_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
#include <common/buffer-view.h>
#include <common/dynamic-buffer.h>
#include <common/error.h>
-#include <assert.h>
LTTNG_HIDDEN
struct lttng_buffer_view lttng_buffer_view_init(
{
struct lttng_buffer_view view = { .data = NULL, .size = 0 };
- assert(src);
+ LTTNG_ASSERT(src);
if (offset > src->size) {
ERR("Attempt to create buffer view from another view with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd",
{
struct lttng_buffer_view view = { .data = NULL, .size = 0 };
- assert(src);
+ LTTNG_ASSERT(src);
if (offset > src->size) {
ERR("Attempt to create buffer view from a dynamic buffer with invalid offset (offset > source size): source size = %zu, offset in source = %zu, length = %zd",
#include <lttng/constant.h>
#include <common/dynamic-array.h>
-#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
struct lttng_directory_handle *new_handle = NULL;
char *new_path = NULL;
- assert(ref_handle && ref_handle->base_path);
+ LTTNG_ASSERT(ref_handle && ref_handle->base_path);
ret = lttng_directory_handle_stat(ref_handle, path, &stat_buf);
if (ret == -1) {
struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd(
int dirfd)
{
- assert(dirfd == AT_FDCWD);
+ LTTNG_ASSERT(dirfd == AT_FDCWD);
return lttng_directory_handle_create(NULL);
}
size_t len;
int ret;
- assert(path);
+ LTTNG_ASSERT(path);
ret = lttng_strncpy(tmp, path, sizeof(tmp));
if (ret) {
if (!handle) {
return;
}
- assert(handle->ref.refcount);
+ LTTNG_ASSERT(handle->ref.refcount);
urcu_ref_put(&handle->ref, lttng_directory_handle_release);
}
lttng_dynamic_array_get_element(
&frames, current_frame_idx);
- assert(current_frame->dir);
+ LTTNG_ASSERT(current_frame->dir);
ret = lttng_dynamic_buffer_set_size(
¤t_path, current_frame->path_size);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
current_path.data[current_path.size - 1] = '\0';
while ((entry = readdir(current_frame->dir))) {
/* Set current_path to the entry's path. */
ret = lttng_dynamic_buffer_set_size(
¤t_path, current_path.size - 1);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = lttng_dynamic_buffer_append(¤t_path,
&separator, sizeof(separator));
if (ret) {
parent_frame = lttng_dynamic_array_get_element(&frames,
current_frame->parent_frame_idx);
- assert(parent_frame);
+ LTTNG_ASSERT(parent_frame);
parent_frame->empty = false;
}
ret = lttng_dynamic_array_remove_element(
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
{
struct epoll_event *ptr;
- assert(events);
+ LTTNG_ASSERT(events);
ptr = realloc(events->events, new_size * sizeof(*ptr));
if (ptr == NULL) {
{
struct pollfd *ptr;
- assert(array);
+ LTTNG_ASSERT(array);
/* Refuse to resize the array more than the max size. */
if (new_size > poll_max_size) {
int ret;
struct compat_poll_event_array *current, *wait;
- assert(events);
+ LTTNG_ASSERT(events);
current = &events->current;
wait = &events->wait;
}
/* No fd duplicate should be ever added into array. */
- assert(current->nb_fd - 1 == count);
+ LTTNG_ASSERT(current->nb_fd - 1 == count);
current->nb_fd = count;
/* Resize array if needed. */
#ifndef _LTT_POLL_H
#define _LTT_POLL_H
-#include <assert.h>
#include <string.h>
#include <unistd.h>
static inline int __lttng_epoll_get_prev_fd(struct lttng_poll_event *events,
int index, uint32_t nb_fd)
{
- assert(events);
- assert(index != nb_fd);
+ LTTNG_ASSERT(events);
+ LTTNG_ASSERT(index != nb_fd);
if (index == 0 || nb_fd == 0) {
return -1;
* fcntl(..).
*/
int efd = epoll_create(size);
- assert(fcntl(efd, F_SETFD, flags) != -1);
+ LTTNG_ASSERT(fcntl(efd, F_SETFD, flags) != -1);
return efd;
}
#endif
static inline int __lttng_poll_get_prev_fd(struct lttng_poll_event *events,
int index, uint32_t nb_fd)
{
- assert(events);
- assert(index != nb_fd);
+ LTTNG_ASSERT(events);
+ LTTNG_ASSERT(index != nb_fd);
if (index == 0 || nb_fd == 0) {
return -1;
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
}
/* Condition is not valid if this is not true. */
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
- assert(a->channel_name);
- assert(b->channel_name);
+ LTTNG_ASSERT(a->channel_name);
+ LTTNG_ASSERT(b->channel_name);
if (strcmp(a->channel_name, b->channel_name)) {
goto end;
}
- assert(a->domain.set);
- assert(b->domain.set);
+ LTTNG_ASSERT(a->domain.set);
+ LTTNG_ASSERT(b->domain.set);
if (a->domain.type != b->domain.type) {
goto end;
}
uint64_t threshold_bytes;
const char *condition_type_str = NULL;
- assert(condition);
- assert(IS_USAGE_CONDITION(condition));
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(IS_USAGE_CONDITION(condition));
status = lttng_condition_buffer_usage_get_session_name(
condition, &session_name);
- assert(status == LTTNG_CONDITION_STATUS_OK);
- assert(session_name);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(session_name);
status = lttng_condition_buffer_usage_get_channel_name(
condition, &channel_name);
- assert(status == LTTNG_CONDITION_STATUS_OK);
- assert(session_name);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(session_name);
status = lttng_condition_buffer_usage_get_domain_type(
condition, &domain_type);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
status = lttng_condition_buffer_usage_get_threshold(
condition, &threshold_bytes);
if (!is_threshold_bytes) {
status = lttng_condition_buffer_usage_get_threshold_ratio(
condition, &threshold_ratio);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
}
switch (lttng_condition_get_type(condition)) {
*
*/
-#include <assert.h>
#include <common/buffer-view.h>
#include <common/dynamic-buffer.h>
#include <common/error.h>
return;
}
- assert(condition->destroy);
+ LTTNG_ASSERT(condition->destroy);
urcu_ref_put(&condition->ref, condition_destroy_ref);
}
enum lttng_error_code ret_code;
struct lttng_error_query_results *error_query_results = NULL;
- assert(condition);
- assert(writer);
- assert(condition->mi_serialize);
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(condition->mi_serialize);
/* Open condition element. */
ret = mi_lttng_writer_open_element(writer, mi_lttng_element_condition);
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
const struct lttng_event_rule *rule = NULL;
unsigned int capture_descriptor_count, i;
- assert(condition);
- assert(writer);
- assert(IS_EVENT_RULE_MATCHES_CONDITION(condition));
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_EVENT_RULE_MATCHES_CONDITION(condition));
status = lttng_condition_event_rule_matches_get_rule(condition, &rule);
- assert(status == LTTNG_CONDITION_STATUS_OK);
- assert(rule != NULL);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(rule != NULL);
status = lttng_condition_event_rule_matches_get_capture_descriptor_count(
condition, &capture_descriptor_count);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
/* Open condition event rule matches element. */
ret = mi_lttng_writer_open_element(
descriptor = lttng_condition_event_rule_matches_get_capture_descriptor_at_index(
condition, i);
- assert(descriptor);
+ LTTNG_ASSERT(descriptor);
ret_code = lttng_event_expr_mi_serialize(descriptor, writer);
if (ret_code != LTTNG_OK) {
}
/* Capture descriptor count. */
- assert(event_rule_length >= 0);
+ LTTNG_ASSERT(event_rule_length >= 0);
capture_descr_count = uint_from_buffer(&view->buffer, sizeof(uint32_t), &offset);
if (capture_descr_count == UINT32_C(-1)) {
goto error;
{
bool is_equal = true;
- assert(obj->type == MSGPACK_OBJECT_STR);
+ LTTNG_ASSERT(obj->type == MSGPACK_OBJECT_STR);
if (obj->via.str.size != strlen(str)) {
is_equal = false;
const msgpack_object *ret = NULL;
size_t i;
- assert(map_obj->type == MSGPACK_OBJECT_MAP);
+ LTTNG_ASSERT(map_obj->type == MSGPACK_OBJECT_MAP);
for (i = 0; i < map_obj->via.map.size; i++) {
const struct msgpack_object_kv *kv = &map_obj->via.map.ptr[i];
- assert(kv->key.type == MSGPACK_OBJECT_STR);
+ LTTNG_ASSERT(kv->key.type == MSGPACK_OBJECT_STR);
if (msgpack_str_is_equal(&kv->key, name)) {
ret = &kv->val;
{
int ret = 0;
- assert(obj);
- assert(field_val);
+ LTTNG_ASSERT(obj);
+ LTTNG_ASSERT(field_val);
switch (obj->type) {
case MSGPACK_OBJECT_NIL:
size_t i;
size_t count;
- assert(condition);
- assert(capture_payload);
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(capture_payload);
/* Initialize value. */
msgpack_unpacked_init(&unpacked);
*/
count = lttng_dynamic_pointer_array_get_count(
&condition->capture_descriptors);
- assert(count > 0);
+ LTTNG_ASSERT(count > 0);
for (i = 0; i < count; i++) {
const struct lttng_capture_descriptor *capture_descriptor =
struct lttng_event_field_value *elem_field_val;
int iret;
- assert(capture_descriptor);
+ LTTNG_ASSERT(capture_descriptor);
elem_obj = &root_array_obj->ptr[i];
iret = event_field_value_from_obj(elem_obj,
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
}
}
- assert(a->session_name);
- assert(b->session_name);
+ LTTNG_ASSERT(a->session_name);
+ LTTNG_ASSERT(b->session_name);
if (strcmp(a->session_name, b->session_name)) {
goto end;
}
const char *session_name = NULL;
uint64_t threshold_bytes;
- assert(condition);
- assert(writer);
- assert(IS_CONSUMED_SIZE_CONDITION(condition));
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_CONSUMED_SIZE_CONDITION(condition));
status = lttng_condition_session_consumed_size_get_session_name(
condition, &session_name);
- assert(status == LTTNG_CONDITION_STATUS_OK);
- assert(session_name);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(session_name);
status = lttng_condition_session_consumed_size_get_threshold(
condition, &threshold_bytes);
- assert(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
/* Open condition session consumed size element. */
ret = mi_lttng_writer_open_element(writer,
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/macros.h>
#include <common/mi-lttng.h>
const char *session_name = NULL;
const char *type_element_str = NULL;
- assert(condition);
- assert(writer);
- assert(is_rotation_condition(condition));
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(is_rotation_condition(condition));
switch (lttng_condition_get_type(condition)) {
case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
status = lttng_condition_session_rotation_get_session_name(
condition, &session_name);
- assert(status == LTTNG_CONDITION_STATUS_OK);
- assert(session_name);
+ LTTNG_ASSERT(status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(session_name);
/* Open condition session rotation_* element. */
ret = mi_lttng_writer_open_element(writer, type_element_str);
#include "lttng/tracker.h"
#define _LGPL_SOURCE
-#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
int ret = 0;
struct config_entry entry = { section, name, value };
- assert(args);
+ LTTNG_ASSERT(args);
if (!section || !name || !value) {
ret = -EIO;
xmlCharEncodingHandlerPtr handler;
int out_len, ret, in_len;
- assert(in_str);
+ LTTNG_ASSERT(in_str);
handler = xmlFindCharEncodingHandler(config_xml_encoding);
if (!handler) {
int ret;
xmlNodePtr node;
- assert(output);
+ LTTNG_ASSERT(output);
for (node = xmlFirstElementChild(consumer_output_node); node;
node = xmlNextElementSibling(node)) {
struct lttng_handle *handle;
const char *uri = NULL;
- assert(name);
+ LTTNG_ASSERT(name);
handle = lttng_create_handle(name, NULL);
if (!handle) {
xmlNodePtr snapshot_output_list_node;
xmlNodePtr snapshot_output_node;
- assert(session_name);
+ LTTNG_ASSERT(session_name);
ret = lttng_create_session_snapshot(session_name, NULL);
if (ret) {
const char *data_uri = NULL;
const char *path = NULL;
- assert(name);
+ LTTNG_ASSERT(name);
if (output_node) {
consumer_output_node = xmlFirstElementChild(output_node);
{
int ret;
- assert(probe_attribute_node);
- assert(attr);
+ LTTNG_ASSERT(probe_attribute_node);
+ LTTNG_ASSERT(attr);
if (!strcmp((const char *) probe_attribute_node->name,
config_element_address)) {
unsigned long exclusion_count = 0;
char *filter_expression = NULL;
- assert(event_node);
- assert(handle);
- assert(channel_name);
+ LTTNG_ASSERT(event_node);
+ LTTNG_ASSERT(handle);
+ LTTNG_ASSERT(channel_name);
event = lttng_event_create();
if (!event) {
event->loglevel = LTTNG_LOGLEVEL_DEBUG;
break;
default:
- assert(0);
+ abort();
}
for (node = xmlFirstElementChild(event_node); node;
struct lttng_event event;
xmlNodePtr node;
- assert(events_node);
- assert(handle);
- assert(channel_name);
+ LTTNG_ASSERT(events_node);
+ LTTNG_ASSERT(handle);
+ LTTNG_ASSERT(channel_name);
for (node = xmlFirstElementChild(events_node); node;
node = xmlNextElementSibling(node)) {
{
int ret;
- assert(attr_node);
- assert(channel);
- assert(contexts_node);
- assert(events_node);
+ LTTNG_ASSERT(attr_node);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(contexts_node);
+ LTTNG_ASSERT(events_node);
if (!strcmp((const char *) attr_node->name, config_element_name)) {
xmlChar *content;
struct lttng_event_context context;
xmlNodePtr context_child_node = xmlFirstElementChild(context_node);
- assert(handle);
- assert(channel_name);
+ LTTNG_ASSERT(handle);
+ LTTNG_ASSERT(channel_name);
if (!context_child_node) {
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID :
LTTNG_PROCESS_ATTR_PROCESS_ID;
- assert(handle);
+ LTTNG_ASSERT(handle);
tracker_handle_ret_code = lttng_session_get_tracker_handle(
handle->session_name, handle->domain.type,
struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
enum lttng_process_attr_tracker_handle_status status;
- assert(handle);
- assert(id_tracker_node);
+ LTTNG_ASSERT(handle);
+ LTTNG_ASSERT(id_tracker_node);
tracker_handle_ret_code = lttng_session_get_tracker_handle(
handle->session_name, handle->domain.type, process_attr,
xmlNodePtr vgid_tracker_node = NULL;
xmlNodePtr node;
- assert(session_name);
+ LTTNG_ASSERT(session_name);
ret = init_domain(domain_node, &domain);
if (ret) {
{
int ret;
- assert(path);
+ LTTNG_ASSERT(path);
/* Can we read the file. */
ret = access(path, R_OK);
xmlNodePtr sessions_node;
xmlNodePtr session_node;
- assert(path);
- assert(validation_ctx);
+ LTTNG_ASSERT(path);
+ LTTNG_ASSERT(validation_ctx);
ret = validate_file_read_creds(path);
if (ret != 1) {
struct lttng_dynamic_buffer file_path;
size_t path_len;
- assert(path);
- assert(validation_ctx);
+ LTTNG_ASSERT(path);
+ LTTNG_ASSERT(validation_ctx);
path_len = strlen(path);
lttng_dynamic_buffer_init(&file_path);
if (path_len >= LTTNG_PATH_MAX) {
int ret, uid = getuid();
struct stat buf;
- assert(path);
+ LTTNG_ASSERT(path);
if (uid == 0) {
goto valid;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
{
const int ret = lttng_dynamic_buffer_set_size(&cache->contents, 0);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
}
/*
bool cache_is_invalidated = false;
uint64_t original_size;
- assert(cache);
+ LTTNG_ASSERT(cache);
ASSERT_LOCKED(cache->lock);
original_size = cache->contents.size;
status = CONSUMER_METADATA_CACHE_WRITE_STATUS_APPENDED_CONTENT;
} else {
status = CONSUMER_METADATA_CACHE_WRITE_STATUS_NO_CHANGE;
- assert(cache->contents.size == original_size);
+ LTTNG_ASSERT(cache->contents.size == original_size);
}
end:
{
int ret;
- assert(channel);
+ LTTNG_ASSERT(channel);
channel->metadata_cache = zmalloc(
sizeof(struct consumer_metadata_cache));
int ret = 0;
struct lttng_consumer_stream *metadata_stream;
- assert(channel);
- assert(channel->metadata_cache);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->metadata_cache);
/*
* If not called from a timer handler, we have to take the
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <unistd.h>
int ret;
enum sync_metadata_status status;
- assert(metadata);
- assert(metadata->metadata_flag);
- assert(ctx);
+ LTTNG_ASSERT(metadata);
+ LTTNG_ASSERT(metadata->metadata_flag);
+ LTTNG_ASSERT(ctx);
/*
* In UST, since we have to write the metadata from the cache packet
struct lttng_ht_iter iter;
struct lttng_ht *ht;
- assert(ctx);
+ LTTNG_ASSERT(ctx);
/* Ease our life a bit. */
ht = the_consumer_data.stream_list_ht;
/* Block until all the metadata is sent. */
pthread_mutex_lock(&stream->metadata_timer_lock);
- assert(!stream->missed_metadata_flush);
+ LTTNG_ASSERT(!stream->missed_metadata_flush);
stream->waiting_on_metadata = true;
pthread_mutex_unlock(&stream->metadata_timer_lock);
{
int ret;
- assert(stream);
- assert(relayd);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(relayd);
if (stream->sent_to_relayd) {
uatomic_dec(&relayd->refcount);
- assert(uatomic_read(&relayd->refcount) >= 0);
+ LTTNG_ASSERT(uatomic_read(&relayd->refcount) >= 0);
}
/* Closing streams requires to lock the control socket. */
int ret;
struct consumer_relayd_sock_pair *relayd;
- assert(stream);
+ LTTNG_ASSERT(stream);
switch (the_consumer_data.type) {
case LTTNG_CONSUMER_KERNEL:
}
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
/* Close output fd. Could be a socket or local file at this point. */
int ret;
struct lttng_ht_iter iter;
- assert(stream);
+ LTTNG_ASSERT(stream);
/* Should NEVER be called not in monitor mode. */
- assert(stream->chan->monitor);
+ LTTNG_ASSERT(stream->chan->monitor);
rcu_read_lock();
if (ht) {
iter.iter.node = &stream->node.node;
ret = lttng_ht_del(ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
/* Delete from stream per channel ID hash table. */
if (!stream->metadata_flag) {
/* Decrement the stream count of the global consumer data. */
- assert(the_consumer_data.stream_count > 0);
+ LTTNG_ASSERT(the_consumer_data.stream_count > 0);
the_consumer_data.stream_count--;
}
}
*/
void consumer_stream_free(struct lttng_consumer_stream *stream)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
metadata_bucket_destroy(stream->metadata_bucket);
call_rcu(&stream->node.head, free_stream_rcu);
*/
void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
switch (the_consumer_data.type) {
case LTTNG_CONSUMER_KERNEL:
break;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
}
*/
static void destroy_close_stream(struct lttng_consumer_stream *stream)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
DBG("Consumer stream destroy monitored key: %" PRIu64, stream->key);
{
struct lttng_consumer_channel *free_chan = NULL;
- assert(stream);
- assert(stream->chan);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->chan);
/* Update refcount of channel and see if we need to destroy it. */
if (!uatomic_sub_return(&stream->chan->refcount, 1)
void consumer_stream_destroy(struct lttng_consumer_stream *stream,
struct lttng_ht *ht)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
/* Stream is in monitor mode. */
if (stream->monitor) {
{
int ret;
- assert(stream);
- assert(element);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(element);
rcu_read_lock();
if (stream->net_seq_idx != (uint64_t) -1ULL) {
char stream_path[LTTNG_PATH_MAX];
ASSERT_LOCKED(stream->lock);
- assert(stream->trace_chunk);
+ LTTNG_ASSERT(stream->trace_chunk);
ret = utils_stream_file_path(stream->chan->pathname, stream->name,
stream->chan->tracefile_size,
* This function does not take a const stream since
* cds_lfht_is_node_deleted was not const before liburcu 0.12.
*/
- assert(stream);
+ LTTNG_ASSERT(stream);
return cds_lfht_is_node_deleted(&stream->node.node);
}
{
int ret = 0;
- assert(stream->metadata_flag);
- assert(!stream->metadata_bucket);
- assert(stream->chan->output == CONSUMER_CHANNEL_MMAP);
+ LTTNG_ASSERT(stream->metadata_flag);
+ LTTNG_ASSERT(!stream->metadata_bucket);
+ LTTNG_ASSERT(stream->chan->output == CONSUMER_CHANNEL_MMAP);
stream->metadata_bucket = metadata_bucket_create(
metadata_bucket_flush, stream);
void consumer_stream_metadata_set_version(
struct lttng_consumer_stream *stream, uint64_t new_version)
{
- assert(new_version > stream->metadata_version);
+ LTTNG_ASSERT(new_version > stream->metadata_version);
stream->metadata_version = new_version;
stream->reset_metadata_flag = 1;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <signal.h>
struct lttng_consumer_channel *channel;
channel = si->si_value.sival_ptr;
- assert(channel);
+ LTTNG_ASSERT(channel);
if (channel->switch_timer_error) {
return;
break;
case LTTNG_CONSUMER_KERNEL:
case LTTNG_CONSUMER_UNKNOWN:
- assert(0);
+ abort();
break;
}
}
consumer_flush_ust_index;
channel = si->si_value.sival_ptr;
- assert(channel);
+ LTTNG_ASSERT(channel);
if (channel->switch_timer_error) {
goto error;
struct sigevent sev = {};
struct itimerspec its;
- assert(channel);
- assert(channel->key);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->key);
if (timer_interval_us == 0) {
/* No creation needed; not an error. */
{
int ret;
- assert(channel);
- assert(channel->key);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->key);
ret = consumer_channel_timer_start(&channel->switch_timer, channel,
switch_timer_interval_us, LTTNG_CONSUMER_SIG_SWITCH);
{
int ret;
- assert(channel);
+ LTTNG_ASSERT(channel);
ret = consumer_channel_timer_stop(&channel->switch_timer,
LTTNG_CONSUMER_SIG_SWITCH);
{
int ret;
- assert(channel);
- assert(channel->key);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->key);
ret = consumer_channel_timer_start(&channel->live_timer, channel,
live_timer_interval_us, LTTNG_CONSUMER_SIG_LIVE);
{
int ret;
- assert(channel);
+ LTTNG_ASSERT(channel);
ret = consumer_channel_timer_stop(&channel->live_timer,
LTTNG_CONSUMER_SIG_LIVE);
{
int ret;
- assert(channel);
- assert(channel->key);
- assert(!channel->monitor_timer_enabled);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->key);
+ LTTNG_ASSERT(!channel->monitor_timer_enabled);
ret = consumer_channel_timer_start(&channel->monitor_timer, channel,
monitor_timer_interval_us, LTTNG_CONSUMER_SIG_MONITOR);
{
int ret;
- assert(channel);
- assert(channel->monitor_timer_enabled);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->monitor_timer_enabled);
ret = consumer_channel_timer_stop(&channel->monitor_timer,
LTTNG_CONSUMER_SIG_MONITOR);
get_produced_cb get_produced;
uint64_t lowest = 0, highest = 0, total_consumed = 0;
- assert(channel);
+ LTTNG_ASSERT(channel);
if (channel_monitor_pipe < 0) {
return;
* Writes performed here are assumed to be atomic which is only
* guaranteed for sizes < than PIPE_BUF.
*/
- assert(sizeof(msg) <= PIPE_BUF);
+ LTTNG_ASSERT(sizeof(msg) <= PIPE_BUF);
do {
ret = write(channel_monitor_pipe, &msg, sizeof(msg));
channel = info.si_value.sival_ptr;
monitor_timer(channel);
} else if (signr == LTTNG_CONSUMER_SIG_EXIT) {
- assert(CMM_LOAD_SHARED(consumer_quit));
+ LTTNG_ASSERT(CMM_LOAD_SHARED(consumer_quit));
goto end;
} else {
ERR("Unexpected signal %d\n", info.si_signo);
#include "common/index/ctf-index.h"
#define _LGPL_SOURCE
-#include <assert.h>
#include <poll.h>
#include <pthread.h>
#include <stdlib.h>
{
struct lttng_consumer_stream *null_stream = NULL;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
(void) lttng_pipe_write(pipe, &null_stream, sizeof(null_stream));
}
{
struct lttng_consumer_stream *stream, *stmp;
- assert(channel);
+ LTTNG_ASSERT(channel);
/* Delete streams that might have been left in the stream list. */
cds_list_for_each_entry_safe(stream, stmp, &channel->streams.head,
struct lttng_ht_node_u64 *node;
struct lttng_consumer_stream *stream = NULL;
- assert(ht);
+ LTTNG_ASSERT(ht);
/* -1ULL keys are lookup failures */
if (key == (uint64_t) -1ULL) {
break;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
goto end;
}
rcu_read_lock();
iter.iter.node = &channel->node.node;
ret = lttng_ht_del(the_consumer_data.channel_ht, &iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
iter.iter.node = &channel->channels_by_session_id_ht_node.node;
ret = lttng_ht_del(the_consumer_data.channels_by_session_id_ht,
&iter);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
rcu_read_unlock();
}
{
uint64_t netidx;
- assert(relayd);
+ LTTNG_ASSERT(relayd);
DBG("Cleaning up relayd object ID %"PRIu64, relayd->net_seq_idx);
*/
void consumer_flag_relayd_for_destroy(struct consumer_relayd_sock_pair *relayd)
{
- assert(relayd);
+ LTTNG_ASSERT(relayd);
/* Set destroy flag for this object */
uatomic_set(&relayd->destroy_flag, 1);
{
struct lttng_ht *ht = data_ht;
- assert(stream);
- assert(ht);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(ht);
DBG3("Adding consumer stream %" PRIu64, stream->key);
struct lttng_ht_node_u64 *node;
struct lttng_ht_iter iter;
- assert(relayd);
+ LTTNG_ASSERT(relayd);
lttng_ht_lookup(the_consumer_data.relayd_ht, &relayd->net_seq_idx,
&iter);
int ret = 0;
struct consumer_relayd_sock_pair *relayd;
- assert(stream);
- assert(stream->net_seq_idx != -1ULL);
- assert(path);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->net_seq_idx != -1ULL);
+ LTTNG_ASSERT(path);
/* The stream is not metadata. Get relayd reference if exists. */
rcu_read_lock();
int ret = 0;
struct consumer_relayd_sock_pair *relayd;
- assert(net_seq_idx != -1ULL);
+ LTTNG_ASSERT(net_seq_idx != -1ULL);
/* The stream is not metadata. Get relayd reference if exists. */
rcu_read_lock();
struct lttcomm_relayd_data_hdr data_hdr;
/* Safety net */
- assert(stream);
- assert(relayd);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(relayd);
/* Reset data header */
memset(&data_hdr, 0, sizeof(data_hdr));
ASSERT_LOCKED(stream->chan->lock);
ASSERT_LOCKED(stream->lock);
- assert(stream->metadata_flag);
- assert(stream->chan->trace_chunk);
+ LTTNG_ASSERT(stream->metadata_flag);
+ LTTNG_ASSERT(stream->chan->trace_chunk);
switch (the_consumer_data.type) {
case LTTNG_CONSUMER_KERNEL:
const bool acquired_reference = lttng_trace_chunk_get(
new_trace_chunk);
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
}
lttng_trace_chunk_put(channel->trace_chunk);
channel->output = CONSUMER_CHANNEL_MMAP;
break;
default:
- assert(0);
+ abort();
free(channel);
channel = NULL;
goto end;
struct lttng_ht_iter iter;
struct lttng_consumer_stream *stream;
- assert(ctx);
- assert(ht);
- assert(pollfd);
- assert(local_stream);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(pollfd);
+ LTTNG_ASSERT(local_stream);
DBG("Updating poll fd array");
*nb_inactive_fd = 0;
int ret;
struct lttng_consumer_local_data *ctx;
- assert(the_consumer_data.type == LTTNG_CONSUMER_UNKNOWN ||
+ LTTNG_ASSERT(the_consumer_data.type == LTTNG_CONSUMER_UNKNOWN ||
the_consumer_data.type == type);
the_consumer_data.type = type;
/* RCU lock for the relayd pointer */
rcu_read_lock();
- assert(stream->net_seq_idx != (uint64_t) -1ULL ||
+ LTTNG_ASSERT(stream->net_seq_idx != (uint64_t) -1ULL ||
stream->trace_chunk);
/* Flag that the current stream if set for network streaming. */
return -ENOSYS;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
/* RCU lock for the relayd pointer */
return lttng_ustconsumer_sample_snapshot_positions(stream);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
return lttng_ustconsumer_take_snapshot(stream);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
return lttng_ustconsumer_get_produced_snapshot(stream, pos);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
return lttng_ustconsumer_get_consumed_snapshot(stream, pos);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
return lttng_ustconsumer_recv_cmd(ctx, sock, consumer_sockpoll);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
break;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
}
struct lttng_consumer_channel *channel = NULL;
bool free_channel = false;
- assert(stream);
+ LTTNG_ASSERT(stream);
/*
* This call should NEVER receive regular stream. It must always be
* metadata stream and this is crucial for data structure synchronization.
*/
- assert(stream->metadata_flag);
+ LTTNG_ASSERT(stream->metadata_flag);
DBG3("Consumer delete metadata stream %d", stream->wait_fd);
struct lttng_ht_iter iter;
struct lttng_ht_node_u64 *node;
- assert(stream);
- assert(ht);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(ht);
DBG3("Adding metadata stream %" PRIu64 " to hash table", stream->key);
*/
lttng_ht_lookup(ht, &stream->key, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
- assert(!node);
+ LTTNG_ASSERT(!node);
/*
* When nb_init_stream_left reaches 0, we don't need to trigger any action
DBG("Consumer delete flagged metadata stream");
- assert(pollset);
+ LTTNG_ASSERT(pollset);
rcu_read_lock();
cds_lfht_for_each_entry(metadata_ht->ht, &iter.iter, stream, node.node) {
lttng_ht_lookup(metadata_ht, &tmp_id, &iter);
}
node = lttng_ht_iter_get_node_u64(&iter);
- assert(node);
+ LTTNG_ASSERT(node);
stream = caa_container_of(node, struct lttng_consumer_stream,
node);
if (revents & (LPOLLIN | LPOLLPRI)) {
/* Get the data out of the metadata file descriptor */
DBG("Metadata available on fd %d", pollfd);
- assert(stream->wait_fd == pollfd);
+ LTTNG_ASSERT(stream->wait_fd == pollfd);
do {
health_code_update();
break;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
next:
pthread_mutex_unlock(&stream->lock);
rcu_read_lock();
cds_lfht_for_each_entry(ht->ht, &iter.iter, channel, wait_fd_node.node) {
ret = lttng_ht_del(ht, &iter);
- assert(ret != 0);
+ LTTNG_ASSERT(ret != 0);
}
rcu_read_unlock();
lttng_poll_del(&events, chan->wait_fd);
iter.iter.node = &chan->wait_fd_node.node;
ret = lttng_ht_del(channel_ht, &iter);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
switch (the_consumer_data.type) {
case LTTNG_CONSUMER_KERNEL:
break;
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
}
/*
lttng_ht_lookup(channel_ht, &tmp_id, &iter);
}
node = lttng_ht_iter_get_node_u64(&iter);
- assert(node);
+ LTTNG_ASSERT(node);
chan = caa_container_of(node, struct lttng_consumer_channel,
wait_fd_node);
lttng_poll_del(&events, chan->wait_fd);
ret = lttng_ht_del(channel_ht, &iter);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
/*
* This will close the wait fd for each stream associated to
{
int ret;
- assert(ctx);
- assert(sockpoll);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(sockpoll);
ret = lttng_consumer_poll_socket(sockpoll);
if (ret) {
return lttng_ustconsumer_on_recv_stream(stream);
default:
ERR("Unknown consumer_data type");
- assert(0);
+ abort();
return -ENOSYS;
}
}
enum lttcomm_return_code ret_code = LTTCOMM_CONSUMERD_SUCCESS;
struct consumer_relayd_sock_pair *relayd = NULL;
- assert(ctx);
- assert(relayd_sock);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(relayd_sock);
DBG("Consumer adding relayd socket (idx: %" PRIu64 ")", net_seq_idx);
/* Get relayd reference if exists. */
relayd = consumer_find_relayd(net_seq_idx);
if (relayd == NULL) {
- assert(sock_type == LTTNG_STREAM_CONTROL);
+ LTTNG_ASSERT(sock_type == LTTNG_STREAM_CONTROL);
/* Not found. Allocate one. */
relayd = consumer_allocate_relayd_sock_pair(net_seq_idx);
if (relayd == NULL) {
/*
* relayd key should never be found for control socket.
*/
- assert(sock_type != LTTNG_STREAM_CONTROL);
+ LTTNG_ASSERT(sock_type != LTTNG_STREAM_CONTROL);
}
/* First send a status message before receiving the fds. */
break;
default:
ERR("Unknown consumer data type");
- assert(0);
+ abort();
}
/* Ease our life a bit */
{
struct lttcomm_consumer_status_channel msg;
- assert(sock >= 0);
+ LTTNG_ASSERT(sock >= 0);
memset(&msg, 0, sizeof(msg));
if (!channel) {
rcu_read_lock();
pthread_mutex_lock(&channel->lock);
- assert(channel->trace_chunk);
+ LTTNG_ASSERT(channel->trace_chunk);
chunk_status = lttng_trace_chunk_get_id(channel->trace_chunk,
&next_chunk_id);
if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) {
chunk_status = lttng_trace_chunk_get_id(
stream->trace_chunk,
&trace_chunk_id);
- assert(chunk_status ==
+ LTTNG_ASSERT(chunk_status ==
LTTNG_TRACE_CHUNK_STATUS_OK);
DBG("Unable to open packet for stream during trace chunk's lifetime. "
}
/* Local protocol error. */
- assert(chunk_creation_timestamp);
+ LTTNG_ASSERT(chunk_creation_timestamp);
ret = time_to_iso8601_str(chunk_creation_timestamp,
creation_timestamp_buffer,
sizeof(creation_timestamp_buffer));
*
*/
-#include <assert.h>
#include <stdbool.h>
#include "credentials.h"
bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a,
const struct lttng_credentials *b)
{
- assert(a);
- assert(b);
+ LTTNG_ASSERT(a);
+ LTTNG_ASSERT(b);
/* XOR on the is_set value */
if (!!a->uid.is_set != !!b->uid.is_set) {
bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a,
const struct lttng_credentials *b)
{
- assert(a);
- assert(b);
+ LTTNG_ASSERT(a);
+ LTTNG_ASSERT(b);
/* XOR on the is_set value */
if (!!a->gid.is_set != !!b->gid.is_set) {
bool lttng_credentials_is_equal(const struct lttng_credentials *a,
const struct lttng_credentials *b)
{
- assert(a);
- assert(b);
+ LTTNG_ASSERT(a);
+ LTTNG_ASSERT(b);
return lttng_credentials_is_equal_uid(a, b) &&
lttng_credentials_is_equal_gid(a, b);
#define LTTNG_DYNAMIC_ARRAY_H
#include <common/dynamic-buffer.h>
-#include <assert.h>
typedef void (*lttng_dynamic_array_element_destructor)(void *element);
typedef void (*lttng_dynamic_pointer_array_destructor)(void *ptr);
void *lttng_dynamic_array_get_element(const struct lttng_dynamic_array *array,
size_t element_index)
{
- assert(element_index < array->size);
+ LTTNG_ASSERT(element_index < array->size);
return array->buffer.data + (element_index * array->element_size);
}
#include <common/dynamic-buffer.h>
#include <common/buffer-view.h>
#include <common/utils.h>
-#include <assert.h>
/*
* Round to (upper) power of two, val is returned if it already is a power of
size_t rounded;
const int order = utils_get_count_order_u64(val);
- assert(order >= 0);
+ LTTNG_ASSERT(order >= 0);
rounded = (1ULL << order);
- assert(rounded >= val);
+ LTTNG_ASSERT(rounded >= val);
return rounded;
}
LTTNG_HIDDEN
void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer)
{
- assert(buffer);
+ LTTNG_ASSERT(buffer);
memset(buffer, 0, sizeof(*buffer));
}
goto end;
}
- assert(buffer->_capacity >= buffer->size);
+ LTTNG_ASSERT(buffer->_capacity >= buffer->size);
if (buffer->_capacity < (len + buffer->size)) {
ret = lttng_dynamic_buffer_set_capacity(buffer,
buffer->_capacity +
{
const struct lttng_error_query_result_counter *counter_result;
- assert(result->type == LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER);
+ LTTNG_ASSERT(result->type == LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER);
counter_result = container_of(result, typeof(*counter_result), parent);
return lttng_dynamic_buffer_append(&payload->buffer,
{
int ret;
- assert(name);
- assert(description);
+ LTTNG_ASSERT(name);
+ LTTNG_ASSERT(description);
result->type = result_type;
*result = (typeof(*result)) lttng_dynamic_pointer_array_get_pointer(
&results->results, index);
- assert(*result);
+ LTTNG_ASSERT(*result);
status = LTTNG_ERROR_QUERY_RESULTS_STATUS_OK;
end:
return status;
enum lttng_error_query_result_status status;
uint64_t value;
- assert(result);
- assert(writer);
+ LTTNG_ASSERT(result);
+ LTTNG_ASSERT(writer);
status = lttng_error_query_result_counter_get_value(result, &value);
- assert(status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
/* Open error query result counter element. */
ret = mi_lttng_writer_open_element(
const char *name = NULL;
const char *description = NULL;
- assert(result);
- assert(writer);
+ LTTNG_ASSERT(result);
+ LTTNG_ASSERT(writer);
type = lttng_error_query_result_get_type(result);
result_status = lttng_error_query_result_get_name(result, &name);
- assert(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+ LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
result_status = lttng_error_query_result_get_description(
result, &description);
- assert(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
+ LTTNG_ASSERT(result_status == LTTNG_ERROR_QUERY_RESULT_STATUS_OK);
/* Open error query result element. */
ret = mi_lttng_writer_open_element(
unsigned int i, count;
enum lttng_error_query_results_status results_status;
- assert(results);
- assert(writer);
+ LTTNG_ASSERT(results);
+ LTTNG_ASSERT(writer);
/* Open error query results element. */
ret = mi_lttng_writer_open_element(
}
results_status = lttng_error_query_results_get_count(results, &count);
- assert(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
+ LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
for (i = 0; i < count; i++) {
const struct lttng_error_query_result *result;
results_status = lttng_error_query_results_get_result(
results, &result, i);
- assert(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
+ LTTNG_ASSERT(results_status == LTTNG_ERROR_QUERY_RESULTS_STATUS_OK);
/* A single error query result. */
ret_code = lttng_error_query_result_mi_serialize(result, writer);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <pthread.h>
#include <stdlib.h>
{
int ret;
- assert(name);
+ LTTNG_ASSERT(name);
URCU_TLS(logger_thread_name) = name;
if (set_pthread_name) {
DBG3(fmt, ## args); \
break; \
default: \
- assert(0); \
+ abort(); \
} \
} while(0);
#include <common/macros.h>
#include <common/error.h>
#include <stdbool.h>
-#include <assert.h>
LTTNG_HIDDEN
void lttng_evaluation_init(struct lttng_evaluation *evaluation,
evaluation_size += ret;
break;
case LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES:
- assert(condition);
- assert(condition->type ==
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(condition->type ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
ret = lttng_evaluation_event_rule_matches_create_from_payload(
container_of(condition,
return;
}
- assert(evaluation->destroy);
+ LTTNG_ASSERT(evaluation->destroy);
evaluation->destroy(evaluation);
}
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stddef.h>
#include <common/bytecode/bytecode.h>
goto error;
}
- assert(name);
+ LTTNG_ASSERT(name);
expr->name = strdup(name);
if (!expr->name) {
goto error;
enum lttng_error_code ret_code;
const char *name = NULL;
- assert(expression);
- assert(writer);
- assert(expression->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD);
+ LTTNG_ASSERT(expression);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_EVENT_PAYLOAD_FIELD);
name = lttng_event_expr_event_payload_field_get_name(expression);
- assert(name);
+ LTTNG_ASSERT(name);
/* Open event expr payload field element. */
ret = mi_lttng_writer_open_element(
enum lttng_error_code ret_code;
const char *name = NULL;
- assert(expression);
- assert(writer);
- assert(expression->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD);
+ LTTNG_ASSERT(expression);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD);
name = lttng_event_expr_channel_context_field_get_name(expression);
- assert(name);
+ LTTNG_ASSERT(name);
/* Open event expr channel context field element. */
ret = mi_lttng_writer_open_element(writer,
const char *provider_name = NULL;
const char *type_name = NULL;
- assert(expression);
- assert(writer);
- assert(expression->type ==
+ LTTNG_ASSERT(expression);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(expression->type ==
LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD);
provider_name = lttng_event_expr_app_specific_context_field_get_provider_name(
expression);
- assert(provider_name);
+ LTTNG_ASSERT(provider_name);
type_name = lttng_event_expr_app_specific_context_field_get_type_name(
expression);
- assert(provider_name);
+ LTTNG_ASSERT(provider_name);
/* Open event expr app specific context field element. */
ret = mi_lttng_writer_open_element(writer,
const struct lttng_event_expr *parent_expr = NULL;
unsigned int index;
- assert(expression);
- assert(writer);
- assert(expression->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT);
+ LTTNG_ASSERT(expression);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(expression->type == LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT);
status = lttng_event_expr_array_field_element_get_index(
expression, &index);
- assert(status == LTTNG_EVENT_EXPR_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_EXPR_STATUS_OK);
parent_expr = lttng_event_expr_array_field_element_get_parent_expr(
expression);
- assert(parent_expr != NULL);
+ LTTNG_ASSERT(parent_expr != NULL);
/* Open event expr array field element. */
ret = mi_lttng_writer_open_element(writer,
int ret;
enum lttng_error_code ret_code;
- assert(expression);
- assert(writer);
+ LTTNG_ASSERT(expression);
+ LTTNG_ASSERT(writer);
ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_expr);
if (ret) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stddef.h>
#include <stdbool.h>
goto error;
}
- assert(val);
+ LTTNG_ASSERT(val);
field_val->val = strndup(val, size);
if (!field_val->val) {
goto error;
struct lttng_event_field_value *lttng_event_field_value_string_create(
const char *val)
{
- assert(val);
+ LTTNG_ASSERT(val);
return lttng_event_field_value_string_create_with_size(val,
strlen(val));
}
int ret;
char *new_label;
- assert(field_val);
- assert(label);
+ LTTNG_ASSERT(field_val);
+ LTTNG_ASSERT(label);
new_label = strndup(label, size);
if (!new_label) {
ret = -1;
struct lttng_event_field_value *field_val,
const char *label)
{
- assert(label);
+ LTTNG_ASSERT(label);
return lttng_event_field_value_enum_append_label_with_size(field_val,
label, strlen(label));
}
struct lttng_event_field_value *array_field_val,
struct lttng_event_field_value *field_val)
{
- assert(array_field_val);
- assert(field_val);
+ LTTNG_ASSERT(array_field_val);
+ LTTNG_ASSERT(field_val);
return lttng_dynamic_pointer_array_add_pointer(
&container_of(array_field_val,
struct lttng_event_field_value_array, parent)->elems,
int lttng_event_field_value_array_append_unavailable(
struct lttng_event_field_value *array_field_val)
{
- assert(array_field_val);
+ LTTNG_ASSERT(array_field_val);
return lttng_dynamic_pointer_array_add_pointer(
&container_of(array_field_val,
struct lttng_event_field_value_array, parent)->elems,
*
*/
-#include <assert.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
#include <common/hashtable/utils.h>
struct lttng_event_rule *event_rule =
container_of(ref, typeof(*event_rule), ref);
- assert(event_rule->destroy);
+ LTTNG_ASSERT(event_rule->destroy);
event_rule->destroy(event_rule);
}
goto end;
}
- assert(create_from_payload);
+ LTTNG_ASSERT(create_from_payload);
{
struct lttng_payload_view child_view =
return;
}
- assert(event_rule->ref.refcount);
+ LTTNG_ASSERT(event_rule->ref.refcount);
urcu_ref_put(&event_rule->ref, lttng_event_rule_release);
}
struct lttng_event_rule *rule,
const struct lttng_credentials *creds)
{
- assert(rule->generate_filter_bytecode);
+ LTTNG_ASSERT(rule->generate_filter_bytecode);
return rule->generate_filter_bytecode(rule, creds);
}
LTTNG_HIDDEN
const char *lttng_event_rule_get_filter(const struct lttng_event_rule *rule)
{
- assert(rule->get_filter);
+ LTTNG_ASSERT(rule->get_filter);
return rule->get_filter(rule);
}
const struct lttng_bytecode *lttng_event_rule_get_filter_bytecode(
const struct lttng_event_rule *rule)
{
- assert(rule->get_filter_bytecode);
+ LTTNG_ASSERT(rule->get_filter_bytecode);
return rule->get_filter_bytecode(rule);
}
lttng_event_rule_generate_exclusions(const struct lttng_event_rule *rule,
struct lttng_event_exclusion **exclusions)
{
- assert(rule->generate_exclusions);
+ LTTNG_ASSERT(rule->generate_exclusions);
return rule->generate_exclusions(rule, exclusions);
}
struct lttng_event *lttng_event_rule_generate_lttng_event(
const struct lttng_event_rule *rule)
{
- assert(rule->generate_lttng_event);
+ LTTNG_ASSERT(rule->generate_lttng_event);
return rule->generate_lttng_event(rule);
}
LTTNG_HIDDEN
unsigned long lttng_event_rule_hash(const struct lttng_event_rule *rule)
{
- assert(rule->hash);
+ LTTNG_ASSERT(rule->hash);
return rule->hash(rule);
}
int ret;
enum lttng_error_code ret_code;
- assert(rule);
- assert(writer);
- assert(rule->mi_serialize);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(rule->mi_serialize);
/* Open event rule element. */
ret = mi_lttng_writer_open_element(writer, mi_lttng_element_event_rule);
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
}
/* Long check. */
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
const struct lttng_log_level_rule *log_level_rule = NULL;
enum lttng_event_rule_status status;
- assert(rule);
- assert(_agent_filter);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(_agent_filter);
status = lttng_event_rule_jul_logging_get_name_pattern(rule, &pattern);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
struct lttng_bytecode *bytecode = NULL;
char *agent_filter;
- assert(rule);
+ LTTNG_ASSERT(rule);
jul_logging = container_of(
rule, struct lttng_event_rule_jul_logging, parent);
{
struct lttng_event_rule_jul_logging *jul_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
jul_logging = container_of(
rule, struct lttng_event_rule_jul_logging, parent);
return jul_logging->internal_filter.filter;
{
struct lttng_event_rule_jul_logging *jul_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
jul_logging = container_of(
rule, struct lttng_event_rule_jul_logging, parent);
return jul_logging->internal_filter.bytecode;
const char *name_pattern = NULL;
const struct lttng_log_level_rule *log_level_rule = NULL;
- assert(rule);
- assert(writer);
- assert(IS_JUL_LOGGING_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_JUL_LOGGING_EVENT_RULE(rule));
status = lttng_event_rule_jul_logging_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
status = lttng_event_rule_jul_logging_get_log_level_rule(
rule, &log_level_rule);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
/* Open event rule jul logging element. */
goto end;
}
- assert(ret == jul_logging_comm->log_level_rule_len);
+ LTTNG_ASSERT(ret == jul_logging_comm->log_level_rule_len);
}
/* Skip after the log level rule. */
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
}
/* Long check */
- assert(a->name);
- assert(b->name);
+ LTTNG_ASSERT(a->name);
+ LTTNG_ASSERT(b->name);
if (strcmp(a->name, b->name)) {
goto end;
}
const char *event_name = NULL;
const struct lttng_kernel_probe_location *location = NULL;
- assert(rule);
- assert(writer);
- assert(IS_KPROBE_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_KPROBE_EVENT_RULE(rule));
status = lttng_event_rule_kernel_kprobe_get_event_name(
rule, &event_name);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(event_name);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_name);
status = lttng_event_rule_kernel_kprobe_get_location(rule, &location);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(location);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(location);
/* Open event rule kernel kprobe element. */
ret = mi_lttng_writer_open_element(
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
goto end;
}
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
const char *filter;
struct lttng_bytecode *bytecode = NULL;
- assert(rule);
+ LTTNG_ASSERT(rule);
syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
{
struct lttng_event_rule_kernel_syscall *syscall;
- assert(rule);
+ LTTNG_ASSERT(rule);
syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
return syscall->internal_filter.filter;
{
struct lttng_event_rule_kernel_syscall *syscall;
- assert(rule);
+ LTTNG_ASSERT(rule);
syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
return syscall->internal_filter.bytecode;
const char *name_pattern = NULL;
const char *site_type_str = NULL;
- assert(rule);
- assert(writer);
- assert(IS_SYSCALL_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_SYSCALL_EVENT_RULE(rule));
status = lttng_event_rule_kernel_syscall_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_kernel_syscall_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
site_type = lttng_event_rule_kernel_syscall_get_emission_site(rule);
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
}
/* Long check. */
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
const char *filter;
struct lttng_bytecode *bytecode = NULL;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_kernel_tracepoint, parent);
{
struct lttng_event_rule_kernel_tracepoint *tracepoint;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_kernel_tracepoint, parent);
return tracepoint->internal_filter.filter;
{
struct lttng_event_rule_kernel_tracepoint *tracepoint;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_kernel_tracepoint, parent);
return tracepoint->internal_filter.bytecode;
const char *filter = NULL;
const char *name_pattern = NULL;
- assert(rule);
- assert(writer);
- assert(IS_KERNEL_TRACEPOINT_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_KERNEL_TRACEPOINT_EVENT_RULE(rule));
status = lttng_event_rule_kernel_tracepoint_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_kernel_tracepoint_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
/* Open event rule kernel tracepoint element. */
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
b = container_of(_b, struct lttng_event_rule_kernel_uprobe, parent);
/* uprobe is invalid if this is not true. */
- assert(a->name);
- assert(b->name);
+ LTTNG_ASSERT(a->name);
+ LTTNG_ASSERT(b->name);
if (strcmp(a->name, b->name)) {
goto end;
}
- assert(a->location);
- assert(b->location);
+ LTTNG_ASSERT(a->location);
+ LTTNG_ASSERT(b->location);
is_equal = lttng_userspace_probe_location_is_equal(
a->location, b->location);
end:
const char *event_name = NULL;
const struct lttng_userspace_probe_location *location = NULL;
- assert(rule);
- assert(writer);
- assert(IS_UPROBE_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_UPROBE_EVENT_RULE(rule));
status = lttng_event_rule_kernel_uprobe_get_event_name(
rule, &event_name);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(event_name);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_name);
status = lttng_event_rule_kernel_uprobe_get_location(rule, &location);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(location);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(location);
/* Open event rule kernel uprobe element. */
ret = mi_lttng_writer_open_element(
}
}
- assert(ret == uprobe_comm->location_len);
+ LTTNG_ASSERT(ret == uprobe_comm->location_len);
/* Skip after the location. */
offset += uprobe_comm->location_len;
{
struct lttng_event_rule_kernel_uprobe *uprobe;
- assert(rule);
+ LTTNG_ASSERT(rule);
uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
return uprobe->location;
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
}
/* Long check. */
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
const struct lttng_log_level_rule *log_level_rule = NULL;
enum lttng_event_rule_status status;
- assert(rule);
- assert(_agent_filter);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(_agent_filter);
status = lttng_event_rule_log4j_logging_get_name_pattern(rule, &pattern);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
struct lttng_bytecode *bytecode = NULL;
char *agent_filter;
- assert(rule);
+ LTTNG_ASSERT(rule);
log4j_logging = container_of(
rule, struct lttng_event_rule_log4j_logging, parent);
{
struct lttng_event_rule_log4j_logging *log4j_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
log4j_logging = container_of(
rule, struct lttng_event_rule_log4j_logging, parent);
return log4j_logging->internal_filter.filter;
{
struct lttng_event_rule_log4j_logging *log4j_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
log4j_logging = container_of(
rule, struct lttng_event_rule_log4j_logging, parent);
return log4j_logging->internal_filter.bytecode;
const char *name_pattern = NULL;
const struct lttng_log_level_rule *log_level_rule = NULL;
- assert(rule);
- assert(writer);
- assert(IS_LOG4J_LOGGING_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_LOG4J_LOGGING_EVENT_RULE(rule));
status = lttng_event_rule_log4j_logging_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
status = lttng_event_rule_log4j_logging_get_log_level_rule(
rule, &log_level_rule);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
/* Open event rule log4j logging element. */
goto end;
}
- assert(ret == log4j_logging_comm->log_level_rule_len);
+ LTTNG_ASSERT(ret == log4j_logging_comm->log_level_rule_len);
}
/* Skip after the log level rule. */
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
}
/* Long check. */
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
const struct lttng_log_level_rule *log_level_rule = NULL;
enum lttng_event_rule_status status;
- assert(rule);
- assert(_agent_filter);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(_agent_filter);
status = lttng_event_rule_python_logging_get_name_pattern(rule, &pattern);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
struct lttng_bytecode *bytecode = NULL;
char *agent_filter;
- assert(rule);
+ LTTNG_ASSERT(rule);
python_logging = container_of(
rule, struct lttng_event_rule_python_logging, parent);
{
struct lttng_event_rule_python_logging *python_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
python_logging = container_of(
rule, struct lttng_event_rule_python_logging, parent);
return python_logging->internal_filter.filter;
{
struct lttng_event_rule_python_logging *python_logging;
- assert(rule);
+ LTTNG_ASSERT(rule);
python_logging = container_of(
rule, struct lttng_event_rule_python_logging, parent);
return python_logging->internal_filter.bytecode;
const char *name_pattern = NULL;
const struct lttng_log_level_rule *log_level_rule = NULL;
- assert(rule);
- assert(writer);
- assert(IS_PYTHON_LOGGING_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_PYTHON_LOGGING_EVENT_RULE(rule));
status = lttng_event_rule_python_logging_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_python_logging_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
status = lttng_event_rule_python_logging_get_log_level_rule(
rule, &log_level_rule);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
/* Open event rule python logging element. */
goto end;
}
- assert(ret == python_logging_comm->log_level_rule_len);
+ LTTNG_ASSERT(ret == python_logging_comm->log_level_rule_len);
}
/* Skip after the log level rule. */
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
rule, struct lttng_event_rule_user_tracepoint, parent);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule, &exclusion_count);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
pattern_len = strlen(tracepoint->pattern) + 1;
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
rule, i, &exclusion);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
/* Length field. */
exclusions_len += sizeof(uint32_t);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
rule, i, &exclusion);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
len = strlen(exclusion) + 1;
/* Append exclusion length, includes the null terminator. */
exclusions_appended_len += len;
}
- assert(exclusions_len == exclusions_appended_len);
+ LTTNG_ASSERT(exclusions_len == exclusions_appended_len);
end:
return ret;
b = container_of(_b, struct lttng_event_rule_user_tracepoint, parent);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(_a, &count_a);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(_b, &count_b);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
/* Quick checks. */
if (count_a != count_b) {
}
/* Long check. */
- assert(a->pattern);
- assert(b->pattern);
+ LTTNG_ASSERT(a->pattern);
+ LTTNG_ASSERT(b->pattern);
if (strcmp(a->pattern, b->pattern)) {
goto end;
}
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
_a, i, &exclusion_a);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
_b, i, &exclusion_b);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
if (strcmp(exclusion_a, exclusion_b)) {
goto end;
}
const char *filter;
struct lttng_bytecode *bytecode = NULL;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_user_tracepoint, parent);
{
struct lttng_event_rule_user_tracepoint *tracepoint;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_user_tracepoint, parent);
return tracepoint->internal_filter.filter;
{
struct lttng_event_rule_user_tracepoint *tracepoint;
- assert(rule);
+ LTTNG_ASSERT(rule);
tracepoint = container_of(
rule, struct lttng_event_rule_user_tracepoint, parent);
return tracepoint->internal_filter.bytecode;
enum lttng_event_rule_status event_rule_status;
enum lttng_event_rule_generate_exclusions_status ret_status;
- assert(_exclusions);
+ LTTNG_ASSERT(_exclusions);
event_rule_status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
rule, &nb_exclusions);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
if (nb_exclusions == 0) {
/* Nothing to do. */
exclusions = NULL;
event_rule_status =
lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
rule, i, &exclusion_str);
- assert(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK);
copy_ret = lttng_strncpy(exclusions->names[i], exclusion_str,
LTTNG_SYMBOL_NAME_LEN);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule,
&exclusion_count);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
for (i = 0; i < exclusion_count; i++) {
const char *exclusion;
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
rule, i, &exclusion);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
hash ^= hash_key_str(exclusion, lttng_ht_seed);
}
const struct lttng_log_level_rule *log_level_rule = NULL;
unsigned int exclusion_count = 0;
- assert(rule);
- assert(writer);
- assert(IS_USER_TRACEPOINT_EVENT_RULE(rule));
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(IS_USER_TRACEPOINT_EVENT_RULE(rule));
status = lttng_event_rule_user_tracepoint_get_name_pattern(
rule, &name_pattern);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- assert(name_pattern);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(name_pattern);
status = lttng_event_rule_user_tracepoint_get_filter(rule, &filter);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
status = lttng_event_rule_user_tracepoint_get_log_level_rule(
rule, &log_level_rule);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK ||
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK ||
status == LTTNG_EVENT_RULE_STATUS_UNSET);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(
rule, &exclusion_count);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
/* Open event rule user tracepoint element. */
ret = mi_lttng_writer_open_element(
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_at_index(
rule, i, &exclusion);
- assert(status == LTTNG_EVENT_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
ret = mi_lttng_writer_write_element_string(writer,
mi_lttng_element_event_rule_user_tracepoint_name_pattern_exclusion,
goto end;
}
- assert(ret == tracepoint_comm->log_level_rule_len);
+ LTTNG_ASSERT(ret == tracepoint_comm->log_level_rule_len);
}
/* Skip after the log level rule. */
abort();
}
- assert(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
if (level < LTTNG_LOGLEVEL_EMERG) {
/* Invalid. */
int ret;
struct fd_handle *handle = container_of(ref, struct fd_handle, ref);
- assert(handle->fd >= 0);
+ LTTNG_ASSERT(handle->fd >= 0);
ret = close(handle->fd);
if (ret == -1) {
PERROR("Failed to close file descriptor of fd_handle upon release: fd = %d",
LTTNG_HIDDEN
int fd_handle_get_fd(struct fd_handle *handle)
{
- assert(handle);
+ LTTNG_ASSERT(handle);
return handle->fd;
}
pthread_mutex_lock(&handle->lock);
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
- assert(handle->fd >= 0);
+ LTTNG_ASSERT(handle->fd >= 0);
if (handle->in_use) {
/* This handle can't be suspended as it is currently in use. */
ret = -EAGAIN;
lttng_inode_borrow_location(
handle->inode, &node_directory_handle, &path);
- assert(handle->fd == -1);
- assert(path);
+ LTTNG_ASSERT(handle->fd == -1);
+ LTTNG_ASSERT(path);
ret = open_from_properties(
node_directory_handle, path, &handle->properties);
if (ret < 0) {
if (tracker->unsuspendable_fds) {
ret = cds_lfht_destroy(tracker->unsuspendable_fds, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
lttng_inode_registry_destroy(tracker->inode_registry);
*/
pthread_mutex_lock(&handle->tracker->lock);
pthread_mutex_lock(&handle->lock);
- assert(!handle->in_use);
+ LTTNG_ASSERT(!handle->in_use);
handle->tracker->stats.uses++;
if (handle->fd >= 0) {
if (pool->file_count == 0) {
DBG("Creating unlinked files directory at %s",
pool->unlink_directory_path);
- assert(!pool->unlink_directory_handle);
+ LTTNG_ASSERT(!pool->unlink_directory_handle);
ret = utils_mkdir(pool->unlink_directory_path,
S_IRWXU | S_IRWXG, -1, -1);
if (ret) {
inode->location.directory_handle = NULL;
reference_acquired = lttng_directory_handle_get(
pool->unlink_directory_handle);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
inode->location.directory_handle = pool->unlink_directory_handle;
free(inode->location.path);
if (inode->unlink_pending) {
int ret;
- assert(inode->location.directory_handle);
- assert(inode->location.path);
+ LTTNG_ASSERT(inode->location.directory_handle);
+ LTTNG_ASSERT(inode->location.path);
DBG("Removing %s from unlinked file pool",
inode->location.path);
ret = lttng_unlinked_file_pool_remove_inode(inode->unlinked_file_pool, inode);
return;
}
- assert(pool->file_count == 0);
+ LTTNG_ASSERT(pool->file_count == 0);
lttng_directory_handle_put(pool->unlink_directory_handle);
free(pool->unlink_directory_path);
free(pool);
const bool reference_acquired = lttng_directory_handle_get(
inode->location.directory_handle);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
}
return inode->location.directory_handle;
}
}
reference_acquired = lttng_directory_handle_get(new_directory_handle);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
lttng_directory_handle_put(inode->location.directory_handle);
free(inode->location.path);
inode->location.directory_handle = new_directory_handle;
}
reference_acquired = lttng_directory_handle_get(directory_handle);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
inode = zmalloc(sizeof(*inode));
if (!inode) {
if (registry->inodes) {
int ret = cds_lfht_destroy(registry->inodes, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
free(registry);
}
node = cds_lfht_add_unique(registry->inodes,
lttng_inode_id_hash(&inode->id), lttng_inode_match,
&inode->id, &inode->registry_node);
- assert(node == &inode->registry_node);
+ LTTNG_ASSERT(node == &inode->registry_node);
end_unlock:
rcu_read_unlock();
end:
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include <common/compat/errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include "common/bytecode/bytecode.h"
#include "filter-ast.h"
struct filter_parser_ctx *ctx = NULL;
FILE *fmem = NULL;
- assert(filter_expression);
- assert(ctxp);
+ LTTNG_ASSERT(filter_expression);
+ LTTNG_ASSERT(ctxp);
/*
* Casting const to non-const, as the underlying function will use it in
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include "filter-ast.h"
#include "filter-parser.h"
static
enum ir_load_string_type get_literal_string_type(const char *string)
{
- assert(string);
+ LTTNG_ASSERT(string);
if (strutils_is_star_glob_pattern(string)) {
if (strutils_is_star_at_the_end_only_glob_pattern(string)) {
struct filter_node *prev_node;
for (;;) {
- assert(node->type == NODE_EXPRESSION);
+ LTTNG_ASSERT(node->type == NODE_EXPRESSION);
prev_node = node;
node = node->u.expression.prev;
if (!node) {
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include <common/compat/errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include "filter-ast.h"
#include "filter-parser.h"
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include <common/compat/errno.h>
node->u.load.u.string.type;
if (type == IR_LOAD_STRING_TYPE_GLOB_STAR_END ||
type == IR_LOAD_STRING_TYPE_GLOB_STAR) {
- assert(node->u.load.u.string.value);
+ LTTNG_ASSERT(node->u.load.u.string.value);
strutils_normalize_star_glob_pattern(
node->u.load.u.string.value);
}
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include <common/compat/errno.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include <common/macros.h>
if (node->data_type == IR_DATA_STRING) {
const char *str;
- assert(node->u.load.u.string.value);
+ LTTNG_ASSERT(node->u.load.u.string.value);
str = node->u.load.u.string.value;
for (;;) {
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
-#include <assert.h>
#include <inttypes.h>
#include "filter-ast.h"
#include "filter-parser.h"
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <urcu.h>
#include <urcu/compiler.h>
* There is already an assert in the RCU hashtable code so if the ht is
* NULL here there is a *huge* problem.
*/
- assert(ht->ht);
+ LTTNG_ASSERT(ht->ht);
switch (type) {
case LTTNG_HT_TYPE_STRING:
int ret;
ret = cds_lfht_destroy(ht->ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
free(ht);
}
LTTNG_HIDDEN
void lttng_ht_node_init_str(struct lttng_ht_node_str *node, char *key)
{
- assert(node);
+ LTTNG_ASSERT(node);
node->key = key;
cds_lfht_node_init(&node->node);
void lttng_ht_node_init_ulong(struct lttng_ht_node_ulong *node,
unsigned long key)
{
- assert(node);
+ LTTNG_ASSERT(node);
node->key = key;
cds_lfht_node_init(&node->node);
void lttng_ht_node_init_u64(struct lttng_ht_node_u64 *node,
uint64_t key)
{
- assert(node);
+ LTTNG_ASSERT(node);
node->key = key;
cds_lfht_node_init(&node->node);
void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node,
uint64_t key1, uint64_t key2)
{
- assert(node);
+ LTTNG_ASSERT(node);
node->key.key1 = key1;
node->key.key2 = key2;
LTTNG_HIDDEN
void lttng_ht_node_free_str(struct lttng_ht_node_str *node)
{
- assert(node);
+ LTTNG_ASSERT(node);
free(node);
}
LTTNG_HIDDEN
void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node)
{
- assert(node);
+ LTTNG_ASSERT(node);
free(node);
}
LTTNG_HIDDEN
void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node)
{
- assert(node);
+ LTTNG_ASSERT(node);
free(node);
}
LTTNG_HIDDEN
void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node)
{
- assert(node);
+ LTTNG_ASSERT(node);
free(node);
}
void lttng_ht_lookup(struct lttng_ht *ht, const void *key,
struct lttng_ht_iter *iter)
{
- assert(ht);
- assert(ht->ht);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
cds_lfht_lookup(ht->ht, ht->hash_fct(key, lttng_ht_seed),
ht->match_fct, key, &iter->iter);
struct lttng_ht_node_str *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
node_ptr = cds_lfht_add_unique(ht->ht, ht->hash_fct(node->key, lttng_ht_seed),
ht->match_fct, node->key, &node->node);
rcu_read_unlock();
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
void lttng_ht_add_str(struct lttng_ht *ht,
struct lttng_ht_node_str *node)
{
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
LTTNG_HIDDEN
void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node)
{
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
LTTNG_HIDDEN
void lttng_ht_add_u64(struct lttng_ht *ht, struct lttng_ht_node_u64 *node)
{
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
struct lttng_ht_node_ulong *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
ht->hash_fct((void *) node->key, lttng_ht_seed), ht->match_fct,
(void *) node->key, &node->node);
rcu_read_unlock();
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
struct lttng_ht_node_u64 *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
ht->hash_fct(&node->key, lttng_ht_seed), ht->match_fct,
&node->key, &node->node);
rcu_read_unlock();
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
struct lttng_ht_node_two_u64 *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
ht->hash_fct((void *) &node->key, lttng_ht_seed), ht->match_fct,
(void *) &node->key, &node->node);
rcu_read_unlock();
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
struct lttng_ht_node_ulong *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
} else {
return caa_container_of(node_ptr, struct lttng_ht_node_ulong, node);
}
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
struct lttng_ht_node_u64 *node)
{
struct cds_lfht_node *node_ptr;
- assert(ht);
- assert(ht->ht);
- assert(node);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(node);
/* RCU read lock protects from ABA. */
rcu_read_lock();
} else {
return caa_container_of(node_ptr, struct lttng_ht_node_u64, node);
}
- assert(node_ptr == &node->node);
+ LTTNG_ASSERT(node_ptr == &node->node);
}
/*
{
int ret;
- assert(ht);
- assert(ht->ht);
- assert(iter);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(iter);
/* RCU read lock protects from ABA. */
rcu_read_lock();
LTTNG_HIDDEN
void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_ht_iter *iter)
{
- assert(ht);
- assert(ht->ht);
- assert(iter);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(iter);
cds_lfht_first(ht->ht, &iter->iter);
}
LTTNG_HIDDEN
void lttng_ht_get_next(struct lttng_ht *ht, struct lttng_ht_iter *iter)
{
- assert(ht);
- assert(ht->ht);
- assert(iter);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
+ LTTNG_ASSERT(iter);
cds_lfht_next(ht->ht, &iter->iter);
}
long scb, sca;
unsigned long count;
- assert(ht);
- assert(ht->ht);
+ LTTNG_ASSERT(ht);
+ LTTNG_ASSERT(ht->ht);
/* RCU read lock protects from ABA and allows RCU traversal. */
rcu_read_lock();
{
struct cds_lfht_node *node;
- assert(iter);
+ LTTNG_ASSERT(iter);
node = cds_lfht_iter_get_node(&iter->iter);
if (!node) {
return NULL;
{
struct cds_lfht_node *node;
- assert(iter);
+ LTTNG_ASSERT(iter);
node = cds_lfht_iter_get_node(&iter->iter);
if (!node) {
return NULL;
{
struct cds_lfht_node *node;
- assert(iter);
+ LTTNG_ASSERT(iter);
node = cds_lfht_iter_get_node(&iter->iter);
if (!node) {
return NULL;
{
struct cds_lfht_node *node;
- assert(iter);
+ LTTNG_ASSERT(iter);
node = cds_lfht_iter_get_node(&iter->iter);
if (!node) {
return NULL;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdint.h> /* defines uint32_t etc */
#include <stdio.h> /* defines printf for tests */
#include <string.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
unsigned long current, last;
struct timespec current_time;
- assert(state);
+ LTTNG_ASSERT(state);
last = state->last;
current = uatomic_read(&state->current);
int retval = 1;
struct health_state *state;
- assert(type < ha->nr_types);
+ LTTNG_ASSERT(type < ha->nr_types);
state_lock(ha);
*/
void health_register(struct health_app *ha, int type)
{
- assert(type < ha->nr_types);
+ LTTNG_ASSERT(type < ha->nr_types);
/* Init TLS state. */
uatomic_set(&URCU_TLS(health_state).last, 0);
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <urcu.h>
enum lttng_index_allocator_status status =
LTTNG_INDEX_ALLOCATOR_STATUS_OK;
- assert(idx < allocator->size);
+ LTTNG_ASSERT(idx < allocator->size);
index = zmalloc(sizeof(*index));
if (!index) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
const bool acquired_reference = lttng_trace_chunk_get(chunk);
const char *separator;
- assert(acquired_reference);
+ LTTNG_ASSERT(acquired_reference);
index_file = zmalloc(sizeof(*index_file));
if (!index_file) {
ssize_t ret;
const size_t len = index_file->element_len;;
- assert(index_file);
- assert(element);
+ LTTNG_ASSERT(index_file);
+ LTTNG_ASSERT(element);
if (!index_file->file) {
goto error;
ssize_t ret;
const size_t len = index_file->element_len;
- assert(element);
+ LTTNG_ASSERT(element);
if (!index_file->file) {
goto error;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <poll.h>
#include <pthread.h>
#include <stdlib.h>
int lttng_kconsumer_sample_snapshot_positions(
struct lttng_consumer_stream *stream)
{
- assert(stream);
+ LTTNG_ASSERT(stream);
return kernctl_snapshot_sample_positions(stream->wait_fd);
}
*/
pthread_mutex_lock(&stream->lock);
- assert(channel->trace_chunk);
+ LTTNG_ASSERT(channel->trace_chunk);
if (!lttng_trace_chunk_get(channel->trace_chunk)) {
/*
* Can't happen barring an internal error as the channel
ret = -1;
goto end_unlock;
}
- assert(!stream->trace_chunk);
+ LTTNG_ASSERT(!stream->trace_chunk);
stream->trace_chunk = channel->trace_chunk;
/*
ssize_t ret_read;
struct lttng_consumer_stream *metadata_stream;
- assert(ctx);
+ LTTNG_ASSERT(ctx);
DBG("Kernel consumer snapshot metadata with key %" PRIu64 " at path %s",
key, path);
rcu_read_lock();
metadata_stream = metadata_channel->metadata_stream;
- assert(metadata_stream);
+ LTTNG_ASSERT(metadata_stream);
pthread_mutex_lock(&metadata_stream->lock);
- assert(metadata_channel->trace_chunk);
- assert(metadata_stream->trace_chunk);
+ LTTNG_ASSERT(metadata_channel->trace_chunk);
+ LTTNG_ASSERT(metadata_stream->trace_chunk);
/* Flag once that we have a valid relayd for the stream. */
if (relayd_id != (uint64_t) -1ULL) {
health_code_update();
/* Deprecated command */
- assert(msg.cmd_type != LTTNG_CONSUMER_STOP);
+ LTTNG_ASSERT(msg.cmd_type != LTTNG_CONSUMER_STOP);
health_code_update();
new_channel->type = msg.u.channel.type;
break;
default:
- assert(0);
+ abort();
goto end_nosignal;
};
* This command should ONLY be issued for channel with streams set in
* no monitor mode.
*/
- assert(!channel->monitor);
+ LTTNG_ASSERT(!channel->monitor);
/*
* The refcount should ALWAYS be 0 in the case of a channel in no
* monitor mode.
*/
- assert(!uatomic_sub_return(&channel->refcount, 1));
+ LTTNG_ASSERT(!uatomic_sub_return(&channel->refcount, 1));
consumer_del_channel(channel);
end_destroy_channel:
int ret;
enum sync_metadata_status status;
- assert(metadata);
+ LTTNG_ASSERT(metadata);
ret = kernctl_buffer_flush(metadata->wait_fd);
if (ret < 0) {
{
int ret;
- assert(stream);
+ LTTNG_ASSERT(stream);
/*
* Don't create anything if this is set for streaming or if there is
int err;
err = close(stream->out_fd);
- assert(!err);
+ LTTNG_ASSERT(!err);
stream->out_fd = -1;
}
error:
{
int ret;
- assert(stream);
+ LTTNG_ASSERT(stream);
if (stream->endpoint_status != CONSUMER_ENDPOINT_ACTIVE) {
ret = 0;
if (ret == 0) {
/* There is still data so let's put back this subbuffer. */
ret = kernctl_put_subbuf(stream->wait_fd);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = 1; /* Data is pending */
goto end;
}
#include <common/macros.h>
#include <common/compat/errno.h>
#include <stdarg.h>
-#include <assert.h>
#include <common/time.h>
#include "kernel-ctl.h"
#define LTTNG_IOCTL_CHECK(fildes, request, ...) \
({ \
int _ioctl_ret = ioctl(fildes, request, ##__VA_ARGS__); \
- assert(_ioctl_ret <= 0); \
+ LTTNG_ASSERT(_ioctl_ret <= 0); \
!_ioctl_ret ? 0 : -errno; \
})
*/
#include "lttng/lttng-error.h"
-#include <assert.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
#include <common/hashtable/utils.h>
void lttng_kernel_probe_location_address_destroy(
struct lttng_kernel_probe_location *location)
{
- assert(location);
+ LTTNG_ASSERT(location);
free(location);
}
{
struct lttng_kernel_probe_location_symbol *location_symbol = NULL;
- assert(location);
+ LTTNG_ASSERT(location);
location_symbol = container_of(location,
struct lttng_kernel_probe_location_symbol,
parent);
- assert(location_symbol);
+ LTTNG_ASSERT(location_symbol);
free(location_symbol->symbol_name);
free(location);
LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
struct lttng_kernel_probe_location_address *address_location;
- assert(offset);
+ LTTNG_ASSERT(offset);
if (!location || lttng_kernel_probe_location_get_type(location) !=
LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) {
LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
struct lttng_kernel_probe_location_symbol *symbol_location;
- assert(offset);
+ LTTNG_ASSERT(offset);
if (!location || lttng_kernel_probe_location_get_type(location) !=
LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
goto end;
}
- assert(lttng_kernel_probe_location_get_type(location) ==
+ LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
original_payload_size = payload->buffer.size;
struct lttng_kernel_probe_location_address *location_address;
struct lttng_kernel_probe_location_address_comm location_address_comm;
- assert(location);
- assert(lttng_kernel_probe_location_get_type(location) ==
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
original_payload_size = payload->buffer.size;
ssize_t ret = 0;
size_t expected_size;
- assert(location);
+ LTTNG_ASSERT(location);
if (view->buffer.size < sizeof(*location_symbol_comm)) {
ret = -LTTNG_ERR_INVALID;
ssize_t ret = 0;
size_t expected_size;
- assert(location);
+ LTTNG_ASSERT(location);
expected_size = sizeof(*location_address_comm);
lttng_payload_view_from_view(
view, 0, sizeof(*probe_location_comm));
- assert(view);
- assert(location);
+ LTTNG_ASSERT(view);
+ LTTNG_ASSERT(location);
if (!lttng_payload_view_is_valid(&probe_location_comm_view)) {
ret = -LTTNG_ERR_INVALID;
b = container_of(_b, struct lttng_kernel_probe_location_symbol,
parent);
- assert(a->symbol_name);
- assert(b->symbol_name);
+ LTTNG_ASSERT(a->symbol_name);
+ LTTNG_ASSERT(b->symbol_name);
if (strcmp(a->symbol_name, b->symbol_name)) {
goto end;
}
const char *symbol_name = NULL;
uint64_t offset;
- assert(location);
- assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
symbol_location = container_of(
location, typeof(*symbol_location), parent);
enum lttng_kernel_probe_location_status status;
uint64_t address;
- assert(location);
- assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
address_location = container_of(
location, typeof(*address_location), parent);
enum lttng_kernel_probe_location_status status;
uint64_t address;
- assert(location);
- assert(writer);
- assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
status = lttng_kernel_probe_location_address_get_address(
location, &address);
- assert(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
/* Open kernel probe location address element. */
ret = mi_lttng_writer_open_element(
const char *name = NULL;
uint64_t offset;
- assert(location);
- assert(writer);
- assert(location->type ==
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
+ LTTNG_ASSERT(location->type ==
LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
name = lttng_kernel_probe_location_symbol_get_name(location);
- assert(name);
+ LTTNG_ASSERT(name);
status = lttng_kernel_probe_location_symbol_get_offset(
location, &offset);
- assert(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
/* Open kernel probe location symbol offset element. */
ret = mi_lttng_writer_open_element(writer,
int ret;
enum lttng_error_code ret_code;
- assert(location);
- assert(writer);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
/* Open kernel probe location element. */
ret = mi_lttng_writer_open_element(
*
*/
-#include <assert.h>
#include <common/dynamic-buffer.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
{
struct lttng_log_level_rule *copy = NULL;
- assert(source);
+ LTTNG_ASSERT(source);
copy = zmalloc(sizeof(struct lttng_log_level_rule));
if (!copy) {
enum lttng_loglevel_type *loglevel_type,
int *loglevel_value)
{
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
switch (log_level_rule->type) {
case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
int log_level_value;
enum lttng_log_level_rule_type type;
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
type = lttng_log_level_rule_get_type(log_level_rule);
break;
}
- assert(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(llr_status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
hash = hash_key_ulong((void *) (unsigned long) type, lttng_ht_seed);
const char *element_str = NULL;
int level;
- assert(rule);
- assert(writer);
+ LTTNG_ASSERT(rule);
+ LTTNG_ASSERT(writer);
switch (lttng_log_level_rule_get_type(rule)) {
case LTTNG_LOG_LEVEL_RULE_TYPE_EXACTLY:
break;
}
- assert(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_LOG_LEVEL_RULE_STATUS_OK);
/* Open log level rule element. */
ret = mi_lttng_writer_open_element(
#define member_sizeof(type, field) sizeof(((type *) 0)->field)
-#define ASSERT_LOCKED(lock) assert(pthread_mutex_trylock(&lock))
+#define ASSERT_LOCKED(lock) LTTNG_ASSERT(pthread_mutex_trylock(&lock))
/*
* Get an aligned pointer to a value. This is meant
return 0;
}
+#ifdef NDEBUG
+/*
+* Force usage of the assertion condition to prevent unused variable warnings
+* when `assert()` are disabled by the `NDEBUG` definition.
+*/
+# define LTTNG_ASSERT(_cond) ((void) sizeof((void) (_cond), 0))
+#else
+# include <assert.h>
+# define LTTNG_ASSERT(_cond) assert(_cond)
+#endif
+
#endif /* _MACROS_H */
#include <lttng/channel.h>
#include <lttng/snapshot-internal.h>
-#include <assert.h>
#define MI_SCHEMA_MAJOR_VERSION 4
#define MI_SCHEMA_MINOR_VERSION 1
return config_domain_type_python;
default:
/* Should not have an unknown domain */
- assert(0);
+ abort();
return NULL;
}
}
return config_buffer_type_global;
default:
/* Should not have an unknow buffer type */
- assert(0);
+ abort();
return NULL;
}
}
return mi_lttng_rotation_state_str_error;
default:
/* Should not have an unknow rotation state. */
- assert(0);
+ abort();
return NULL;
}
}
return mi_lttng_rotation_location_relay_protocol_str_tcp;
default:
/* Should not have an unknown relay protocol. */
- assert(0);
+ abort();
return NULL;
}
}
{
int ret;
- assert(session);
+ LTTNG_ASSERT(session);
/* Open sessions element */
ret = mi_lttng_writer_open_element(writer,
const char *str_domain;
const char *str_buffer;
- assert(domain);
+ LTTNG_ASSERT(domain);
/* Open domain element */
ret = mi_lttng_writer_open_element(writer, config_element_domain);
{
int ret = 0;
- assert(channel);
+ LTTNG_ASSERT(channel);
/* Opening channel element */
ret = mi_lttng_writer_open_element(writer, config_element_channel);
uint64_t discarded_events, lost_packets, monitor_timer_interval;
int64_t blocking_timeout;
- assert(attr);
+ LTTNG_ASSERT(attr);
ret = lttng_channel_get_discarded_event_count(chan, &discarded_events);
if (ret) {
#include <lttng/trigger/trigger-internal.h>
#include <common/payload.h>
#include <common/payload-view.h>
-#include <assert.h>
LTTNG_HIDDEN
struct lttng_notification *lttng_notification_create(
#define LTTNG_OPTIONAL_H
#include <stdint.h>
-#include <assert.h>
/*
* Define wrapper structure representing an optional value.
/*
* This macro is available as a 'convenience' to allow sites that assume
- * an optional value is set to assert() that it is set when accessing it.
+ * an optional value is set to LTTNG_ASSERT() that it is set when accessing it.
*
* Since this returns the 'optional' by value, it is not suitable for all
* wrapped optional types. It is meant to be used with PODs.
*/
#define LTTNG_OPTIONAL_GET(optional) \
({ \
- assert((optional).is_set); \
+ LTTNG_ASSERT((optional).is_set); \
(optional).value; \
})
/*
* This macro is available as a 'convenience' to allow sites that assume
- * an optional value is set to assert() that it is set when fecthing the
+ * an optional value is set to LTTNG_ASSERT() that it is set when fecthing the
* underlying value's address.
*/
#define LTTNG_OPTIONAL_GET_PTR(optional) \
({ \
- assert((optional).is_set); \
+ LTTNG_ASSERT((optional).is_set); \
&(optional).value; \
})
LTTNG_HIDDEN
void lttng_payload_init(struct lttng_payload *payload)
{
- assert(payload);
+ LTTNG_ASSERT(payload);
lttng_dynamic_buffer_init(&payload->buffer);
lttng_dynamic_pointer_array_init(&payload->_fd_handles,
release_fd_handle_ref);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
{
int ret, ret_val = 0;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
if (!lttng_pipe_is_read_open(pipe)) {
goto end;
{
int ret, ret_val = 0;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
if (!lttng_pipe_is_write_open(pipe)) {
goto end;
{
int ret;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
/* Handle read side first. */
lock_read_side(pipe);
{
int ret;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
lock_write_side(pipe);
ret = _pipe_write_close(pipe);
{
int ret, ret_val = 0;
- assert(pipe);
+ LTTNG_ASSERT(pipe);
ret = lttng_pipe_read_close(pipe);
if (ret < 0) {
* succeed so we unlock them after the close pipe below.
*/
ret = pthread_mutex_trylock(&pipe->read_mutex);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = pthread_mutex_trylock(&pipe->write_mutex);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
/* Close pipes WITHOUT trying to lock the pipes. */
(void) _pipe_read_close(pipe);
{
ssize_t ret;
- assert(pipe);
- assert(buf);
+ LTTNG_ASSERT(pipe);
+ LTTNG_ASSERT(buf);
lock_read_side(pipe);
if (!lttng_pipe_is_read_open(pipe)) {
{
ssize_t ret;
- assert(pipe);
- assert(buf);
+ LTTNG_ASSERT(pipe);
+ LTTNG_ASSERT(buf);
lock_write_side(pipe);
if (!lttng_pipe_is_write_open(pipe)) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <limits.h>
#include <unistd.h>
size_t i = 0;
ssize_t ret;
- assert(buf);
+ LTTNG_ASSERT(buf);
/*
* Deny a read count that can be bigger then the returned value max size.
}
}
i += ret;
- assert(i <= count);
+ LTTNG_ASSERT(i <= count);
} while (count - i > 0 && ret > 0);
return i;
size_t i = 0;
ssize_t ret;
- assert(buf);
+ LTTNG_ASSERT(buf);
/*
* Deny a write count that can be bigger then the returned value max size.
}
}
i += ret;
- assert(i <= count);
+ LTTNG_ASSERT(i <= count);
} while (count - i > 0 && ret > 0);
return i;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
goto error;
}
- assert(session_name_len <= UINT32_MAX);
+ LTTNG_ASSERT(session_name_len <= UINT32_MAX);
msg->session_name_len = htobe32(session_name_len);
- assert(hostname_len <= UINT32_MAX);
+ LTTNG_ASSERT(hostname_len <= UINT32_MAX);
msg->hostname_len = htobe32(hostname_len);
- assert(base_path_len <= UINT32_MAX);
+ LTTNG_ASSERT(base_path_len <= UINT32_MAX);
msg->base_path_len = htobe32(base_path_len);
dst = msg->names;
int ret;
struct lttcomm_relayd_create_session_reply_2_11 reply = {};
- assert(rsock);
- assert(relayd_session_id);
+ LTTNG_ASSERT(rsock);
+ LTTNG_ASSERT(relayd_session_id);
DBG("Relayd create session");
goto error;
}
- assert(channel_name_len <= UINT32_MAX);
+ LTTNG_ASSERT(channel_name_len <= UINT32_MAX);
msg->channel_name_len = htobe32(channel_name_len);
- assert(pathname_len <= UINT32_MAX);
+ LTTNG_ASSERT(pathname_len <= UINT32_MAX);
msg->pathname_len = htobe32(pathname_len);
if (lttng_strncpy(msg->names, channel_name, channel_name_len)) {
char pathname[RELAYD_COMM_LTTNG_PATH_MAX];
/* Code flow error. Safety net. */
- assert(rsock);
- assert(channel_name);
- assert(domain_name);
- assert(_pathname);
- assert(trace_chunk);
+ LTTNG_ASSERT(rsock);
+ LTTNG_ASSERT(channel_name);
+ LTTNG_ASSERT(domain_name);
+ LTTNG_ASSERT(_pathname);
+ LTTNG_ASSERT(trace_chunk);
DBG("Relayd adding stream for channel name %s", channel_name);
chunk_status = lttng_trace_chunk_get_id(trace_chunk,
&chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ LTTNG_ASSERT(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
/* From 2.11 to ...*/
ret = relayd_add_stream_2_11(rsock, channel_name, pathname,
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd sending streams sent.");
struct lttcomm_relayd_version msg;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd version check for major.minor %u.%u", rsock->major,
rsock->minor);
int ret;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd sending metadata of size %zu", len);
int relayd_connect(struct lttcomm_relayd_sock *rsock)
{
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
if (!rsock->sock.ops) {
/*
int ret;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
/* An invalid fd is fine, return success. */
if (rsock->sock.fd < 0) {
int ret;
/* Code flow error. Safety net. */
- assert(rsock);
- assert(hdr);
+ LTTNG_ASSERT(rsock);
+ LTTNG_ASSERT(hdr);
if (rsock->sock.fd < 0) {
return -ECONNRESET;
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd closing stream id %" PRIu64, stream_id);
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd data pending for stream id %" PRIu64, stream_id);
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd checking quiescent control state");
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd begin data pending");
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
DBG("Relayd end data pending");
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
if (rsock->minor < 4) {
DBG("Not sending indexes before protocol 2.4");
struct lttcomm_relayd_generic_reply reply;
/* Code flow error. Safety net. */
- assert(rsock);
+ LTTNG_ASSERT(rsock);
/* Should have been prevented by the sessiond. */
if (rsock->minor < 8) {
lttng_dynamic_buffer_init(&payload);
/* Code flow error. Safety net. */
- assert(sock);
+ LTTNG_ASSERT(sock);
if (new_chunk_id) {
ret = snprintf(new_chunk_id_buf, sizeof(new_chunk_id_buf),
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <fcntl.h>
#include <grp.h>
#include <limits.h>
struct run_as_ret recvret;
struct run_as_worker *worker;
- assert(!global_worker);
+ LTTNG_ASSERT(!global_worker);
if (!use_clone()) {
/*
* Don't initialize a worker, all run_as tasks will be performed
if (use_clone()) {
DBG("Using run_as worker");
- assert(global_worker);
+ LTTNG_ASSERT(global_worker);
ret = run_as_cmd(global_worker, cmd, data, ret_value, uid, gid);
saved_errno = ret_value->_errno;
#include <common/defaults.h>
#include <common/error.h>
#include <time.h>
-#include <assert.h>
#include <stdio.h>
struct lttng_session_descriptor_network_location {
goto end;
}
}
- assert(descriptor->name);
+ LTTNG_ASSERT(descriptor->name);
ret = snprintf(local_uri, sizeof(local_uri),
"file://%s/%s/%s%s",
absolute_home_path,
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
}
iov[0].iov_base += ret;
iov[0].iov_len -= ret;
- assert(ret <= len_last);
+ LTTNG_ASSERT(ret <= len_last);
}
} while ((ret > 0 && ret < len_last) || (ret < 0 && errno == EINTR));
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
}
iov[0].iov_base += ret;
iov[0].iov_len -= ret;
- assert(ret <= len_last);
+ LTTNG_ASSERT(ret <= len_last);
}
} while ((ret > 0 && ret < len_last) || (ret < 0 && errno == EINTR));
if (ret < 0) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
{
int ret, _sock_type, _sock_proto, domain;
- assert(sock);
+ LTTNG_ASSERT(sock);
domain = sock->sockaddr.type;
if (domain != LTTCOMM_INET && domain != LTTCOMM_INET6) {
struct lttcomm_sock *sock;
/* Safety net */
- assert(src);
+ LTTNG_ASSERT(src);
sock = lttcomm_alloc_sock(src->proto);
if (sock == NULL) {
void lttcomm_copy_sock(struct lttcomm_sock *dst, struct lttcomm_sock *src)
{
/* Safety net */
- assert(dst);
- assert(src);
+ LTTNG_ASSERT(dst);
+ LTTNG_ASSERT(src);
dst->proto = src->proto;
dst->fd = src->fd;
{
int ret;
- assert(sockaddr);
- assert(ip);
- assert(port > 0 && port <= 65535);
+ LTTNG_ASSERT(sockaddr);
+ LTTNG_ASSERT(ip);
+ LTTNG_ASSERT(port > 0 && port <= 65535);
memset(sockaddr, 0, sizeof(struct lttcomm_sockaddr));
{
int ret;
- assert(sockaddr);
- assert(ip);
- assert(port > 0 && port <= 65535);
+ LTTNG_ASSERT(sockaddr);
+ LTTNG_ASSERT(ip);
+ LTTNG_ASSERT(port > 0 && port <= 65535);
memset(sockaddr, 0, sizeof(struct lttcomm_sockaddr));
struct lttcomm_sock *sock = NULL;
/* Safety net */
- assert(uri);
+ LTTNG_ASSERT(uri);
/* Check URI protocol */
if (uri->proto == LTTNG_TCP) {
struct lttcomm_sock *tmp_sock = NULL;
struct lttcomm_relayd_sock *rsock = NULL;
- assert(uri);
+ LTTNG_ASSERT(uri);
rsock = zmalloc(sizeof(*rsock));
if (!rsock) {
LTTNG_HIDDEN
int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port)
{
- assert(sock);
- assert(port);
- assert(sock->sockaddr.type == LTTCOMM_INET ||
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(port);
+ LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET ||
sock->sockaddr.type == LTTCOMM_INET6);
- assert(sock->proto == LTTCOMM_SOCK_TCP ||
+ LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP ||
sock->proto == LTTCOMM_SOCK_UDP);
switch (sock->sockaddr.type) {
LTTNG_HIDDEN
int lttcomm_sock_set_port(struct lttcomm_sock *sock, uint16_t port)
{
- assert(sock);
- assert(sock->sockaddr.type == LTTCOMM_INET ||
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(sock->sockaddr.type == LTTCOMM_INET ||
sock->sockaddr.type == LTTCOMM_INET6);
- assert(sock->proto == LTTCOMM_SOCK_TCP ||
+ LTTNG_ASSERT(sock->proto == LTTCOMM_SOCK_TCP ||
sock->proto == LTTCOMM_SOCK_UDP);
switch (sock->sockaddr.type) {
int wait_shm_fd, ret;
mode_t mode;
- assert(shm_path);
+ LTTNG_ASSERT(shm_path);
/* Default permissions */
mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
char *wait_shm_mmap;
long sys_page_size;
- assert(shm_path);
+ LTTNG_ASSERT(shm_path);
sys_page_size = sysconf(_SC_PAGE_SIZE);
if (sys_page_size < 0) {
#include <lttng/snapshot-internal.h>
#include <lttng/snapshot.h>
-#include <assert.h>
#include <stdlib.h>
LTTNG_HIDDEN
{
bool equal = false;
- assert(a);
- assert(b);
+ LTTNG_ASSERT(a);
+ LTTNG_ASSERT(b);
if (a->max_size != b->max_size) {
goto end;
int ret;
enum lttng_error_code ret_code;
- assert(output);
- assert(writer);
+ LTTNG_ASSERT(output);
+ LTTNG_ASSERT(writer);
/* Open output element. */
ret = mi_lttng_writer_open_element(writer,
*
*/
-#include <assert.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <sys/types.h>
* This function should never return if successfull because `execvp(3)`
* onle returns if an error has occurred.
*/
- assert(ret != 0);
+ LTTNG_ASSERT(ret != 0);
error:
free(argv);
return ret;
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
-#include <assert.h>
#include "string-utils.h"
#include "../macros.h"
char *np;
bool got_star = false;
- assert(pattern);
+ LTTNG_ASSERT(pattern);
for (p = pattern, np = pattern; *p != '\0'; p++) {
switch (*p) {
STAR_GLOB_PATTERN_TYPE_FLAG_NONE;
const char *p;
- assert(pattern);
+ LTTNG_ASSERT(pattern);
for (p = pattern; *p != '\0'; p++) {
switch (*p) {
char *o;
const char *i;
- assert(input);
+ LTTNG_ASSERT(input);
output = zmalloc(strlen(input) + 1);
if (!output) {
goto end;
const char *s;
const char *last;
- assert(input);
- assert(!(escape_delim && delim == '\\'));
- assert(delim != '\0');
+ LTTNG_ASSERT(input);
+ LTTNG_ASSERT(!(escape_delim && delim == '\\'));
+ LTTNG_ASSERT(delim != '\0');
lttng_dynamic_pointer_array_init(out_strings, free);
/* First pass: count the number of substrings. */
char * const *item;
size_t count = 0;
- assert(array);
+ LTTNG_ASSERT(array);
for (item = array; *item; item++) {
count++;
bool reference_acquired;
char *path_copy = strdup(path);
- assert(fd >= 0);
+ LTTNG_ASSERT(fd >= 0);
if (!path_copy) {
PERROR("Failed to copy file path while creating untracked filesystem handle");
goto end;
handle->fd = fd;
reference_acquired = lttng_directory_handle_get(directory_handle);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
handle->location.directory_handle = directory_handle;
/* Ownership is transferred. */
handle->location.path = path_copy;
void lttng_trace_chunk_set_fd_tracker(struct lttng_trace_chunk *chunk,
struct fd_tracker *fd_tracker)
{
- assert(!chunk->session_output_directory);
- assert(!chunk->chunk_directory);
- assert(lttng_dynamic_pointer_array_get_count(&chunk->files) == 0);
+ LTTNG_ASSERT(!chunk->session_output_directory);
+ LTTNG_ASSERT(!chunk->chunk_directory);
+ LTTNG_ASSERT(lttng_dynamic_pointer_array_get_count(&chunk->files) == 0);
chunk->fd_tracker = fd_tracker;
}
const bool reference_acquired = lttng_directory_handle_get(
source_chunk->session_output_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
new_chunk->session_output_directory =
source_chunk->session_output_directory;
}
const bool reference_acquired = lttng_directory_handle_get(
source_chunk->chunk_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
new_chunk->chunk_directory = source_chunk->chunk_directory;
}
new_chunk->close_command = source_chunk->close_command;
const bool reference_acquired = lttng_directory_handle_get(
chunk->session_output_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
rename_directory = chunk->session_output_directory;
/* Move toplevel directories. */
reference_acquired = lttng_directory_handle_get(
session_output_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
chunk_directory_handle = session_output_directory;
}
chunk->chunk_directory = chunk_directory_handle;
chunk_directory_handle = NULL;
reference_acquired = lttng_directory_handle_get(
session_output_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
chunk->session_output_directory = session_output_directory;
LTTNG_OPTIONAL_SET(&chunk->mode, TRACE_CHUNK_MODE_OWNER);
end:
goto end;
}
reference_acquired = lttng_directory_handle_get(chunk_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
chunk->chunk_directory = chunk_directory;
LTTNG_OPTIONAL_SET(&chunk->mode, TRACE_CHUNK_MODE_USER);
end:
const bool reference_acquired = lttng_directory_handle_get(
chunk->session_output_directory);
- assert(reference_acquired);
+ LTTNG_ASSERT(reference_acquired);
*handle = chunk->session_output_directory;
}
end:
}
ret = lttng_dynamic_pointer_array_remove_pointer(
&chunk->files, index);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
static
goto end;
}
if (chunk->fd_tracker) {
- assert(chunk->credentials.value.use_current_user);
+ LTTNG_ASSERT(chunk->credentials.value.use_current_user);
*out_handle = fd_tracker_open_fs_handle(chunk->fd_tracker,
chunk->chunk_directory, file_path, flags, &mode);
ret = *out_handle ? 0 : -1;
* Using this method is never valid when an fd_tracker is being
* used since the resulting file descriptor would not be tracked.
*/
- assert(!chunk->fd_tracker);
+ LTTNG_ASSERT(!chunk->fd_tracker);
status = _lttng_trace_chunk_open_fs_handle_locked(chunk, file_path,
flags, mode, &fs_handle, expect_no_file);
pthread_mutex_unlock(&chunk->lock);
goto end;
}
- assert(trace_chunk->mode.value == TRACE_CHUNK_MODE_OWNER);
- assert(!trace_chunk->name_overridden);
- assert(trace_chunk->path);
+ LTTNG_ASSERT(trace_chunk->mode.value == TRACE_CHUNK_MODE_OWNER);
+ LTTNG_ASSERT(!trace_chunk->name_overridden);
+ LTTNG_ASSERT(trace_chunk->path);
archived_chunk_name = generate_chunk_name(chunk_id, creation_timestamp,
&close_timestamp);
DBG("Trace chunk \"delete\" close command post-release (Owner)");
- assert(trace_chunk->session_output_directory);
- assert(trace_chunk->chunk_directory);
+ LTTNG_ASSERT(trace_chunk->session_output_directory);
+ LTTNG_ASSERT(trace_chunk->chunk_directory);
/* Remove empty directories. */
count = lttng_dynamic_pointer_array_get_count(
if (!chunk) {
return;
}
- assert(chunk->ref.refcount);
+ LTTNG_ASSERT(chunk->ref.refcount);
urcu_ref_put(&chunk->ref, lttng_trace_chunk_release);
}
}
if (registry->ht) {
int ret = cds_lfht_destroy(registry->ht, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
}
free(registry);
}
*
*/
-#include <assert.h>
#include <common/credentials.h>
#include <common/dynamic-array.h>
#include <common/error.h>
struct lttng_condition *condition =
lttng_trigger_get_condition(trigger);
- assert(action);
- assert(condition);
+ LTTNG_ASSERT(action);
+ LTTNG_ASSERT(condition);
/* Release ownership. */
lttng_action_put(action);
const struct lttng_credentials *creds = NULL;
creds = lttng_trigger_get_credentials(trigger);
- assert(creds);
+ LTTNG_ASSERT(creds);
trigger_comm.uid = LTTNG_OPTIONAL_GET(creds->uid);
LTTNG_HIDDEN
void lttng_trigger_set_hidden(struct lttng_trigger *trigger)
{
- assert(!trigger->is_hidden);
+ LTTNG_ASSERT(!trigger->is_hidden);
trigger->is_hidden = true;
}
void lttng_trigger_set_tracer_token(struct lttng_trigger *trigger,
uint64_t token)
{
- assert(trigger);
+ LTTNG_ASSERT(trigger);
LTTNG_OPTIONAL_SET(&trigger->tracer_token, token);
}
LTTNG_HIDDEN
uint64_t lttng_trigger_get_tracer_token(const struct lttng_trigger *trigger)
{
- assert(trigger);
+ LTTNG_ASSERT(trigger);
return LTTNG_OPTIONAL_GET(trigger->tracer_token);
}
{
struct lttng_trigger *trigger = NULL;
- assert(triggers);
+ LTTNG_ASSERT(triggers);
if (index >= lttng_dynamic_pointer_array_get_count(&triggers->array)) {
goto end;
}
{
int ret;
- assert(triggers);
- assert(trigger);
+ LTTNG_ASSERT(triggers);
+ LTTNG_ASSERT(trigger);
lttng_trigger_get(trigger);
unsigned int trigger_count, i = 0;
enum lttng_trigger_status trigger_status;
- assert(triggers);
+ LTTNG_ASSERT(triggers);
trigger_status = lttng_triggers_get_count(triggers, &trigger_count);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
while (i < trigger_count) {
const struct lttng_trigger *trigger =
const struct lttng_trigger *trigger =
lttng_triggers_get_at_index(triggers, i);
- assert(trigger);
+ LTTNG_ASSERT(trigger);
ret = lttng_trigger_serialize(trigger, payload);
if (ret) {
void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
const struct lttng_credentials *creds)
{
- assert(creds);
+ LTTNG_ASSERT(creds);
trigger->creds = *creds;
}
enum lttng_condition_status c_status;
enum lttng_condition_type c_type;
- assert(trigger);
- assert(trigger->condition);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(trigger->condition);
c_type = lttng_condition_get_type(trigger->condition);
assert (c_type != LTTNG_CONDITION_TYPE_UNKNOWN);
/* Return the domain of the event rule. */
c_status = lttng_condition_event_rule_matches_get_rule(
trigger->condition, &event_rule);
- assert(c_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
type = lttng_event_rule_get_domain_type(event_rule);
break;
case LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH:
/* Return the domain of the channel being monitored. */
c_status = lttng_condition_buffer_usage_get_domain_type(
trigger->condition, &type);
- assert(c_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(c_status == LTTNG_CONDITION_STATUS_OK);
break;
default:
abort();
lttng_condition_event_rule_matches_borrow_rule_mutable(
condition, &event_rule);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
/* Generate the filter bytecode. */
ret = lttng_event_rule_generate_filter_bytecode(
struct lttng_dynamic_array action_path_indexes;
uid_t owner_uid;
- assert(trigger);
- assert(writer);
+ LTTNG_ASSERT(trigger);
+ LTTNG_ASSERT(writer);
lttng_dynamic_array_init(&action_path_indexes, sizeof(uint64_t), NULL);
}
trigger_status = lttng_trigger_get_owner_uid(trigger, &owner_uid);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
/* Name. */
ret = mi_lttng_writer_write_element_string(
/* Condition. */
condition = lttng_trigger_get_const_condition(trigger);
- assert(condition);
+ LTTNG_ASSERT(condition);
ret_code = lttng_condition_mi_serialize(
trigger, condition, writer, error_query_callbacks);
if (ret_code != LTTNG_OK) {
/* Action. */
action = lttng_trigger_get_const_action(trigger);
- assert(action);
+ LTTNG_ASSERT(action);
ret_code = lttng_action_mi_serialize(trigger, action, writer,
error_query_callbacks, &action_path_indexes);
if (ret_code != LTTNG_OK) {
/* Anonymous triggers are not reachable here. */
trigger_status = lttng_trigger_get_name(trigger_a, &name_a);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
trigger_status = lttng_trigger_get_name(trigger_b, &name_b);
- assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(trigger_status == LTTNG_TRIGGER_STATUS_OK);
return strcmp(name_a, name_b);
}
unsigned int count, i;
struct lttng_dynamic_pointer_array sorted_triggers;
- assert(triggers);
- assert(writer);
+ LTTNG_ASSERT(triggers);
+ LTTNG_ASSERT(writer);
/*
* Sort trigger by name to ensure an order at the MI level and ignore
lttng_dynamic_pointer_array_init(&sorted_triggers, NULL);
status = lttng_triggers_get_count(triggers, &count);
- assert(status == LTTNG_TRIGGER_STATUS_OK);
+ LTTNG_ASSERT(status == LTTNG_TRIGGER_STATUS_OK);
for (i = 0; i < count; i++) {
int add_ret;
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
ssize_t ret = -1;
size_t len_last;
- assert(sock);
- assert(buf);
- assert(len > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
memset(&msg, 0, sizeof(msg));
if (ret > 0) {
iov[0].iov_base += ret;
iov[0].iov_len -= ret;
- assert(ret <= len_last);
+ LTTNG_ASSERT(ret <= len_last);
}
} while ((ret > 0 && ret < len_last) || (ret < 0 && errno == EINTR));
if (ret < 0) {
struct iovec iov[1];
ssize_t ret;
- assert(sock);
- assert(buf);
- assert(len > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
memset(&msg, 0, sizeof(msg));
struct iovec iov[1];
ssize_t ret;
- assert(sock);
- assert(buf);
- assert(len > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
memset(&msg, 0, sizeof(msg));
struct iovec iov[1];
ssize_t ret;
- assert(sock);
- assert(buf);
- assert(len > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
memset(&msg, 0, sizeof(msg));
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
- assert(sock);
- assert(fds);
- assert(nb_fd > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(fds);
+ LTTNG_ASSERT(nb_fd > 0);
memset(&msg, 0, sizeof(msg));
memset(tmp, 0, sizeof(tmp));
char tmp[CMSG_SPACE(sizeof_fds)];
char dummy = 0;
- assert(sock);
- assert(fds);
- assert(nb_fd > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(fds);
+ LTTNG_ASSERT(nb_fd > 0);
memset(&msg, 0, sizeof(msg));
memset(tmp, 0, sizeof(tmp));
struct msghdr msg;
char dummy;
- assert(sock);
- assert(fds);
- assert(nb_fd > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(fds);
+ LTTNG_ASSERT(nb_fd > 0);
memset(&msg, 0, sizeof(msg));
int *raw_fd = (int *) lttng_dynamic_array_get_element(
raw_fds, i);
- assert(*raw_fd != -1);
+ LTTNG_ASSERT(*raw_fd != -1);
handle = fd_handle_create(*raw_fd);
if (!handle) {
int default_value = -1;
struct lttng_dynamic_array raw_fds;
- assert(sock);
- assert(payload);
- assert(nb_fd > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(payload);
+ LTTNG_ASSERT(nb_fd > 0);
lttng_dynamic_array_init(&raw_fds, sizeof(int), close_raw_fd);
struct cmsghdr *cmsg;
size_t sizeof_fds = nb_fd * sizeof(int);
- assert(sock);
- assert(fds);
- assert(nb_fd > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(fds);
+ LTTNG_ASSERT(nb_fd > 0);
#ifdef __linux__
/* Account for the struct ucred cmsg in the buffer size */
memset(&msg, 0, sizeof(msg));
- assert(sock);
- assert(buf);
- assert(len > 0);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
iov[0].iov_base = (void *) buf;
iov[0].iov_len = len;
char anc_buf[CMSG_SPACE(sizeof_cred)];
#endif /* __linux__, __CYGWIN__ */
- assert(sock);
- assert(buf);
- assert(len > 0);
- assert(creds);
+ LTTNG_ASSERT(sock);
+ LTTNG_ASSERT(buf);
+ LTTNG_ASSERT(len > 0);
+ LTTNG_ASSERT(creds);
memset(&msg, 0, sizeof(msg));
if (ret > 0) {
iov[0].iov_base += ret;
iov[0].iov_len -= ret;
- assert(ret <= len_last);
+ LTTNG_ASSERT(ret <= len_last);
}
} while ((ret > 0 && ret < len_last) || (ret < 0 && errno == EINTR));
if (ret < 0) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <arpa/inet.h>
#include <common/compat/netdb.h>
#include <stdlib.h>
unsigned char buf[sizeof(struct in6_addr)];
struct hostent *record;
- assert(addr);
- assert(dst);
+ LTTNG_ASSERT(addr);
+ LTTNG_ASSERT(dst);
memset(dst, 0, size);
{
int ret;
- assert(ctrl);
- assert(data);
+ LTTNG_ASSERT(ctrl);
+ LTTNG_ASSERT(data);
switch (ctrl->dtype) {
case LTTNG_DST_IPV4:
const char *addr;
char proto[5], port[7];
- assert(uri);
- assert(dst);
+ LTTNG_ASSERT(uri);
+ LTTNG_ASSERT(dst);
if (uri->dtype == LTTNG_DST_PATH) {
ipver = 0;
free(addr_f);
*uris = tmp_uris;
- assert(size == 1 || size == 2);
+ LTTNG_ASSERT(size == 1 || size == 2);
return size;
free_error:
}
/* 1 and 2 are the only expected values on success. */
- assert(ctrl_uri_count == 1 || ctrl_uri_count == 2);
+ LTTNG_ASSERT(ctrl_uri_count == 1 || ctrl_uri_count == 2);
/* At this point, we know there is at least one URI in the array */
set_default_uri_attr(&ctrl_uris[0], LTTNG_STREAM_CONTROL);
goto error;
} else {
/* 1 and 2 are the only expected values on success. */
- assert(data_uri_count == 1);
+ LTTNG_ASSERT(data_uri_count == 1);
}
set_default_uri_attr(&data_uris[0], LTTNG_STREAM_DATA);
*/
#include "lttng/lttng-error.h"
-#include <assert.h>
#include <common/compat/string.h>
#include <common/error.h>
#include <common/hashtable/hashtable.h>
{
struct lttng_userspace_probe_location_function *location_function = NULL;
- assert(location);
+ LTTNG_ASSERT(location);
location_function = container_of(location,
struct lttng_userspace_probe_location_function, parent);
- assert(location_function);
+ LTTNG_ASSERT(location_function);
free(location_function->function_name);
free(location_function->binary_path);
{
struct lttng_userspace_probe_location_tracepoint *location_tracepoint = NULL;
- assert(location);
+ LTTNG_ASSERT(location);
location_tracepoint = container_of(location,
struct lttng_userspace_probe_location_tracepoint,
parent);
- assert(location_tracepoint);
+ LTTNG_ASSERT(location_tracepoint);
free(location_tracepoint->probe_name);
free(location_tracepoint->provider_name);
goto end;
}
- assert(a->function_name);
- assert(b->function_name);
+ LTTNG_ASSERT(a->function_name);
+ LTTNG_ASSERT(b->function_name);
if (strcmp(a->function_name, b->function_name)) {
goto end;
}
- assert(a->binary_path);
- assert(b->binary_path);
+ LTTNG_ASSERT(a->binary_path);
+ LTTNG_ASSERT(b->binary_path);
if (strcmp(a->binary_path, b->binary_path)) {
goto end;
}
b = container_of(_b, struct lttng_userspace_probe_location_tracepoint,
parent);
- assert(a->probe_name);
- assert(b->probe_name);
+ LTTNG_ASSERT(a->probe_name);
+ LTTNG_ASSERT(b->probe_name);
if (strcmp(a->probe_name, b->probe_name)) {
goto end;
}
- assert(a->provider_name);
- assert(b->provider_name);
+ LTTNG_ASSERT(a->provider_name);
+ LTTNG_ASSERT(b->provider_name);
if (strcmp(a->provider_name, b->provider_name)) {
goto end;
}
- assert(a->binary_path);
- assert(b->binary_path);
+ LTTNG_ASSERT(a->binary_path);
+ LTTNG_ASSERT(b->binary_path);
if (strcmp(a->binary_path, b->binary_path)) {
goto end;
}
struct lttng_userspace_probe_location_lookup_method *parent = NULL;
struct lttng_userspace_probe_location_lookup_method_elf *elf_method;
- assert(lookup_method);
- assert(lookup_method->type ==
+ LTTNG_ASSERT(lookup_method);
+ LTTNG_ASSERT(lookup_method->type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
elf_method = zmalloc(sizeof(*elf_method));
struct lttng_userspace_probe_location_lookup_method *parent = NULL;
struct lttng_userspace_probe_location_lookup_method_sdt *sdt_method;
- assert(lookup_method);
- assert(lookup_method->type ==
+ LTTNG_ASSERT(lookup_method);
+ LTTNG_ASSERT(lookup_method->type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
sdt_method = zmalloc(sizeof(*sdt_method));
const char *function_name = NULL;
struct lttng_userspace_probe_location_function *function_location;
- assert(location);
- assert(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
function_location = container_of(
location, typeof(*function_location), parent);
const char *provider_name = NULL;
struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
- assert(location);
- assert(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
tracepoint_location = container_of(
location, typeof(*tracepoint_location), parent);
{
struct lttng_userspace_probe_location_lookup_method *ret = NULL;
- assert(location);
+ LTTNG_ASSERT(location);
switch (location->type) {
case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
ret = lttng_userspace_probe_location_function_get_lookup_method(
struct lttng_userspace_probe_location_function *location_function;
struct lttng_userspace_probe_location_function_comm location_function_comm;
- assert(location);
- assert(lttng_userspace_probe_location_get_type(location) ==
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
location_function = container_of(location,
struct lttng_userspace_probe_location_tracepoint *location_tracepoint;
struct lttng_userspace_probe_location_tracepoint_comm location_tracepoint_comm;
- assert(location);
- assert(lttng_userspace_probe_location_get_type(location) ==
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
location_tracepoint = container_of(location,
size_t expected_size;
struct fd_handle *binary_fd_handle = lttng_payload_view_pop_fd_handle(view);
- assert(location);
+ LTTNG_ASSERT(location);
if (view->buffer.size < sizeof(*location_function_comm)) {
ret = -LTTNG_ERR_INVALID;
size_t expected_size;
struct fd_handle *binary_fd_handle = lttng_payload_view_pop_fd_handle(view);
- assert(location);
+ LTTNG_ASSERT(location);
if (!binary_fd_handle) {
ret = -LTTNG_ERR_INVALID;
struct lttng_userspace_probe_location_lookup_method_comm *lookup_comm;
enum lttng_userspace_probe_location_lookup_method_type type;
- assert(view);
- assert(lookup_method);
+ LTTNG_ASSERT(view);
+ LTTNG_ASSERT(lookup_method);
if (view->buffer.size < sizeof(*lookup_comm)) {
ret = -LTTNG_ERR_INVALID;
lttng_payload_view_from_view(
view, 0, sizeof(*probe_location_comm));
- assert(view);
- assert(location);
+ LTTNG_ASSERT(view);
+ LTTNG_ASSERT(location);
lookup_method = NULL;
goto end;
}
- assert(lookup_method);
+ LTTNG_ASSERT(lookup_method);
(*location)->lookup_method = lookup_method;
lookup_method = NULL;
ret += consumed;
int ret = 0;
struct lttng_userspace_probe_location_function *function_location;
- assert(location);
- assert(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
function_location = container_of(location,
struct lttng_userspace_probe_location_function, parent);
int ret = 0;
struct lttng_userspace_probe_location_tracepoint *tracepoint_location;
- assert(location);
- assert(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
tracepoint_location = container_of(location,
struct lttng_userspace_probe_location_tracepoint, parent);
int storage_needed = 0;
int ret;
- assert(location);
+ LTTNG_ASSERT(location);
if (location->lookup_method && location->lookup_method->type !=
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF) {
probe_function = container_of(location,
struct lttng_userspace_probe_location_function,
parent);
- assert(probe_function->function_name);
- assert(probe_function->binary_path);
+ LTTNG_ASSERT(probe_function->function_name);
+ LTTNG_ASSERT(probe_function->binary_path);
storage_needed +=
sizeof(struct lttng_userspace_probe_location_function);
char *flat_probe_start;
int ret = 0;
- assert(location);
+ LTTNG_ASSERT(location);
/* Only SDT tracepoints are supported at the moment */
if (location->lookup_method && location->lookup_method->type !=
probe_tracepoint = container_of(location,
struct lttng_userspace_probe_location_tracepoint,
parent);
- assert(probe_tracepoint->probe_name);
- assert(probe_tracepoint->provider_name);
- assert(probe_tracepoint->binary_path);
+ LTTNG_ASSERT(probe_tracepoint->probe_name);
+ LTTNG_ASSERT(probe_tracepoint->provider_name);
+ LTTNG_ASSERT(probe_tracepoint->binary_path);
/* Compute the storage space needed to flatten the probe location */
storage_needed += sizeof(struct lttng_userspace_probe_location_tracepoint);
enum lttng_error_code ret_code;
mi_fp mi_function = NULL;
- assert(location);
- assert(writer);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
switch (lttng_userspace_probe_location_get_type(location)) {
case LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION:
enum lttng_error_code ret_code;
const char *type_element_str;
- assert(method);
- assert(writer);
+ LTTNG_ASSERT(method);
+ LTTNG_ASSERT(writer);
switch (lttng_userspace_probe_location_lookup_method_get_type(method)) {
case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_DEFAULT:
const struct lttng_userspace_probe_location_lookup_method
*lookup_method = NULL;
- assert(location);
- assert(writer);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
probe_name = lttng_userspace_probe_location_tracepoint_get_probe_name(
location);
const struct lttng_userspace_probe_location_lookup_method
*lookup_method = NULL;
- assert(location);
- assert(writer);
+ LTTNG_ASSERT(location);
+ LTTNG_ASSERT(writer);
function_name = lttng_userspace_probe_location_function_get_function_name(
location);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <lttng/ust-ctl.h>
#include <lttng/ust-sigbus.h>
#include <poll.h>
{
struct lttng_consumer_stream *stream, *stmp;
- assert(channel);
+ LTTNG_ASSERT(channel);
DBG("UST consumer cleaning stream list");
{
int ret = 0;
- assert(channel);
- assert(ctx);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ctx);
if (ctx->on_recv_channel != NULL) {
ret = ctx->on_recv_channel(channel);
int alloc_ret;
struct lttng_consumer_stream *stream = NULL;
- assert(channel);
- assert(ctx);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ctx);
stream = consumer_stream_create(
channel,
struct lttng_consumer_stream *stream;
pthread_mutex_t *current_stream_lock = NULL;
- assert(channel);
- assert(ctx);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ctx);
/*
* While a stream is available from ustctl. When NULL is returned, we've
int *stream_fds;
struct lttng_ust_ctl_consumer_channel *ust_channel;
- assert(channel);
- assert(attr);
- assert(ust_chanp);
- assert(channel->buffer_credentials.is_set);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(attr);
+ LTTNG_ASSERT(ust_chanp);
+ LTTNG_ASSERT(channel->buffer_credentials.is_set);
DBG3("Creating channel to ustctl with attr: [overwrite: %d, "
"subbuf_size: %" PRIu64 ", num_subbuf: %" PRIu64 ", "
{
int ret;
- assert(stream);
- assert(sock >= 0);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(sock >= 0);
DBG("UST consumer sending stream %" PRIu64 " to sessiond", stream->key);
struct lttng_consumer_stream *stream;
uint64_t net_seq_idx = -1ULL;
- assert(channel);
- assert(ctx);
- assert(sock >= 0);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(sock >= 0);
DBG("UST consumer sending channel %s to sessiond", channel->name);
{
int ret;
- assert(ctx);
- assert(channel);
- assert(attr);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(attr);
/*
* This value is still used by the kernel consumer since for the kernel,
int ret = 0;
struct lttng_consumer_stream *stream, *stmp;
- assert(channel);
- assert(ctx);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(ctx);
/* Send streams to the corresponding thread. */
cds_list_for_each_entry_safe(stream, stmp, &channel->streams.head,
goto send_streams_error;
}
/* List MUST be empty after or else it could be reused. */
- assert(cds_list_empty(&metadata->streams.head));
+ LTTNG_ASSERT(cds_list_empty(&metadata->streams.head));
ret = 0;
goto end;
int ret = 0;
struct lttng_consumer_stream *metadata_stream;
- assert(path);
- assert(ctx);
+ LTTNG_ASSERT(path);
+ LTTNG_ASSERT(ctx);
DBG("UST consumer snapshot metadata with key %" PRIu64 " at path %s",
key, path);
rcu_read_lock();
- assert(!metadata_channel->monitor);
+ LTTNG_ASSERT(!metadata_channel->monitor);
health_code_update();
}
metadata_stream = metadata_channel->metadata_stream;
- assert(metadata_stream);
+ LTTNG_ASSERT(metadata_stream);
pthread_mutex_lock(&metadata_stream->lock);
if (relayd_id != (uint64_t) -1ULL) {
unsigned long consumed_pos, produced_pos;
struct lttng_consumer_stream *stream;
- assert(path);
- assert(ctx);
+ LTTNG_ASSERT(path);
+ LTTNG_ASSERT(ctx);
rcu_read_lock();
use_relayd = 1;
}
- assert(!channel->monitor);
+ LTTNG_ASSERT(!channel->monitor);
DBG("UST consumer snapshot channel %" PRIu64, key);
cds_list_for_each_entry(stream, &channel->streams.head, send_node) {
/* Lock stream because we are about to change its state. */
pthread_mutex_lock(&stream->lock);
- assert(channel->trace_chunk);
+ LTTNG_ASSERT(channel->trace_chunk);
if (!lttng_trace_chunk_get(channel->trace_chunk)) {
/*
* Can't happen barring an internal error as the channel
ret = -1;
goto error_unlock;
}
- assert(!stream->trace_chunk);
+ LTTNG_ASSERT(!stream->trace_chunk);
stream->trace_chunk = channel->trace_chunk;
stream->net_seq_idx = relayd_id;
health_code_update();
/* deprecated */
- assert(msg.cmd_type != LTTNG_CONSUMER_STOP);
+ LTTNG_ASSERT(msg.cmd_type != LTTNG_CONSUMER_STOP);
health_code_update();
attr.type = LTTNG_UST_ABI_CHAN_METADATA;
break;
default:
- assert(0);
+ abort();
goto error_fatal;
};
goto error_get_channel_fatal;
}
/* List MUST be empty after or else it could be reused. */
- assert(cds_list_empty(&found_channel->streams.head));
+ LTTNG_ASSERT(cds_list_empty(&found_channel->streams.head));
end_get_channel:
goto end_msg_sessiond;
error_get_channel_fatal:
int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
int producer_active)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_flush_buffer(stream->ustream, producer_active);
}
*/
int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_snapshot(stream->ustream);
}
int lttng_ustconsumer_sample_snapshot_positions(
struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_snapshot_sample_positions(stream->ustream);
}
int lttng_ustconsumer_get_produced_snapshot(
struct lttng_consumer_stream *stream, unsigned long *pos)
{
- assert(stream);
- assert(stream->ustream);
- assert(pos);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
+ LTTNG_ASSERT(pos);
return lttng_ust_ctl_snapshot_get_produced(stream->ustream, pos);
}
int lttng_ustconsumer_get_consumed_snapshot(
struct lttng_consumer_stream *stream, unsigned long *pos)
{
- assert(stream);
- assert(stream->ustream);
- assert(pos);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
+ LTTNG_ASSERT(pos);
return lttng_ust_ctl_snapshot_get_consumed(stream->ustream, pos);
}
int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream,
int producer)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_flush_buffer(stream->ustream, producer);
}
int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_clear_buffer(stream->ustream);
}
int lttng_ustconsumer_get_current_timestamp(
struct lttng_consumer_stream *stream, uint64_t *ts)
{
- assert(stream);
- assert(stream->ustream);
- assert(ts);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
+ LTTNG_ASSERT(ts);
return lttng_ust_ctl_get_current_timestamp(stream->ustream, ts);
}
int lttng_ustconsumer_get_sequence_number(
struct lttng_consumer_stream *stream, uint64_t *seq)
{
- assert(stream);
- assert(stream->ustream);
- assert(seq);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
+ LTTNG_ASSERT(seq);
return lttng_ust_ctl_get_sequence_number(stream->ustream, seq);
}
*/
void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
pthread_mutex_lock(&stream->lock);
if (!stream->quiescent) {
{
int i;
- assert(chan);
- assert(chan->uchan);
- assert(chan->buffer_credentials.is_set);
+ LTTNG_ASSERT(chan);
+ LTTNG_ASSERT(chan->uchan);
+ LTTNG_ASSERT(chan->buffer_credentials.is_set);
if (chan->switch_timer_enabled == 1) {
consumer_timer_switch_stop(chan);
void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
{
- assert(chan);
- assert(chan->uchan);
- assert(chan->buffer_credentials.is_set);
+ LTTNG_ASSERT(chan);
+ LTTNG_ASSERT(chan->uchan);
+ LTTNG_ASSERT(chan->buffer_credentials.is_set);
consumer_metadata_cache_destroy(chan);
lttng_ust_ctl_destroy_channel(chan->uchan);
void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
if (stream->chan->switch_timer_enabled == 1) {
consumer_timer_switch_stop(stream->chan);
int lttng_ustconsumer_get_wakeup_fd(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_stream_get_wakeup_fd(stream->ustream);
}
int lttng_ustconsumer_close_wakeup_fd(struct lttng_consumer_stream *stream)
{
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
return lttng_ust_ctl_stream_close_wakeup_fd(stream->ustream);
}
&stream->chan->metadata_cache->contents.data[stream->ust_metadata_pushed],
stream->chan->metadata_cache->contents.size -
stream->ust_metadata_pushed);
- assert(write_len != 0);
+ LTTNG_ASSERT(write_len != 0);
if (write_len < 0) {
ERR("Writing one metadata packet");
ret = write_len;
}
stream->ust_metadata_pushed += write_len;
- assert(stream->chan->metadata_cache->contents.size >=
+ LTTNG_ASSERT(stream->chan->metadata_cache->contents.size >=
stream->ust_metadata_pushed);
ret = write_len;
enum sync_metadata_status status;
struct lttng_consumer_channel *metadata_channel;
- assert(ctx);
- assert(metadata_stream);
+ LTTNG_ASSERT(ctx);
+ LTTNG_ASSERT(metadata_stream);
metadata_channel = metadata_stream->chan;
pthread_mutex_unlock(&metadata_stream->lock);
int ret;
struct lttng_ust_ctl_consumer_stream *ustream;
- assert(stream);
- assert(ctx);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(ctx);
ustream = stream->ustream;
}
ret = lttng_ust_ctl_put_subbuf(ustream);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
/* This stream still has data. Flag it and wake up the data thread. */
stream->has_data = 1;
subbuffer->buffer.buffer = lttng_buffer_view_init(
addr, 0, subbuffer->info.data.padded_subbuf_size);
- assert(subbuffer->buffer.buffer.data != NULL);
+ LTTNG_ASSERT(subbuffer->buffer.buffer.data != NULL);
end:
return ret;
}
{
const int ret = lttng_ust_ctl_put_next_subbuf(stream->ustream);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
return ret;
}
{
int ret;
- assert(stream);
+ LTTNG_ASSERT(stream);
/*
* Don't create anything if this is set for streaming or if there is
{
int ret;
- assert(stream);
- assert(stream->ustream);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream->ustream);
ASSERT_LOCKED(stream->lock);
DBG("UST consumer checking data pending");
*/
DBG("UST consumer metadata pending check: contiguous %" PRIu64 " vs pushed %" PRIu64,
contiguous, pushed);
- assert(((int64_t) (contiguous - pushed)) >= 0);
+ LTTNG_ASSERT(((int64_t) (contiguous - pushed)) >= 0);
if ((contiguous != pushed) ||
(((int64_t) contiguous - pushed) > 0 || contiguous == 0)) {
ret = 1; /* Data is pending */
* subbuffer.
*/
ret = lttng_ust_ctl_put_subbuf(stream->ustream);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = 1; /* Data is pending */
goto end;
}
{
int ret;
- assert(metadata);
- assert(metadata->type == CONSUMER_CHANNEL_TYPE_METADATA);
+ LTTNG_ASSERT(metadata);
+ LTTNG_ASSERT(metadata->type == CONSUMER_CHANNEL_TYPE_METADATA);
DBG("Closing metadata channel key %" PRIu64, metadata->key);
struct lttng_ht_iter iter;
struct lttng_consumer_stream *stream;
- assert(metadata_ht);
- assert(metadata_ht->ht);
+ LTTNG_ASSERT(metadata_ht);
+ LTTNG_ASSERT(metadata_ht->ht);
DBG("UST consumer closing all metadata streams");
uint64_t len, key, offset, version;
int ret;
- assert(channel);
- assert(channel->metadata_cache);
+ LTTNG_ASSERT(channel);
+ LTTNG_ASSERT(channel->metadata_cache);
memset(&request, 0, sizeof(request));
offset = msg.u.push_metadata.target_offset;
version = msg.u.push_metadata.version;
- assert(key == channel->key);
+ LTTNG_ASSERT(key == channel->key);
if (len == 0) {
DBG("No new metadata to receive for key %" PRIu64, key);
}
int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream,
uint64_t *stream_id)
{
- assert(stream);
- assert(stream_id);
+ LTTNG_ASSERT(stream);
+ LTTNG_ASSERT(stream_id);
return lttng_ust_ctl_get_stream_id(stream->ustream, stream_id);
}
#include "common/macros.h"
#define _LGPL_SOURCE
-#include <assert.h>
#include <ctype.h>
#include <fcntl.h>
#include <limits.h>
int ret;
FILE *fp;
- assert(filepath);
+ LTTNG_ASSERT(filepath);
fp = fopen(filepath, "w");
if (fp == NULL) {
int fd;
struct flock lock;
- assert(filepath);
+ LTTNG_ASSERT(filepath);
memset(&lock, 0, sizeof(lock));
fd = open(filepath, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR |
if (size > 0) {
ret = snprintf(count_str, sizeof(count_str), "_%" PRIu64,
count);
- assert(ret > 0 && ret < sizeof(count_str));
+ LTTNG_ASSERT(ret > 0 && ret < sizeof(count_str));
}
ret = snprintf(out_stream_path, stream_path_len, "%s%s%s%s%s",
time_t rawtime;
struct tm *timeinfo;
- assert(format);
- assert(dst);
+ LTTNG_ASSERT(format);
+ LTTNG_ASSERT(dst);
/* Get date and time for session path */
time(&rawtime);
/* Section integer -> section string */
ret = sprintf(section_string, "%d", section);
- assert(ret > 0 && ret < 8);
+ LTTNG_ASSERT(ret > 0 && ret < 8);
/*
* Execute man pager.
{
int ret;
- assert(path);
+ LTTNG_ASSERT(path);
DBG("Changing working directory to \"%s\"", path);
ret = chdir(path);
int ret;
char *endptr;
- assert(str);
- assert(value);
+ LTTNG_ASSERT(str);
+ LTTNG_ASSERT(value);
errno = 0;
*value = strtoull(str, &endptr, 10);
#include "waiter.h"
#include <urcu/uatomic.h>
#include <urcu/futex.h>
-#include <assert.h>
#include "error.h"
#include <poll.h>
while (!(uatomic_read(&waiter->state) & WAITER_TEARDOWN)) {
poll(NULL, 0, 10);
}
- assert(uatomic_read(&waiter->state) & WAITER_TEARDOWN);
+ LTTNG_ASSERT(uatomic_read(&waiter->state) & WAITER_TEARDOWN);
DBG("End of waiter wait period");
}
void lttng_waiter_wake_up(struct lttng_waiter *waiter)
{
cmm_smp_mb();
- assert(uatomic_read(&waiter->state) == WAITER_WAITING);
+ LTTNG_ASSERT(uatomic_read(&waiter->state) == WAITER_WAITING);
uatomic_set(&waiter->state, WAITER_WOKEN_UP);
if (!(uatomic_read(&waiter->state) & WAITER_RUNNING)) {
if (futex_noasync(&waiter->state, FUTEX_WAKE, 1,
#include <common/payload.h>
#include <common/payload-view.h>
#include <common/unix.h>
-#include <assert.h>
#include "lttng-ctl-helper.h"
#include <common/compat/poll.h>
{
struct lttng_notification_channel_message *msg;
- assert(channel->reception_payload.buffer.size >= sizeof(*msg));
+ LTTNG_ASSERT(channel->reception_payload.buffer.size >= sizeof(*msg));
msg = (struct lttng_notification_channel_message *)
channel->reception_payload.buffer.data;
if (channel->pending_notifications.count) {
struct pending_notification *pending_notification;
- assert(!cds_list_empty(&channel->pending_notifications.list));
+ LTTNG_ASSERT(!cds_list_empty(&channel->pending_notifications.list));
/* Deliver one of the pending notifications. */
pending_notification = cds_list_first_entry(
goto end;
}
- assert(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE ||
+ LTTNG_ASSERT(type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE ||
type == LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE);
pthread_mutex_lock(&channel->lock);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <lttng/lttng-error.h>
{
int ret = 0;
- assert(handle->communication.bytes_left_to_receive == 0);
+ LTTNG_ASSERT(handle->communication.bytes_left_to_receive == 0);
switch (handle->communication.state) {
case COMMUNICATION_STATE_RECEIVE_LTTNG_MSG:
LTTNG_OPTIONAL_SET(&handle->communication.data_size, 0);
ret = lttng_dynamic_buffer_set_size(
&handle->communication.buffer, 0);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
break;
}
default:
{
int ret = 0;
- assert(handle->communication.bytes_left_to_receive == 0);
+ LTTNG_ASSERT(handle->communication.bytes_left_to_receive == 0);
switch (handle->communication.state) {
case COMMUNICATION_STATE_RECEIVE_LTTNG_MSG:
msg->data_size);
ret = lttng_dynamic_buffer_set_size(
&handle->communication.buffer, 0);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
break;
}
case COMMUNICATION_STATE_RECEIVE_COMMAND_HEADER:
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stddef.h>
#include <common/error.h>
}
event_extended = (struct lttng_event_extended *) event->extended.ptr;
- assert(event_extended);
+ LTTNG_ASSERT(event_extended);
if (event_extended->probe_location) {
lttng_userspace_probe_location_destroy(
event_extended->probe_location);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <limits.h>
int closeret;
closeret = close(sock);
- assert(!closeret);
+ LTTNG_ASSERT(!closeret);
}
error:
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <grp.h>
#include <stdio.h>
#include <stdlib.h>
{
int ret;
- assert(len > 0);
+ LTTNG_ASSERT(len > 0);
if (!connected) {
ret = -LTTNG_ERR_NO_SESSIOND;
struct lttcomm_lttng_msg llm;
const int fd_count = lttng_payload_view_get_fd_handle_count(message);
- assert(reply->buffer.size == 0);
- assert(lttng_dynamic_pointer_array_get_count(&reply->_fd_handles) == 0);
+ LTTNG_ASSERT(reply->buffer.size == 0);
+ LTTNG_ASSERT(lttng_dynamic_pointer_array_get_count(&reply->_fd_handles) == 0);
ret = connect_sessiond();
if (ret < 0) {
int err;
char *agent_filter = NULL;
- assert(ev);
+ LTTNG_ASSERT(ev);
/* Don't add filter for the '*' event. */
if (strcmp(ev->name, "*") != 0) {
if (ev->name[0] == '\0') {
/* Enable all events. */
ret = lttng_strncpy(ev->name, "*", sizeof(ev->name));
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
}
COPY_DOMAIN_PACKED(lsm.domain, handle->domain);
goto mem_error;
}
- assert(fd_count == 0 || fd_count == 1);
+ LTTNG_ASSERT(fd_count == 0 || fd_count == 1);
if (fd_count == 1) {
struct fd_handle *h =
lttng_payload_view_pop_fd_handle(&view);
ret = (int) -ret_code;
goto end;
}
- assert(handle);
+ LTTNG_ASSERT(handle);
/* Block until the completion of the destruction of the session. */
status = lttng_destruction_handle_wait_for_completion(handle, -1);
* No socket path set. Weird error which means the constructor
* was not called.
*/
- assert(0);
+ abort();
}
ret = try_connect_sessiond(sessiond_sock_path);
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <lttng/lttng-error.h>
ret = lttng_strncpy(lsm.session.name, session_name,
sizeof(lsm.session.name));
/* Source length already validated. */
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = lttng_ctl_ask_sessiond(&lsm, (void **) &rotate_return);
if (ret <= 0) {
ret = lttng_strncpy(lsm.session.name, session_name,
sizeof(lsm.session.name));
/* Source length already validated. */
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
lsm.u.rotation_set_schedule.type = (uint32_t) schedule->type;
switch (schedule->type) {
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <lttng/lttng-error.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <string.h>
#include <common/sessiond-comm/sessiond-comm.h>
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
do {
ret = recv(fd, buf + copied, to_copy, 0);
if (ret > 0) {
- assert(ret <= to_copy);
+ LTTNG_ASSERT(ret <= to_copy);
copied += ret;
to_copy -= ret;
}
diag("[error] Error sending cmd");
goto error;
}
- assert(ret_len == sizeof(cmd));
+ LTTNG_ASSERT(ret_len == sizeof(cmd));
ret_len = lttng_live_recv(control_sock, &resp, sizeof(resp));
if (ret_len == 0) {
diag("[error] Error receiving create session reply");
goto error;
}
- assert(ret_len == sizeof(resp));
+ LTTNG_ASSERT(ret_len == sizeof(resp));
if (be32toh(resp.status) != LTTNG_VIEWER_CREATE_SESSION_OK) {
diag("[error] Error creating viewer session");
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
-#include <assert.h>
#include <lttng/action/action.h>
#include <lttng/action/list.h>
#include <lttng/constant.h>
#include <fcntl.h>
#include <dlfcn.h>
-#include <assert.h>
#include <stdio.h>
static char *pause_pipe_path;
* when launching the session daemon.
*/
data_consumption_state = dlsym(NULL, "data_consumption_paused");
- assert(data_consumption_state);
+ LTTNG_ASSERT(data_consumption_state);
lttng_consumer_get_type = dlsym(NULL, "lttng_consumer_get_type");
- assert(lttng_consumer_get_type);
+ LTTNG_ASSERT(lttng_consumer_get_type);
switch (lttng_consumer_get_type()) {
case LTTNG_CONSUMER_KERNEL:
*
*/
-#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <poll.h>
#include <common/compat/errno.h>
+#include <common/macros.h>
#include <lttng/lttng.h>
#include <tap/tap.h>
bool name_is_equal;
const char *name;
- assert(notification);
- assert(trigger_name);
+ LTTNG_ASSERT(notification);
+ LTTNG_ASSERT(trigger_name);
name = get_notification_trigger_name(notification);
if (name == NULL) {
/*
* Send SIGUSR1 to application instructing it to bypass tracepoint.
*/
- assert(app_pid > 1);
+ LTTNG_ASSERT(app_pid > 1);
ret = kill(app_pid, SIGUSR1);
if (ret) {
goto error;
}
- assert(app_pid > 1);
+ LTTNG_ASSERT(app_pid > 1);
ret = kill(app_pid, SIGUSR1);
if (ret) {
/* Safety check */
if (mask_position != test_vector_size -1) {
- assert("Logic error for test vector generation");
+ LTTNG_ASSERT("Logic error for test vector generation");
}
loop_ret = asprintf(&test_tuple_string, "session name %s, channel name %s, threshold ratio %s, threshold byte %s, domain type %s",
do {
ret = lttng_data_pending(session_name);
- assert(ret >= 0);
+ LTTNG_ASSERT(ret >= 0);
} while (ret != 0);
}
event_rule_set_filter set_filter;
event_rule_add_name_pattern_exclusion add_name_pattern_exclusion;
- assert(event_pattern);
- assert(trigger_name);
- assert(condition);
- assert(trigger);
+ LTTNG_ASSERT(event_pattern);
+ LTTNG_ASSERT(trigger_name);
+ LTTNG_ASSERT(condition);
+ LTTNG_ASSERT(trigger);
/* Set the function pointers based on the domain type. */
switch (domain_type) {
int i;
bool success = true;
- assert(domain_type == LTTNG_DOMAIN_UST);
- assert(add_name_pattern_exclusion != NULL);
- assert(exclusion_count > 0);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_UST);
+ LTTNG_ASSERT(add_name_pattern_exclusion != NULL);
+ LTTNG_ASSERT(exclusion_count > 0);
for (i = 0; i < exclusion_count; i++) {
event_rule_status = add_name_pattern_exclusion(
field_value_type_to_str(
lttng_event_field_value_get_type(captured_field)));
- assert(validate);
+ LTTNG_ASSERT(validate);
ret = validate(captured_field, iteration);
if (ret) {
at_least_one_error = true;
* At the moment, the only test case of this scenario is
* exclusion which is only supported by UST.
*/
- assert(domain_type == LTTNG_DOMAIN_UST);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_UST);
diag("Test tracepoint event rule notifications with exclusion for domain %s",
domain_type_string);
test_tracepoint_event_rule_notification_exclusion(domain_type);
{
plan_tests(11);
/* Test cases that need the kernel tracer. */
- assert(domain_type == LTTNG_DOMAIN_KERNEL);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
diag("Test kprobe event rule notifications for domain %s",
domain_type_string);
{
plan_tests(23);
/* Test cases that need the kernel tracer. */
- assert(domain_type == LTTNG_DOMAIN_KERNEL);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
diag("Test syscall event rule notifications for domain %s",
domain_type_string);
testapp_path = argv[5];
test_symbol_name = argv[6];
/* Test cases that need the kernel tracer. */
- assert(domain_type == LTTNG_DOMAIN_KERNEL);
+ LTTNG_ASSERT(domain_type == LTTNG_DOMAIN_KERNEL);
diag("Test userspace-probe event rule notifications for domain %s",
domain_type_string);
plan_tests(215);
break;
default:
- assert(0);
+ abort();
}
diag("Test tracepoint event rule notification captures for domain %s",
#include <stdio.h>
#include <unistd.h>
-#include <assert.h>
#include <tap/tap.h>
#include <stdint.h>
#include <string.h>
#include <lttng/constant.h>
#include <fcntl.h>
#include <dlfcn.h>
-#include <assert.h>
#include <stdio.h>
static char *pause_pipe_path;
}
notifier_notif_consumption_state = dlsym(NULL, "notifier_consumption_paused");
- assert(notifier_notif_consumption_state);
+ LTTNG_ASSERT(notifier_notif_consumption_state);
ret = asprintf(&pause_pipe_path, "%s", pause_pipe_path_prefix);
if (ret < 1) {
*
*/
-#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
-#include <assert.h>
#include <tap/tap.h>
#include <stdint.h>
#include <string.h>
const struct lttng_trigger *trigger;
trigger = lttng_triggers_get_at_index(triggers, i);
- assert(trigger);
+ LTTNG_ASSERT(trigger);
ret = lttng_unregister_trigger(trigger);
if (ret) {
const struct lttng_trigger *trigger_from_listing;
trigger_from_listing = lttng_triggers_get_at_index(triggers, i);
- assert(trigger_from_listing);
+ LTTNG_ASSERT(trigger_from_listing);
trigger_status = lttng_trigger_get_name(trigger_from_listing, &trigger_name);
ok(trigger_status == LTTNG_TRIGGER_STATUS_UNSET,
const struct lttng_trigger *trigger_from_listing;
trigger_from_listing = lttng_triggers_get_at_index(triggers, i);
- assert(trigger_from_listing);
+ LTTNG_ASSERT(trigger_from_listing);
trigger_status = lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
const struct lttng_trigger *trigger_from_listing;
trigger_from_listing = lttng_triggers_get_at_index(triggers, i);
- assert(trigger_from_listing);
+ LTTNG_ASSERT(trigger_from_listing);
trigger_status = lttng_trigger_get_name(trigger_from_listing, &returned_trigger_name);
ok(trigger_status == LTTNG_TRIGGER_STATUS_OK,
#include <common/macros.h>
#include <lttng/lttng.h>
-#include <assert.h>
#include <stdlib.h>
#include <string.h>
trigger = lttng_trigger_create(condition, action);
ret = lttng_register_trigger_with_name(trigger, trigger_name);
- assert(ret == LTTNG_OK);
+ LTTNG_ASSERT(ret == LTTNG_OK);
}
/*
action_notify = lttng_action_notify_create();
action_status = lttng_action_list_add_action(
action_list, action_notify);
- assert(action_status == LTTNG_ACTION_STATUS_OK);
+ LTTNG_ASSERT(action_status == LTTNG_ACTION_STATUS_OK);
register_trigger(trigger_name, condition, action_list);
}
condition_status =
lttng_condition_session_consumed_size_set_session_name(
condition, session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
condition_status = lttng_condition_session_consumed_size_set_threshold(
condition, threshold);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
return condition;
}
condition_status = lttng_condition_buffer_usage_set_session_name(
condition, session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
condition_status = lttng_condition_buffer_usage_set_channel_name(
condition, channel_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
condition_status = lttng_condition_buffer_usage_set_domain_type(
condition, domain_type);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
}
static void fill_buffer_usage_bytes_condition(struct lttng_condition *condition,
condition, session_name, channel_name, domain_type);
condition_status = lttng_condition_buffer_usage_set_threshold(
condition, threshold);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
}
static void fill_buffer_usage_ratio_condition(struct lttng_condition *condition,
condition, session_name, channel_name, domain_type);
condition_status = lttng_condition_buffer_usage_set_threshold_ratio(
condition, ratio);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
}
static struct lttng_condition *create_buffer_usage_high_bytes_condition(
condition_status = lttng_condition_session_rotation_set_session_name(
condition, session_name);
- assert(condition_status == LTTNG_CONDITION_STATUS_OK);
+ LTTNG_ASSERT(condition_status == LTTNG_CONDITION_STATUS_OK);
}
static struct lttng_condition *create_session_rotation_ongoing_condition(
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
/* For comparison. */
default_policy = lttng_rate_policy_every_n_create(1);
- assert(policy && default_policy);
+ LTTNG_ASSERT(policy && default_policy);
notify_action = lttng_action_notify_create();
ok(notify_action, "Create notify action");
/* For comparison. */
default_policy = lttng_rate_policy_every_n_create(1);
- assert(policy && default_policy);
+ LTTNG_ASSERT(policy && default_policy);
rotate_session_action = lttng_action_rotate_session_create();
ok(rotate_session_action, "Create rotate_session action");
/* For comparison. */
default_policy = lttng_rate_policy_every_n_create(1);
- assert(policy && default_policy);
+ LTTNG_ASSERT(policy && default_policy);
start_session_action = lttng_action_start_session_create();
ok(start_session_action, "Create start_session action");
/* For comparison. */
default_policy = lttng_rate_policy_every_n_create(1);
- assert(policy && default_policy);
+ LTTNG_ASSERT(policy && default_policy);
stop_session_action = lttng_action_stop_session_create();
ok(stop_session_action, "Create stop_session action");
/* For comparison. */
default_policy = lttng_rate_policy_every_n_create(1);
- assert(policy && default_policy);
+ LTTNG_ASSERT(policy && default_policy);
snapshot_session_action = lttng_action_snapshot_session_create();
ok(snapshot_session_action, "Create snapshot_session action");
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
log_level_rule_at_least_as_severe =
lttng_log_level_rule_at_least_as_severe_as_create(
LTTNG_LOGLEVEL_WARNING);
- assert(log_level_rule_at_least_as_severe);
+ LTTNG_ASSERT(log_level_rule_at_least_as_severe);
tracepoint = lttng_event_rule_user_tracepoint_create();
ok(tracepoint, "user tracepoint");
*
*/
-#include <assert.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
lttng_payload_init(&payload);
log_level_rule = lttng_log_level_rule_exactly_create(LTTNG_LOGLEVEL_INFO);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
tracepoint = lttng_event_rule_user_tracepoint_create();
ok(tracepoint, "user tracepoint object.");
lttng_payload_init(&payload);
log_level_rule = lttng_log_level_rule_exactly_create(LTTNG_LOGLEVEL_INFO);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
jul_logging = lttng_event_rule_jul_logging_create();
ok(jul_logging, "jul_logging object.");
lttng_payload_init(&payload);
log_level_rule = lttng_log_level_rule_exactly_create(LTTNG_LOGLEVEL_INFO);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
log4j_logging = lttng_event_rule_log4j_logging_create();
ok(log4j_logging, "log4j_logging object.");
lttng_payload_init(&payload);
log_level_rule = lttng_log_level_rule_exactly_create(LTTNG_LOGLEVEL_INFO);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
python_logging = lttng_event_rule_python_logging_create();
ok(python_logging, "python_logging object.");
address_location = lttng_kernel_probe_location_address_create(50);
symbol_location = lttng_kernel_probe_location_symbol_create("une_bonne", 50);
- assert(address_location);
- assert(symbol_location);
+ LTTNG_ASSERT(address_location);
+ LTTNG_ASSERT(symbol_location);
test_event_rule_kernel_probe_by_location(address_location);
test_event_rule_kernel_probe_by_location(symbol_location);
log_level_rule = lttng_log_level_rule_at_least_as_severe_as_create(
log_level);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
*as_severe_status = set_log_level(
event_rule, log_level_rule);
lttng_log_level_rule_destroy(log_level_rule);
log_level_rule = lttng_log_level_rule_exactly_create(log_level);
- assert(log_level_rule);
+ LTTNG_ASSERT(log_level_rule);
*exactly_status = set_log_level(
event_rule, log_level_rule);
diag("Test %s event rule + log level rule", event_rule_type_str);
rule = create_event_rule();
- assert(rule);
+ LTTNG_ASSERT(rule);
for (i = 0; i < tagged_log_level_values_count; i++) {
const int tagged_log_level_value = tagged_log_level_values[i];
#include <stdlib.h>
#include <inttypes.h>
#include <stdbool.h>
-#include <assert.h>
#include <string.h>
#include <stdarg.h>
#include <tap/tap.h>
if (!output_dir) {
diag("Failed to create temporary path of the form %s",
TMP_DIR_PATTERN);
- assert(0);
+ abort();
}
*_test_directory = strdup(output_dir);
- assert(*_test_directory);
+ LTTNG_ASSERT(*_test_directory);
ret = asprintf(_unlink_directory, "%s/%s", output_dir,
TEST_UNLINK_DIRECTORY_NAME);
if (ret < 0) {
- assert(0);
+ abort();
}
}
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
&files[i].name, 1, noop_open, &files[i].fd);
- assert(out_fd == files[i].fd);
+ LTTNG_ASSERT(out_fd == files[i].fd);
ok(ret == 0, "Track unsuspendable fd %d (%s)", files[i].fd,
files[i].name);
get_temporary_directories(&test_directory, &unlinked_files_directory);
tracker = fd_tracker_create(test_directory, TRACKER_FD_LIMIT);
- assert(tracker);
+ LTTNG_ASSERT(tracker);
/* The error_open callback should fail and return 'expected_error'. */
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
NULL, 1, noop_open, &stdout_fd);
ok(out_fd == stdout_fd, "fd_tracker_open_unsuspendable_fd() sets the output fd parameter to the newly-tracked fd's value");
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = fd_tracker_close_unsuspendable_fd(tracker,
&stdout_fd, 1, error_close, &expected_error);
ok(ret == expected_error, "fd_tracker_close_unsuspendable_fd() forwards the user callback's error code");
ret = fd_tracker_close_unsuspendable_fd(tracker,
&stdout_fd, 1, noop_close, &expected_error);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
fd_tracker_destroy(tracker);
ret = rmdir(test_directory);
get_temporary_directories(&test_directory, &unlinked_files_directory);
tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
- assert(tracker);
+ LTTNG_ASSERT(tracker);
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
NULL, 1, noop_open, &stdout_fd);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
NULL, 1, noop_open, &stdout_fd);
ok(ret == -EEXIST, "EEXIST reported on open of an already tracked file descriptor");
ret = fd_tracker_close_unsuspendable_fd(tracker,
&stdout_fd, 1, noop_close, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
fd_tracker_destroy(tracker);
ret = rmdir(test_directory);
get_temporary_directories(&test_directory, &unlinked_files_directory);
/* This test assumes TRACKER_FD_LIMIT is a multiple of 2. */
- assert((TRACKER_FD_LIMIT % 2 == 0) && TRACKER_FD_LIMIT);
+ LTTNG_ASSERT((TRACKER_FD_LIMIT % 2 == 0) && TRACKER_FD_LIMIT);
tracker = fd_tracker_create(unlinked_files_directory, TRACKER_FD_LIMIT);
- assert(tracker);
+ LTTNG_ASSERT(tracker);
ret = fd_tracker_open_unsuspendable_fd(tracker, fds,
NULL, TRACKER_FD_LIMIT, open_pipes, NULL);
ret = fd_tracker_close_unsuspendable_fd(tracker,
fds, TRACKER_FD_LIMIT, close_pipes, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
fd_tracker_destroy(tracker);
ret = rmdir(test_directory);
}
ret = pipe(unknown_fds);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = close(unknown_fds[0]);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = close(unknown_fds[1]);
- assert(ret == 0);
+ LTTNG_ASSERT(ret == 0);
ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
NULL, 1, noop_open, &stdout_fd);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
ret = fd_tracker_close_unsuspendable_fd(tracker,
unknown_fds, 1, noop_close, NULL);
ret = fd_tracker_close_unsuspendable_fd(tracker,
&stdout_fd, 1, noop_close, NULL);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
fd_tracker_destroy(tracker);
ret = rmdir(test_directory);
mode_t mode = S_IWUSR | S_IRUSR;
p_ret = asprintf(&file_path, "file-%u", i);
- assert(p_ret >= 0);
+ LTTNG_ASSERT(p_ret >= 0);
file_paths[i] = file_path;
handle = fd_tracker_open_fs_handle(tracker, directory, file_path,
}
dir_handle = lttng_directory_handle_create(test_directory);
- assert(dir_handle);
+ LTTNG_ASSERT(dir_handle);
dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
ret = open_files(tracker, dir_handle, files_to_create, handles,
}
dir_handle = lttng_directory_handle_create(test_directory);
- assert(dir_handle);
+ LTTNG_ASSERT(dir_handle);
dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
ret = open_files(tracker, dir_handle, files_to_create, handles,
}
dir_handle = lttng_directory_handle_create(test_directory);
- assert(dir_handle);
+ LTTNG_ASSERT(dir_handle);
dir_handle_fd_count = !!lttng_directory_handle_uses_fd(dir_handle);
ret = open_files(tracker, dir_handle, files_to_create, handles,
fd = lttng_directory_handle_open_file(
dir_handle, path, O_RDONLY, 0);
- assert(fd >= 0);
+ LTTNG_ASSERT(fd >= 0);
ret = fstat(fd, &fd_stat);
- assert(!ret);
+ LTTNG_ASSERT(!ret);
if (fd_stat.st_size != sizeof(file_contents)) {
diag("Content size of file %s doesn't match, got %" PRId64 ", expected %zu",
path, (int64_t) fd_stat.st_size,
get_temporary_directories(&test_directory, &unlinked_files_directory);
ret = asprintf(&unlinked_file_zero, "%s/%u", unlinked_files_directory,
0);
- assert(ret > 0);
+ LTTNG_ASSERT(ret > 0);
ret = asprintf(&unlinked_file_one, "%s/%u", unlinked_files_directory,
1);
- assert(ret > 0);
+ LTTNG_ASSERT(ret > 0);
tracker = fd_tracker_create(unlinked_files_directory, 1);
if (!tracker) {
}
dir_handle = lttng_directory_handle_create(test_directory);
- assert(dir_handle);
+ LTTNG_ASSERT(dir_handle);
/* Open two handles to the same file. */
ret = open_same_file(tracker, dir_handle, file_name, handles_to_open,
ret = open_same_file(tracker, dir_handle, file_name, 1, &new_handle);
ok(!ret, "Successfully opened a new handle to previously unlinked file %s/%s",
test_directory, file_name);
- assert(new_handle);
+ LTTNG_ASSERT(new_handle);
/*
* Unlinking the new handle should cause the file to be renamed
rcu_register_thread();
unknown_fds_count = fd_count() - STDIO_FD_COUNT;
- assert(unknown_fds_count >= 0);
+ LTTNG_ASSERT(unknown_fds_count >= 0);
diag("Unsuspendable - basic");
test_unsuspendable_basic();
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void test_create_kernel_metadata(void)
{
- assert(kern != NULL);
+ LTTNG_ASSERT(kern != NULL);
kern->metadata = trace_kernel_create_metadata();
ok(kern->metadata != NULL, "Create kernel metadata");
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
/* Different type. */
different_type = lttng_log_level_rule_at_least_as_severe_as_create(level);
- assert(a && b && different_level && different_type);
+ LTTNG_ASSERT(a && b && different_level && different_type);
ok(lttng_log_level_rule_is_equal(a, a), "Same object is equal");
ok(lttng_log_level_rule_is_equal(a, b), "Object a and b are equal");
/* Different type. */
different_type = lttng_log_level_rule_exactly_create(level);
- assert(a && b && different_level && different_type);
+ LTTNG_ASSERT(a && b && different_level && different_type);
ok(lttng_log_level_rule_is_equal(a, a), "Same object is equal");
ok(lttng_log_level_rule_is_equal(a, b), "Object a and b are equal");
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <lttng/notification/notification.h>
#include <lttng/trigger/trigger.h>
+#include <common/macros.h>
+
/* For error.h */
int lttng_opt_quiet = 1;
int lttng_opt_verbose;
double threshold_ratio;
uint64_t threshold_bytes;
- assert(buffer_usage_condition);
+ LTTNG_ASSERT(buffer_usage_condition);
diag("Validating initialization");
status = lttng_condition_buffer_usage_get_threshold_ratio(buffer_usage_condition, &threshold_ratio);
int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
struct fd_handle *handle;
- assert(fd >= 0);
+ LTTNG_ASSERT(fd >= 0);
fds[i] = fd;
handle = fd_handle_create(fd);
- assert(handle);
+ LTTNG_ASSERT(handle);
ret = lttng_payload_push_fd_handle(&payload, handle);
fd_handle_put(handle);
struct fd_handle *handle;
int fd = fcntl(STDOUT_FILENO, F_DUPFD, 0);
- assert(fd >= 0);
+ LTTNG_ASSERT(fd >= 0);
handle = fd_handle_create(fd);
- assert(handle);
+ LTTNG_ASSERT(handle);
ret = lttng_payload_push_fd_handle(&payload, handle);
fd_handle_put(handle);
struct lttng_payload payload;
const char * const test_description = "Same file descriptor returned when popping from different top-level views";
- assert(fd >= 0);
+ LTTNG_ASSERT(fd >= 0);
handle = fd_handle_create(fd);
- assert(handle);
+ LTTNG_ASSERT(handle);
lttng_payload_init(&payload);
const char * const test_description = "Different file descriptors returned when popping from descendant views";
lttng_payload_init(&payload);
- assert(handle1);
- assert(handle2);
+ LTTNG_ASSERT(handle1);
+ LTTNG_ASSERT(handle2);
diag("Validating descendant view fd pop behaviour");
ret = lttng_payload_push_fd_handle(&payload, handle1);
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
*
*/
-#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
session_unlock_list();
/* Session list must be 0 */
- assert(!session_list_count());
+ LTTNG_ASSERT(!session_list_count());
}
/*
session_lock_list();
for (i = 0; i < MAX_SESSIONS; i++) {
cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) {
- assert(session_get(iter));
+ LTTNG_ASSERT(session_get(iter));
ret = destroy_one_session(iter);
if (ret < 0) {
diag("session %d destroy failed", i);
the_health_sessiond = health_app_create(NR_HEALTH_SESSIOND_TYPES);
ht_cleanup_thread = launch_ht_cleanup_thread();
- assert(ht_cleanup_thread);
+ LTTNG_ASSERT(ht_cleanup_thread);
lttng_thread_put(ht_cleanup_thread);
diag("Sessions unit tests");
#include <stdlib.h>
#include <stdbool.h>
-#include <assert.h>
#include <string.h>
#include <stdarg.h>
#include <common/string-utils/string-utils.h>
size_t i, string_count;
split_ret = strutils_split(input, delim, escape_delim, &strings);
- assert(split_ret == 0);
+ LTTNG_ASSERT(split_ret == 0);
va_start(vl, escape_delim);
string_count = lttng_dynamic_pointer_array_get_count(&strings);
{
char *rw_pattern = strdup(pattern);
- assert(rw_pattern);
+ LTTNG_ASSERT(rw_pattern);
strutils_normalize_star_glob_pattern(rw_pattern);
ok(strcmp(rw_pattern, expected) == 0,
"strutils_normalize_star_glob_pattern() produces the expected result: `%s` -> `%s`",
*
*/
-#include <assert.h>
#include <string.h>
#include <tap/tap.h>
s_uri1 = "file/my/test/path";
size = uri_parse(s_uri1, &uri);
ok(size == -1, "Bad URI set to file/my/test/path");
- assert(!uri);
+ LTTNG_ASSERT(!uri);
s_uri1 = "net://:8999";
size = uri_parse(s_uri1, &uri);
ok(size == -1, "Bad URI set to net://:8999");
- assert(!uri);
+ LTTNG_ASSERT(!uri);
}
static void test_uri_cmp(void)
size1 = uri_parse(s_uri1, &uri1);
/* Sanity checks */
- assert(size1 == 2);
- assert(uri1[0].dtype == LTTNG_DST_IPV4);
- assert(uri1[0].utype == LTTNG_URI_DST);
- assert(uri1[0].stype == 0);
- assert(uri1[0].port == 0);
- assert(strlen(uri1[0].subdir) == 0);
- assert(strcmp(uri1[0].dst.ipv4, "127.0.0.1") == 0);
- assert(uri1[1].dtype == LTTNG_DST_IPV4);
- assert(uri1[1].utype == LTTNG_URI_DST);
- assert(uri1[1].stype == 0);
- assert(uri1[1].port == 0);
- assert(strlen(uri1[1].subdir) == 0);
- assert(strcmp(uri1[1].dst.ipv4, "127.0.0.1") == 0);
+ LTTNG_ASSERT(size1 == 2);
+ LTTNG_ASSERT(uri1[0].dtype == LTTNG_DST_IPV4);
+ LTTNG_ASSERT(uri1[0].utype == LTTNG_URI_DST);
+ LTTNG_ASSERT(uri1[0].stype == 0);
+ LTTNG_ASSERT(uri1[0].port == 0);
+ LTTNG_ASSERT(strlen(uri1[0].subdir) == 0);
+ LTTNG_ASSERT(strcmp(uri1[0].dst.ipv4, "127.0.0.1") == 0);
+ LTTNG_ASSERT(uri1[1].dtype == LTTNG_DST_IPV4);
+ LTTNG_ASSERT(uri1[1].utype == LTTNG_URI_DST);
+ LTTNG_ASSERT(uri1[1].stype == 0);
+ LTTNG_ASSERT(uri1[1].port == 0);
+ LTTNG_ASSERT(strlen(uri1[1].subdir) == 0);
+ LTTNG_ASSERT(strcmp(uri1[1].dst.ipv4, "127.0.0.1") == 0);
size2 = uri_parse(s_uri2, &uri2);
- assert(size2 == 2);
- assert(uri2[0].dtype == LTTNG_DST_IPV4);
- assert(uri2[0].utype == LTTNG_URI_DST);
- assert(uri2[0].stype == 0);
- assert(uri2[0].port == 8989);
- assert(strlen(uri2[0].subdir) == 0);
- assert(strcmp(uri2[0].dst.ipv4, "127.0.0.1") == 0);
- assert(uri2[1].dtype == LTTNG_DST_IPV4);
- assert(uri2[1].utype == LTTNG_URI_DST);
- assert(uri2[1].stype == 0);
- assert(uri2[1].port == 4242);
- assert(strlen(uri2[1].subdir) == 0);
- assert(strcmp(uri2[1].dst.ipv4, "127.0.0.1") == 0);
+ LTTNG_ASSERT(size2 == 2);
+ LTTNG_ASSERT(uri2[0].dtype == LTTNG_DST_IPV4);
+ LTTNG_ASSERT(uri2[0].utype == LTTNG_URI_DST);
+ LTTNG_ASSERT(uri2[0].stype == 0);
+ LTTNG_ASSERT(uri2[0].port == 8989);
+ LTTNG_ASSERT(strlen(uri2[0].subdir) == 0);
+ LTTNG_ASSERT(strcmp(uri2[0].dst.ipv4, "127.0.0.1") == 0);
+ LTTNG_ASSERT(uri2[1].dtype == LTTNG_DST_IPV4);
+ LTTNG_ASSERT(uri2[1].utype == LTTNG_URI_DST);
+ LTTNG_ASSERT(uri2[1].stype == 0);
+ LTTNG_ASSERT(uri2[1].port == 4242);
+ LTTNG_ASSERT(strlen(uri2[1].subdir) == 0);
+ LTTNG_ASSERT(strcmp(uri2[1].dst.ipv4, "127.0.0.1") == 0);
res = uri_compare(uri1, uri1);
*
*/
-#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
*
*/
-#include <assert.h>
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
unsigned int i, all_active_mask = 0;
/* Do you really want to test more than 4,294,967,295 combinations? */
- assert(fd_count <= 32);
+ LTTNG_ASSERT(fd_count <= 32);
for (i = 0; i < fd_count; i++) {
all_active_mask |= (1 << i);
*
*/
-#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
*
*/
-#include <assert.h>
#include <string.h>
#include <stdio.h>
*
*/
-#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <inttypes.h>
#define _LGPL_SOURCE
#include <getopt.h>
-#include <assert.h>
#include <arpa/inet.h>
#include <fcntl.h>
#include <stdarg.h>
*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
+#include <common/macros.h>
#include <lttng/tracef.h>
#include "signal-helper.h"
{
int ret;
- assert(path);
+ LTTNG_ASSERT(path);
ret = creat(path, S_IRWXU);
if (ret < 0) {
*
*/
-#include <assert.h>
#include <common/compat/time.h>
#include <common/time.h>
#include <fcntl.h>
#include <unistd.h>
#include <common/compat/errno.h>
+#include <common/macros.h>
#include "utils.h"
{
struct timespec delta;
- assert(t1 && t2);
+ LTTNG_ASSERT(t1 && t2);
delta.tv_sec = t2->tv_sec - t1->tv_sec;
delta.tv_nsec = t2->tv_nsec - t1->tv_nsec;
return ((int64_t) NSEC_PER_SEC * (int64_t) delta.tv_sec) +
* node;b;
* node;c;
*/
-#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
xmlNodePtr cur;
xmlChar *node_child_value_string = NULL;
- assert(output);
+ LTTNG_ASSERT(output);
size = (nodes) ? nodes->nodeNr : 0;
for (i = 0; i < size; ++i) {
- assert(nodes->nodeTab[i]);
+ LTTNG_ASSERT(nodes->nodeTab[i]);
if (nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
fprintf(stderr, "ERR:%s\n",
xmlXPathContextPtr xpathCtx = NULL;
xmlXPathObjectPtr xpathObj = NULL;
- assert(xml_path);
- assert(xpath);
+ LTTNG_ASSERT(xml_path);
+ LTTNG_ASSERT(xpath);
/* Parse the xml file */
doc = xmlParseFile(xml_path);
* argv[2] Path to the XML to be validated
*/
-#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <libxml/parser.h>
#include <lttng/lttng-error.h>
+#include <common/macros.h>
struct validation_ctx {
xmlSchemaParserCtxtPtr parser_ctx;
int ret;
xmlDocPtr doc = NULL;
- assert(xml_file_path);
- assert(ctx);
+ LTTNG_ASSERT(xml_file_path);
+ LTTNG_ASSERT(ctx);
/* Open the document */
doc = xmlParseFile(xml_file_path);