Force usage of assert() condition when NDEBUG is defined
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 20 Aug 2021 19:26:01 +0000 (15:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 23 Sep 2021 18:46:54 +0000 (14:46 -0400)
Reuse the BT2 approach to force the usage of the assertion condition
even when assert() are removed by the NDEBUG define.

See `BT_USE_EXPR()` macro and documentation in Babeltrace commit[0]:
  commit 1778c2a4134647150b199b2b57130817144446b0
  Author: Philippe Proulx <eeppeliteloop@gmail.com>
  Date:   Tue Apr 21 11:15:42 2020 -0400
  lib: assign a unique ID to each pre/postcond. and report it on failure

0: https://github.com/efficios/babeltrace/commit/1778c2a4134647150b199b2b57130817144446b0

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I3844b6ae7e95952d90033898397ac936540b785c

224 files changed:
doc/examples/trigger-condition-event-matches/notification-client.c
include/lttng/event-expr-internal.h
include/lttng/event-field-value-internal.h
include/lttng/health-internal.h
include/lttng/ref-internal.h
src/bin/lttng-consumerd/health-consumerd.c
src/bin/lttng-consumerd/lttng-consumerd.c
src/bin/lttng-relayd/backward-compatibility-group-by.c
src/bin/lttng-relayd/cmd-2-1.c
src/bin/lttng-relayd/cmd-2-11.c
src/bin/lttng-relayd/cmd-2-2.c
src/bin/lttng-relayd/cmd-2-4.c
src/bin/lttng-relayd/connection.c
src/bin/lttng-relayd/ctf-trace.c
src/bin/lttng-relayd/health-relayd.c
src/bin/lttng-relayd/index.c
src/bin/lttng-relayd/live.c
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/session.c
src/bin/lttng-relayd/sessiond-trace-chunks.c
src/bin/lttng-relayd/stream.c
src/bin/lttng-relayd/tracefile-array.c
src/bin/lttng-relayd/utils.c
src/bin/lttng-relayd/viewer-session.c
src/bin/lttng-relayd/viewer-stream.c
src/bin/lttng-sessiond/action-executor.c
src/bin/lttng-sessiond/agent-thread.c
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/buffer-registry.c
src/bin/lttng-sessiond/channel.c
src/bin/lttng-sessiond/clear.c
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/condition-internal.c
src/bin/lttng-sessiond/consumer.c
src/bin/lttng-sessiond/context.c
src/bin/lttng-sessiond/dispatch.c
src/bin/lttng-sessiond/event-notifier-error-accounting.c
src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/ht-cleanup.c
src/bin/lttng-sessiond/kernel-consumer.c
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/lttng-syscall.c
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/manage-consumer.c
src/bin/lttng-sessiond/modprobe.c
src/bin/lttng-sessiond/notification-thread-commands.c
src/bin/lttng-sessiond/notification-thread-events.c
src/bin/lttng-sessiond/notification-thread.c
src/bin/lttng-sessiond/notify-apps.c
src/bin/lttng-sessiond/rotation-thread.c
src/bin/lttng-sessiond/save.c
src/bin/lttng-sessiond/session.c
src/bin/lttng-sessiond/sessiond-config.c
src/bin/lttng-sessiond/snapshot.c
src/bin/lttng-sessiond/thread-utils.c
src/bin/lttng-sessiond/thread.c
src/bin/lttng-sessiond/timer.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/tracker.c
src/bin/lttng-sessiond/trigger-error-query.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-consumer.c
src/bin/lttng-sessiond/ust-metadata.c
src/bin/lttng-sessiond/ust-registry.c
src/bin/lttng-sessiond/utils.c
src/bin/lttng/commands/add_context.c
src/bin/lttng/commands/add_trigger.c
src/bin/lttng/commands/create.c
src/bin/lttng/commands/destroy.c
src/bin/lttng/commands/disable_channels.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/enable_channels.c
src/bin/lttng/commands/enable_events.c
src/bin/lttng/commands/help.c
src/bin/lttng/commands/list.c
src/bin/lttng/commands/list_triggers.c
src/bin/lttng/commands/load.c
src/bin/lttng/commands/metadata.c
src/bin/lttng/commands/regenerate.c
src/bin/lttng/commands/remove_trigger.c
src/bin/lttng/commands/rotate.c
src/bin/lttng/commands/save.c
src/bin/lttng/commands/set_session.c
src/bin/lttng/commands/snapshot.c
src/bin/lttng/commands/stop.c
src/bin/lttng/commands/track-untrack.c
src/bin/lttng/loglevel.c
src/bin/lttng/uprobe.c
src/bin/lttng/utils.c
src/common/actions/action.c
src/common/actions/firing-policy.c
src/common/actions/list.c
src/common/actions/notify.c
src/common/actions/path.c
src/common/actions/rate-policy.c
src/common/actions/rotate-session.c
src/common/actions/snapshot-session.c
src/common/actions/start-session.c
src/common/actions/stop-session.c
src/common/argpar/argpar.c
src/common/buffer-view.c
src/common/compat/directory-handle.c
src/common/compat/poll.c
src/common/compat/poll.h
src/common/conditions/buffer-usage.c
src/common/conditions/condition.c
src/common/conditions/event-rule-matches.c
src/common/conditions/session-consumed-size.c
src/common/conditions/session-rotation.c
src/common/config/session-config.c
src/common/consumer/consumer-metadata-cache.c
src/common/consumer/consumer-stream.c
src/common/consumer/consumer-timer.c
src/common/consumer/consumer.c
src/common/credentials.c
src/common/dynamic-array.h
src/common/dynamic-buffer.c
src/common/error-query.c
src/common/error.c
src/common/error.h
src/common/evaluation.c
src/common/event-expr/event-expr.c
src/common/event-field-value.c
src/common/event-rule/event-rule.c
src/common/event-rule/jul-logging.c
src/common/event-rule/kernel-kprobe.c
src/common/event-rule/kernel-syscall.c
src/common/event-rule/kernel-tracepoint.c
src/common/event-rule/kernel-uprobe.c
src/common/event-rule/log4j-logging.c
src/common/event-rule/python-logging.c
src/common/event-rule/user-tracepoint.c
src/common/fd-handle.c
src/common/fd-tracker/fd-tracker.c
src/common/fd-tracker/inode.c
src/common/filter-grammar-test.c
src/common/filter/filter-parser.y
src/common/filter/filter-visitor-generate-ir.c
src/common/filter/filter-visitor-ir-check-binary-comparator.c
src/common/filter/filter-visitor-ir-check-binary-op-nesting.c
src/common/filter/filter-visitor-ir-normalize-glob-patterns.c
src/common/filter/filter-visitor-ir-validate-globbing.c
src/common/filter/filter-visitor-ir-validate-string.c
src/common/filter/filter-visitor-xml.c
src/common/hashtable/hashtable.c
src/common/hashtable/utils.c
src/common/health/health.c
src/common/index-allocator.c
src/common/index/index.c
src/common/kernel-consumer/kernel-consumer.c
src/common/kernel-ctl/kernel-ctl.c
src/common/kernel-probe.c
src/common/log-level-rule.c
src/common/macros.h
src/common/mi-lttng.c
src/common/notification.c
src/common/optional.h
src/common/payload.c
src/common/pipe.c
src/common/readwrite.c
src/common/relayd/relayd.c
src/common/runas.c
src/common/session-descriptor.c
src/common/sessiond-comm/inet.c
src/common/sessiond-comm/inet6.c
src/common/sessiond-comm/sessiond-comm.c
src/common/shm.c
src/common/snapshot.c
src/common/spawn-viewer.c
src/common/string-utils/string-utils.c
src/common/trace-chunk.c
src/common/trigger.c
src/common/unix.c
src/common/uri.c
src/common/userspace-probe.c
src/common/ust-consumer/ust-consumer.c
src/common/utils.c
src/common/waiter.c
src/lib/lttng-ctl/channel.c
src/lib/lttng-ctl/clear.c
src/lib/lttng-ctl/destruction-handle.c
src/lib/lttng-ctl/event.c
src/lib/lttng-ctl/load.c
src/lib/lttng-ctl/lttng-ctl-health.c
src/lib/lttng-ctl/lttng-ctl.c
src/lib/lttng-ctl/rotate.c
src/lib/lttng-ctl/save.c
src/lib/lttng-ctl/snapshot.c
tests/regression/tools/live/live_test.c
tests/regression/tools/notification/base_client.c
tests/regression/tools/notification/consumer_testpoints.c
tests/regression/tools/notification/notification.c
tests/regression/tools/notification/rotation.c
tests/regression/tools/notification/sessiond_testpoints.c
tests/regression/tools/trigger/hidden/hidden_trigger.c
tests/regression/tools/trigger/name/trigger_name.c
tests/regression/tools/trigger/utils/register-some-triggers.c
tests/unit/test_action.c
tests/unit/test_condition.c
tests/unit/test_directory_handle.c
tests/unit/test_event_rule.c
tests/unit/test_fd_tracker.c
tests/unit/test_kernel_data.c
tests/unit/test_kernel_probe.c
tests/unit/test_log_level_rule.c
tests/unit/test_notification.c
tests/unit/test_payload.c
tests/unit/test_rate_policy.c
tests/unit/test_relayd_backward_compat_group_by_session.c
tests/unit/test_session.c
tests/unit/test_string_utils.c
tests/unit/test_uri.c
tests/unit/test_ust_data.c
tests/unit/test_utils_compat_poll.c
tests/unit/test_utils_expand_path.c
tests/unit/test_utils_parse_size_suffix.c
tests/unit/test_utils_parse_time_suffix.c
tests/utils/testapp/gen-ust-events/gen-ust-events.c
tests/utils/testapp/gen-ust-tracef/gen-ust-tracef.c
tests/utils/utils.c
tests/utils/xml-utils/extract_xml.c
tests/utils/xml-utils/validate_xml.c

index 7437b6a3cd5be880d63d384240fef3d6350afa2c..4a251556938d335630652d3208d599ecceb78a54 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <lttng/lttng.h>
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdbool.h>
 #include <stddef.h>
@@ -17,6 +16,8 @@
 #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);
@@ -84,13 +85,13 @@ static void print_one_event_expr(const struct lttng_event_expr *event_expr)
 
                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);
 
@@ -257,7 +258,7 @@ static int print_array(const struct lttng_condition *condition,
                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);
 
@@ -308,7 +309,7 @@ static int print_captures(struct lttng_notification *notification)
        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 =
index e51a770ced3492fea1ead5c03a69c0100f093abf..9d717b8674c0e1a9e08ad635c03717f358ed91b0 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef LTTNG_EVENT_EXPR_INTERNAL_H
 #define LTTNG_EVENT_EXPR_INTERNAL_H
 
-#include <assert.h>
 #include <common/macros.h>
 #include <lttng/event-expr.h>
 
@@ -51,7 +50,7 @@ struct lttng_event_expr_array_field_element {
 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 ||
index e0b67e94da4f4ce794a489002a63f21f2c6117bd..b7d513efde8b14a4a04aca62fb0081c06a516dd9 100644 (file)
@@ -8,7 +8,6 @@
 #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>
index 80aa23fd549374e7cfb008b73c91e05c027d10e7..ceda0a8dd5b027321c514885ea6d4124e717b710 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/compat/time.h>
 #include <pthread.h>
 #include <urcu/tls-compat.h>
@@ -69,12 +68,12 @@ extern DECLARE_URCU_TLS(struct health_state, health_state);
 /*
  * 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);
@@ -82,13 +81,13 @@ static inline void health_poll_entry(void)
 
 /*
  * 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);
index 5c17145e142075a1ead9efb4d73376d5ab2f5cc3..a02ae4cdc1229a627226e74991cebb49887b4820 100644 (file)
@@ -10,7 +10,6 @@
  *
  */
 
-#include <assert.h>
 
 typedef void (*lttng_release_func)(void *);
 
@@ -22,7 +21,7 @@ struct lttng_ref {
 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;
 }
@@ -30,18 +29,18 @@ void lttng_ref_init(struct lttng_ref *ref, lttng_release_func 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);
        }
index ffa0f3d0df2651993196dbe0cd86858955719561..90b4b1e12439eb9dcc34a265c20c37a3608668ce 100644 (file)
@@ -25,7 +25,6 @@
 #include <poll.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <assert.h>
 #include <urcu/compiler.h>
 #include <ulimit.h>
 #include <inttypes.h>
@@ -298,7 +297,7 @@ restart:
 
                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++) {
index 5fffa20e92a4c830df46c78ae6f250c3e363f26f..dbcda885eede04a0a92a3189a975247de80ce4f2 100644 (file)
@@ -26,7 +26,6 @@
 #include <poll.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <assert.h>
 #include <urcu/compiler.h>
 #include <ulimit.h>
 
index eaae4e9417edb7b1c5af88e3040004d5041ca50c..9e144f9f52b1a68d4273f544196048d8f93eb70c 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "common/time.h"
-#include <assert.h>
 #include <regex.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -44,9 +43,9 @@ char *backward_compat_group_by_session(const char *path,
        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);
@@ -165,7 +164,7 @@ char *backward_compat_group_by_session(const char *path,
                        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) {
@@ -207,8 +206,8 @@ char *backward_compat_group_by_session(const char *path,
                 * "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) {
index 5e2ed35ebe3e1ce6a30435a5f41f823026deb271..1f939dd07428a45fdee4ea610c8cebf45dbd2dd1 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
index cd23f22d6f3405bcf9913db0c4d97dff7b6736dc..aa97dd0f0e0ddfd3e36f7e7857876f70c80864a7 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/common.h>
index c2bc1a3a3be97acfeb28d877dab7ebcd91517ad6..bd18714af840626d0291382205a33bd6a4054563 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
index 02edb7713e54245b2c55beb6ec6ffb94ed4499e6..7abc371f06732056bf61435d8bf71750cdb3a774 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/sessiond-comm/relayd.h>
index d657efb4f97eb5ec8fc75260505b6f40ae8f2eec..e50784bf5aa44f6205d2f0624db3779dae2886eb 100644 (file)
@@ -27,7 +27,7 @@ struct relay_connection *connection_get_by_sock(struct lttng_ht *relay_connectio
        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),
@@ -140,7 +140,7 @@ static void connection_release(struct urcu_ref *ref)
 
                iter.iter.node = &conn->sock_n.node;
                ret = lttng_ht_del(conn->socket_ht, &iter);
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
        }
 
        if (conn->session) {
@@ -165,7 +165,7 @@ void connection_put(struct relay_connection *conn)
 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;
@@ -176,9 +176,9 @@ int connection_set_session(struct relay_connection *conn,
 {
        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)) {
index 5f77d676963f7fc97c519baf71df8627cb3f28ea..f2af1a3d0fb17229e2939e5e294deeae3ecc443b 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/utils.h>
@@ -41,7 +40,7 @@ static void ctf_trace_destroy(struct ctf_trace *trace)
         * 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);
@@ -58,7 +57,7 @@ static void ctf_trace_release(struct urcu_ref *ref)
 
        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);
 }
 
index 3ffb9b75968c7586b28666409579a58774f36488..57fa70f225c8b23a08ff27967b8656063d7b0359 100644 (file)
@@ -25,7 +25,6 @@
 #include <poll.h>
 #include <unistd.h>
 #include <sys/mman.h>
-#include <assert.h>
 #include <urcu/compiler.h>
 #include <inttypes.h>
 
@@ -441,7 +440,7 @@ restart:
 
                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++) {
index ff27d958a0aebd6eb0f7816544eaa1f686ee192d..f7d22b3aac25bef8313942c20d4dd99d615ce164 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/utils.h>
@@ -218,7 +217,7 @@ static void index_release(struct urcu_ref *ref)
                /* 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--;
        }
 
@@ -246,7 +245,7 @@ void relay_index_put(struct relay_index *index)
         * 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();
 }
index e884cdc8a03cc18a1ab06a5570a730fbc9f9144a..13078026b220b7e3f9e6c3e1c8a0e3009e3e7766 100644 (file)
@@ -281,7 +281,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
        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) {
@@ -404,7 +404,7 @@ static int make_viewer_streams(struct relay_session *relay_session,
 
                                        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;
                                }
@@ -1113,7 +1113,7 @@ int viewer_get_new_streams(struct relay_connection *conn)
        uint64_t session_id;
        bool closed = false;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        DBG("Get new streams received");
 
@@ -1235,7 +1235,7 @@ int viewer_attach_session(struct relay_connection *conn)
        bool closed = false;
        uint64_t session_id;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        health_code_update();
 
@@ -1518,7 +1518,7 @@ static int check_index_status(struct relay_viewer_stream *vstream,
                                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));
        }
@@ -1542,7 +1542,7 @@ void viewer_stream_rotate_to_trace_chunk(struct relay_viewer_stream *vstream,
                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;
@@ -1567,7 +1567,7 @@ int viewer_get_next_index(struct relay_connection *conn)
        struct ctf_trace *ctf_trace = NULL;
        struct relay_viewer_stream *metadata_viewer_stream = NULL;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        DBG("Viewer get next index");
 
@@ -1669,7 +1669,7 @@ int viewer_get_next_index(struct relay_connection *conn)
                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);
@@ -1941,7 +1941,7 @@ int viewer_get_metadata(struct relay_connection *conn)
        struct lttng_viewer_metadata_packet reply;
        struct relay_viewer_stream *vstream = NULL;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        DBG("Relay get metadata");
 
@@ -2026,7 +2026,7 @@ int viewer_get_metadata(struct relay_connection *conn)
                                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);
@@ -2238,7 +2238,7 @@ int viewer_detach_session(struct relay_connection *conn)
 
        DBG("Viewer detach session received");
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        health_code_update();
 
index bdc27475eeaf3c89552ca3cd507ff8b5235c96c8..fb1817cd015fdc11ffa3e06c385c79d64eb50fc8 100644 (file)
@@ -1182,7 +1182,7 @@ restart:
                                        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");
@@ -1438,7 +1438,7 @@ static int relay_create_session(const struct lttcomm_relayd_hdr *recv_hdr,
                ret = -1;
                goto send_reply;
        }
-       assert(!conn->session);
+       LTTNG_ASSERT(!conn->session);
        conn->session = session;
        DBG("Created session %" PRIu64, session->id);
 
@@ -1629,7 +1629,7 @@ static int relay_add_stream(const struct lttcomm_relayd_hdr *recv_hdr,
                } 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(
@@ -2216,8 +2216,8 @@ static int relay_begin_data_pending(const struct lttcomm_relayd_hdr *recv_hdr,
        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");
 
@@ -2389,7 +2389,7 @@ static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr,
        struct relay_stream *stream;
        size_t msg_len;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        DBG("Relay receiving index");
 
@@ -2473,7 +2473,7 @@ static int relay_streams_sent(const struct lttcomm_relayd_hdr *recv_hdr,
        ssize_t send_ret;
        struct lttcomm_relayd_generic_reply reply;
 
-       assert(conn);
+       LTTNG_ASSERT(conn);
 
        DBG("Relay receiving streams_sent");
 
@@ -2777,7 +2777,7 @@ static int relay_create_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr,
                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) {
@@ -3339,8 +3339,8 @@ static enum relay_connection_status relay_process_control_receive_payload(
                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;
@@ -3394,7 +3394,7 @@ static enum relay_connection_status relay_process_control_receive_header(
        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,
@@ -3412,8 +3412,8 @@ static enum relay_connection_status relay_process_control_receive_header(
                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;
@@ -3505,7 +3505,7 @@ static enum relay_connection_status relay_process_data_receive_header(
        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,
@@ -3523,8 +3523,8 @@ static enum relay_connection_status relay_process_data_receive_header(
                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;
@@ -3660,7 +3660,7 @@ static enum relay_connection_status relay_process_data_receive_payload(
 
                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) {
@@ -3916,7 +3916,7 @@ restart:
 
                                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) {
@@ -3929,7 +3929,7 @@ restart:
                                        }
                                        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;
@@ -4027,7 +4027,7 @@ restart:
                        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;
index e1065549997b72c933ae0bdd0fae145a2a7fec68..0a535cf877b581945260266f117cab69071f751d 100644 (file)
@@ -292,9 +292,9 @@ struct relay_session *session_create(const char *session_name,
        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");
@@ -410,7 +410,7 @@ struct relay_session *session_create(const char *session_name,
                        goto error;
                }
 
-               assert(session_output_directory);
+               LTTNG_ASSERT(session_output_directory);
                session->output_directory = session_output_directory;
        } else if (!id_sessiond) {
                /*
@@ -509,14 +509,14 @@ static void destroy_session(struct relay_session *session)
        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);
index 1065234739a8d6e529c1dc58ba3dde24140c2666..2f98c3d6362d25c84cd7e0458ddd9218080677b4 100644 (file)
@@ -287,7 +287,7 @@ void sessiond_trace_chunk_registry_destroy(
 {
        int ret = cds_lfht_destroy(sessiond_registry->ht, NULL);
 
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
        free(sessiond_registry);
 }
 
index 6759bed17fd7a16d4703f3341eeaf9b2a1c0a390..1eaca14ec934e27c6a36f3c986bce70d09340a85 100644 (file)
@@ -216,7 +216,7 @@ static int rotate_truncate_stream(struct relay_stream *stream)
         * trace chunk.
         */
        acquired_reference = lttng_trace_chunk_get(stream->trace_chunk);
-       assert(acquired_reference);
+       LTTNG_ASSERT(acquired_reference);
        previous_chunk = stream->trace_chunk;
 
        /*
@@ -225,12 +225,12 @@ static int rotate_truncate_stream(struct relay_stream *stream)
         * 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;
@@ -242,7 +242,7 @@ static int rotate_truncate_stream(struct relay_stream *stream)
                goto end;
        }
 
-       assert(stream->file);
+       LTTNG_ASSERT(stream->file);
        /*
         * Seek the current tracefile to the position at which the rotation
         * should have occurred.
@@ -506,7 +506,7 @@ static int try_rotate_stream_index(struct relay_stream *stream)
                 * 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);
@@ -551,7 +551,7 @@ static int stream_set_trace_chunk(struct relay_stream *stream,
 
        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) {
@@ -726,7 +726,7 @@ static void stream_unpublish(struct relay_stream *stream)
 
                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) {
@@ -809,7 +809,7 @@ static void stream_release(struct urcu_ref *ref)
 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.
@@ -841,7 +841,7 @@ int stream_set_pending_rotation(struct relay_stream *stream,
                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);
 
@@ -1132,7 +1132,7 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
        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);
index 05ce3ad34520c9f09c7bb91fe2b235684c2a106d..996c43e45363ca51bdead1a70323210e21f332ab 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <common/common.h>
 #include <common/utils.h>
 #include <common/defaults.h>
@@ -168,7 +167,7 @@ bool tracefile_array_seq_in_file(struct tracefile_array *tfa,
                 */
                return true;
        }
-       assert(file_index < tfa->count);
+       LTTNG_ASSERT(file_index < tfa->count);
        if (seq == -1ULL) {
                return false;
        }
index 4646a88a6cb44e34e822ad4bfb45c52a07dca2d6..599f7ff819f3cf4855ca9f7b47ae27d6343c0493 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -69,7 +68,7 @@ exit:
  */
 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);
index ed5a94ea8ae98f3dd3650cb6d7a3f70f7915bf52..b2aba61bc73f63571381a361fd6b711284ce1afb 100644 (file)
@@ -77,7 +77,7 @@ enum lttng_viewer_attach_return_code viewer_session_attach(
        } 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,
index 00616569ba0b147e7ce63181bcf82e21e84596c1..494b0e6211d22db194bb60ae6d9b7d30a8b99434 100644 (file)
@@ -54,7 +54,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                const bool acquired_reference = lttng_trace_chunk_get(
                                trace_chunk);
 
-               assert(acquired_reference);
+               LTTNG_ASSERT(acquired_reference);
        }
 
        vstream->stream_file.trace_chunk = trace_chunk;
@@ -209,7 +209,7 @@ static void viewer_stream_unpublish(struct relay_viewer_stream *vstream)
 
        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)
@@ -347,7 +347,7 @@ int viewer_stream_rotate(struct relay_viewer_stream *vstream)
                 * 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.
                 */
index 14ac8103b1fe0c7738314c7ac962ca538234cb29..94b819c46e5e4baeef67caabe6f844a85d20b8c3 100644 (file)
@@ -169,7 +169,7 @@ static const char *get_action_name(const struct lttng_action *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);
 
        return lttng_action_type_string(action_type);
 }
@@ -676,7 +676,7 @@ static int action_executor_generic_handler(struct action_executor *executor,
        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)) {
@@ -737,7 +737,7 @@ static void *action_executor_thread(void *_data)
 {
        struct action_executor *executor = _data;
 
-       assert(executor);
+       LTTNG_ASSERT(executor);
 
        health_register(the_health_sessiond,
                        HEALTH_SESSIOND_TYPE_ACTION_EXECUTOR);
@@ -785,7 +785,7 @@ static void *action_executor_thread(void *_data)
 
                        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,
@@ -837,7 +837,7 @@ static void clean_up_action_executor_thread(void *_data)
 {
        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);
@@ -906,7 +906,7 @@ enum action_executor_status action_executor_enqueue_trigger(
        struct action_work_item *work_item;
        bool signal = false;
 
-       assert(trigger);
+       LTTNG_ASSERT(trigger);
 
        pthread_mutex_lock(&executor->work.lock);
        /* Check for queue overflow. */
@@ -931,7 +931,7 @@ enum action_executor_status action_executor_enqueue_trigger(
                const bool reference_acquired =
                                notification_client_list_get(client_list);
 
-               assert(reference_acquired);
+               LTTNG_ASSERT(reference_acquired);
        }
 
        *work_item = (typeof(*work_item)){
@@ -994,21 +994,21 @@ static int add_action_to_subitem_array(struct lttng_action *action,
                },
        };
 
-       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) {
@@ -1030,22 +1030,22 @@ static int add_action_to_subitem_array(struct lttng_action *action,
        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:
@@ -1107,7 +1107,7 @@ static int populate_subitem_array_from_trigger(struct lttng_trigger *trigger,
        struct lttng_action *action;
 
        action = lttng_trigger_get_action(trigger);
-       assert(action);
+       LTTNG_ASSERT(action);
 
        return add_action_to_subitem_array(action, subitems);
 }
index 2f0fd6f914e4f597f76dc0036cfe0c2ad1d8b8b4..f2ee4c0415b855f094d6704dc0cbfe18962bb0cd 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/sessiond-comm/sessiond-comm.h>
@@ -63,7 +62,7 @@ static void update_agent_app(const struct agent_app *app)
        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)) {
@@ -113,8 +112,8 @@ static struct lttcomm_sock *init_tcp_socket(void)
         * 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);
@@ -194,7 +193,7 @@ static void destroy_tcp_socket(struct lttcomm_sock *sock)
        int ret;
        uint16_t port;
 
-       assert(sock);
+       LTTNG_ASSERT(sock);
 
        ret = lttcomm_sock_get_port(sock, &port);
        if (ret) {
@@ -263,7 +262,7 @@ static int accept_agent_connection(
        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) {
@@ -322,7 +321,7 @@ bool agent_tracing_is_enabled(void)
        int enabled;
 
        enabled = uatomic_read(&agent_tracing_enabled);
-       assert(enabled != -1);
+       LTTNG_ASSERT(enabled != -1);
        return enabled == 1;
 }
 
@@ -369,7 +368,7 @@ static void *thread_agent_management(void *data)
        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);
@@ -388,7 +387,7 @@ static void *thread_agent_management(void *data)
                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) {
@@ -454,7 +453,7 @@ restart:
                                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);
index 3815491157a9c9c08cee588c364dcb643fc7d216..77846b4f2251e7891d4f32b5ad196da4f4535f53 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <urcu/uatomic.h>
 #include <urcu/rculist.h>
 
@@ -97,8 +96,8 @@ static int ht_match_event_by_name(struct cds_lfht_node *node,
        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;
@@ -127,8 +126,8 @@ static int ht_match_event(struct cds_lfht_node *node,
        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;
@@ -177,9 +176,9 @@ static void add_unique_agent_event(struct lttng_ht *ht,
        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;
@@ -189,7 +188,7 @@ static void add_unique_agent_event(struct lttng_ht *ht,
        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);
 }
 
 /*
@@ -231,7 +230,7 @@ static int send_header(struct lttcomm_sock *sock, uint64_t data_size,
        ssize_t size;
        struct lttcomm_agent_hdr msg;
 
-       assert(sock);
+       LTTNG_ASSERT(sock);
 
        memset(&msg, 0, sizeof(msg));
        msg.data_size = htobe64(data_size);
@@ -261,8 +260,8 @@ static int send_payload(struct lttcomm_sock *sock, const void *data,
        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) {
@@ -286,8 +285,8 @@ static int recv_reply(struct lttcomm_sock *sock, void *buf, size_t 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) {
@@ -317,9 +316,9 @@ static ssize_t list_events(struct agent_app *app, struct lttng_event **events)
        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);
@@ -407,9 +406,9 @@ static int enable_event(const struct agent_app *app, struct agent_event *event)
        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);
@@ -520,10 +519,10 @@ static int app_context_op(const struct agent_app *app,
        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",
@@ -603,9 +602,9 @@ static int disable_event(struct agent_app *app, struct agent_event *event)
        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);
@@ -660,8 +659,8 @@ error:
  */
 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);
 
@@ -681,7 +680,7 @@ int agent_enable_event(struct agent_event *event,
        struct agent_app *app;
        struct lttng_ht_iter iter;
 
-       assert(event);
+       LTTNG_ASSERT(event);
 
        rcu_read_lock();
 
@@ -723,7 +722,7 @@ struct agent_app_ctx *create_app_ctx(const struct lttng_event_context *ctx)
                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;
@@ -752,7 +751,7 @@ int agent_enable_context(const struct lttng_event_context *ctx,
        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;
@@ -803,7 +802,7 @@ int agent_disable_event(struct agent_event *event,
        struct agent_app *app;
        struct lttng_ht_iter iter;
 
-       assert(event);
+       LTTNG_ASSERT(event);
        if (!AGENT_EVENT_IS_ENABLED(event)) {
                goto end;
        }
@@ -834,7 +833,7 @@ int agent_disable_event(struct agent_event *event,
        }
 
        /* event->enabled_count is now 0. */
-       assert(!AGENT_EVENT_IS_ENABLED(event));
+       LTTNG_ASSERT(!AGENT_EVENT_IS_ENABLED(event));
 
 error:
        rcu_read_unlock();
@@ -855,7 +854,7 @@ static int disable_context(struct agent_app_ctx *ctx,
        struct agent_app *app;
        struct lttng_ht_iter iter;
 
-       assert(ctx);
+       LTTNG_ASSERT(ctx);
 
        rcu_read_lock();
        DBG2("Disabling agent application context %s:%s",
@@ -891,7 +890,7 @@ int agent_list_events(struct lttng_event **events,
        struct lttng_event *tmp_events = NULL;
        struct lttng_ht_iter iter;
 
-       assert(events);
+       LTTNG_ASSERT(events);
 
        DBG2("Agent listing events for domain %d", domain);
 
@@ -970,7 +969,7 @@ struct agent_app *agent_create_app(pid_t pid, enum lttng_domain_type domain,
 {
        struct agent_app *app;
 
-       assert(sock);
+       LTTNG_ASSERT(sock);
 
        app = zmalloc(sizeof(*app));
        if (!app) {
@@ -1000,7 +999,7 @@ struct agent_app *agent_find_app_by_sock(int sock)
        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);
@@ -1023,7 +1022,7 @@ error:
  */
 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);
@@ -1039,13 +1038,13 @@ void agent_delete_app(struct agent_app *app)
        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);
 }
 
 /*
@@ -1055,7 +1054,7 @@ void agent_delete_app(struct agent_app *app)
  */
 void agent_destroy_app(struct agent_app *app)
 {
-       assert(app);
+       LTTNG_ASSERT(app);
 
        if (app->sock) {
                app->sock->ops->close(app->sock);
@@ -1074,7 +1073,7 @@ int agent_init(struct agent *agt)
 {
        int ret;
 
-       assert(agt);
+       LTTNG_ASSERT(agt);
 
        agt->events = lttng_ht_new(0, LTTNG_HT_TYPE_STRING);
        if (!agt->events) {
@@ -1095,8 +1094,8 @@ error:
  */
 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);
 
@@ -1174,9 +1173,9 @@ error:
  */
 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);
@@ -1191,10 +1190,10 @@ int agent_add_context(const struct lttng_event_context *ctx, struct agent *agt)
        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) {
@@ -1223,10 +1222,10 @@ void agent_find_events_by_name(const char *name, struct agent *agt,
        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;
@@ -1260,17 +1259,17 @@ struct agent_event *agent_find_event_by_trigger(
        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:
@@ -1297,12 +1296,12 @@ struct agent_event *agent_find_event_by_trigger(
        }
 
        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);
@@ -1359,9 +1358,9 @@ struct agent_event *agent_find_event(const char *name,
        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;
@@ -1391,7 +1390,7 @@ error:
  */
 void agent_destroy_event(struct agent_event *event)
 {
-       assert(event);
+       LTTNG_ASSERT(event);
 
        free(event->filter);
        free(event->filter_expression);
@@ -1417,7 +1416,7 @@ void agent_destroy(struct agent *agt)
        struct lttng_ht_iter iter;
        struct agent_app_ctx *ctx;
 
-       assert(agt);
+       LTTNG_ASSERT(agt);
 
        DBG3("Agent destroy");
 
@@ -1436,7 +1435,7 @@ void agent_destroy(struct agent *agt)
                (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);
        }
 
@@ -1466,7 +1465,7 @@ void agent_destroy_app_by_sock(int sock)
 {
        struct agent_app *app;
 
-       assert(sock >= 0);
+       LTTNG_ASSERT(sock >= 0);
 
        /*
         * Not finding an application is a very important error that should NEVER
@@ -1475,7 +1474,7 @@ void agent_destroy_app_by_sock(int sock)
         */
        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);
@@ -1522,8 +1521,8 @@ void agent_update(const struct agent *agt, const struct agent_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);
 
@@ -1591,7 +1590,7 @@ void agent_by_event_notifier_domain_ht_destroy(void)
                const int ret = lttng_ht_del(
                                the_trigger_agents_ht_by_domain, &iter);
 
-               assert(ret == 0);
+               LTTNG_ASSERT(ret == 0);
                agent_destroy(agent);
        }
 
@@ -1607,7 +1606,7 @@ struct agent *agent_find_by_event_notifier_domain(
        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));
index 32fcbfb5f9ad55276444057e1aa389bd277f8356..3390f870ae24537149b7c8396eac24902cf5e7c0 100644 (file)
@@ -41,11 +41,11 @@ static int ht_match_reg_uid(struct cds_lfht_node *node, const void *_key)
        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 ||
@@ -69,7 +69,7 @@ static unsigned long ht_hash_reg_uid(const void *_key, unsigned long seed)
        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);
@@ -81,9 +81,9 @@ static unsigned long ht_hash_reg_uid(const void *_key, unsigned long 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;
 
@@ -102,7 +102,7 @@ int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid
        int ret = 0;
        struct buffer_reg_uid *reg = NULL;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        reg = zmalloc(sizeof(*reg));
        if (!reg) {
@@ -159,7 +159,7 @@ void buffer_reg_uid_add(struct buffer_reg_uid *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);
@@ -167,7 +167,7 @@ void buffer_reg_uid_add(struct buffer_reg_uid *reg)
        rcu_read_lock();
        nodep = cds_lfht_add_unique(ht->ht, ht->hash_fct(reg, lttng_ht_seed),
                        ht->match_fct, reg, &reg->node.node);
-       assert(nodep == &reg->node.node);
+       LTTNG_ASSERT(nodep == &reg->node.node);
        rcu_read_unlock();
 }
 
@@ -212,9 +212,9 @@ end:
 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");
 }
@@ -230,7 +230,7 @@ int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp,
        int ret = 0;
        struct buffer_reg_pid *reg = NULL;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        reg = zmalloc(sizeof(*reg));
        if (!reg) {
@@ -282,7 +282,7 @@ error:
  */
 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);
@@ -365,7 +365,7 @@ int buffer_reg_channel_create(uint64_t key, struct buffer_reg_channel **regp)
 {
        struct buffer_reg_channel *reg;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        DBG3("Buffer registry channel create with key: %" PRIu64, key);
 
@@ -395,7 +395,7 @@ int buffer_reg_stream_create(struct buffer_reg_stream **regp)
 {
        struct buffer_reg_stream *reg;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        DBG3("Buffer registry creating stream");
 
@@ -416,8 +416,8 @@ int buffer_reg_stream_create(struct buffer_reg_stream **regp)
 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);
@@ -431,8 +431,8 @@ void buffer_reg_stream_add(struct buffer_reg_stream *stream,
 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);
@@ -454,14 +454,14 @@ struct buffer_reg_channel *buffer_reg_channel_find(uint64_t key,
        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;
        }
 
@@ -504,7 +504,7 @@ void buffer_reg_stream_destroy(struct buffer_reg_stream *regp,
                break;
        }
        default:
-               assert(0);
+               abort();
        }
 
        free(regp);
@@ -521,12 +521,12 @@ void buffer_reg_channel_remove(struct buffer_reg_session *session,
        int ret;
        struct lttng_ht_iter iter;
 
-       assert(session);
-       assert(regp);
+       LTTNG_ASSERT(session);
+       LTTNG_ASSERT(regp);
 
        iter.iter.node = &regp->node.node;
        ret = lttng_ht_del(session->channels, &iter);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
 }
 
 /*
@@ -565,7 +565,7 @@ void buffer_reg_channel_destroy(struct buffer_reg_channel *regp,
                break;
        }
        default:
-               assert(0);
+               abort();
        }
 
        free(regp);
@@ -591,7 +591,7 @@ static void buffer_reg_session_destroy(struct buffer_reg_session *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();
@@ -604,7 +604,7 @@ static void buffer_reg_session_destroy(struct buffer_reg_session *regp,
                free(regp->reg.ust);
                break;
        default:
-               assert(0);
+               abort();
        }
 
        free(regp);
@@ -619,12 +619,12 @@ void buffer_reg_uid_remove(struct buffer_reg_uid *regp)
        int ret;
        struct lttng_ht_iter iter;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        rcu_read_lock();
        iter.iter.node = &regp->node.node;
        ret = lttng_ht_del(buffer_registry_uid, &iter);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
        rcu_read_unlock();
 }
 
@@ -688,7 +688,7 @@ void buffer_reg_uid_destroy(struct buffer_reg_uid *regp,
                }
                break;
        default:
-               assert(0);
+               abort();
                rcu_read_unlock();
                return;
        }
@@ -708,11 +708,11 @@ void buffer_reg_pid_remove(struct buffer_reg_pid *regp)
        int ret;
        struct lttng_ht_iter iter;
 
-       assert(regp);
+       LTTNG_ASSERT(regp);
 
        iter.iter.node = &regp->node.node;
        ret = lttng_ht_del(buffer_registry_pid, &iter);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
 }
 
 /*
index 073965ac67bd708e6184915d62431f5342312675..e84da039a8e25d1f9a7ef6bfc24d0cdb0d7a0f1d 100644 (file)
@@ -55,7 +55,7 @@ struct lttng_channel *channel_new_default_attr(int dom,
 
        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;
@@ -146,8 +146,8 @@ int channel_kernel_disable(struct ltt_kernel_session *ksession,
        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) {
@@ -178,8 +178,8 @@ int channel_kernel_enable(struct ltt_kernel_session *ksession,
 {
        int ret;
 
-       assert(ksession);
-       assert(kchan);
+       LTTNG_ASSERT(ksession);
+       LTTNG_ASSERT(kchan);
 
        if (kchan->enabled == 0) {
                ret = kernel_enable_channel(kchan);
@@ -229,7 +229,7 @@ int channel_kernel_create(struct ltt_kernel_session *ksession,
        int ret;
        struct lttng_channel *defattr = NULL;
 
-       assert(ksession);
+       LTTNG_ASSERT(ksession);
 
        /* Creating channel attributes if needed */
        if (attr == NULL) {
@@ -289,8 +289,8 @@ int channel_ust_enable(struct ltt_ust_session *usess,
 {
        int ret = LTTNG_OK;
 
-       assert(usess);
-       assert(uchan);
+       LTTNG_ASSERT(usess);
+       LTTNG_ASSERT(uchan);
 
        /* If already enabled, everything is OK */
        if (uchan->enabled) {
@@ -340,7 +340,7 @@ int channel_ust_create(struct ltt_ust_session *usess,
        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) {
@@ -514,8 +514,8 @@ int channel_ust_disable(struct ltt_ust_session *usess,
 {
        int ret = LTTNG_OK;
 
-       assert(usess);
-       assert(uchan);
+       LTTNG_ASSERT(usess);
+       LTTNG_ASSERT(uchan);
 
        /* Already disabled */
        if (uchan->enabled == 0) {
index 3ae70ea2fa5fd462d38e816a9328c58aaebc8081..e699caffc51ad24c6ae560aa253622beca46888f 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <string.h>
 #include <unistd.h>
index c10b9bc87030f6183382d9c859a57d381cdfc0e0..ed9f2af3e4134bef0ad57ba799296053598a8d36 100644 (file)
@@ -168,7 +168,7 @@ static void update_lttng_msg(struct command_ctx *cmd_ctx, size_t cmd_header_len,
        };
        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;
 
@@ -425,8 +425,8 @@ static int copy_session_consumer(int domain, struct ltt_session *session)
        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:
@@ -490,9 +490,9 @@ static int create_ust_session(struct ltt_session *session,
        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:
@@ -560,7 +560,7 @@ static int create_kernel_session(struct ltt_session *session)
        }
 
        /* 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);
@@ -934,7 +934,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int *sock,
                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;
 
@@ -2149,7 +2149,7 @@ error_add_context:
                        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);
@@ -2413,7 +2413,7 @@ error_add_context:
                        goto error;
                }
 
-               assert(return_triggers);
+               LTTNG_ASSERT(return_triggers);
                ret = lttng_triggers_serialize(
                                return_triggers, &cmd_ctx->reply_payload);
                lttng_triggers_destroy(return_triggers);
@@ -2463,7 +2463,7 @@ error_add_context:
                        goto error;
                }
 
-               assert(results);
+               LTTNG_ASSERT(results);
                ret = lttng_error_query_results_serialize(
                                results, &cmd_ctx->reply_payload);
                lttng_error_query_results_destroy(results);
@@ -2506,7 +2506,7 @@ setup_error:
                session_unlock_list();
        }
 init_setup_error:
-       assert(!rcu_read_ongoing());
+       LTTNG_ASSERT(!rcu_read_ongoing());
        return ret;
 }
 
@@ -2788,8 +2788,8 @@ static void *thread_manage_clients(void *data)
                        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);
 
index 3b776c57634fcfa5f05688a2c7b2c8233fb505b7..1c660c6128ac186a6f4d8c0e7b593c443795d693 100644 (file)
@@ -8,7 +8,6 @@
 
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <sys/stat.h>
@@ -133,8 +132,8 @@ static int build_network_session_path(char *dst, size_t size,
        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));
@@ -252,8 +251,8 @@ static int get_ust_runtime_stats(struct ltt_session *session,
        }
 
        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;
@@ -282,7 +281,7 @@ static int get_ust_runtime_stats(struct ltt_session *session,
                *lost_packets += uchan->per_pid_closed_app_lost;
        } else {
                ERR("Unsupported buffer type");
-               assert(0);
+               abort();
                ret = -1;
                goto end;
        }
@@ -370,7 +369,7 @@ static ssize_t list_lttng_channels(enum lttng_domain_type domain,
                                 * LTTNG_UST_MMAP is the only supported UST
                                 * output mode.
                                 */
-                               assert(0);
+                               abort();
                                break;
                        }
 
@@ -483,7 +482,7 @@ static int list_lttng_agent_events(struct agent *agt,
        const struct agent_event *agent_event;
        struct lttng_ht_iter iter;
 
-       assert(agt);
+       LTTNG_ASSERT(agt);
 
        DBG3("Listing agent events");
 
@@ -711,7 +710,7 @@ static int list_lttng_kernel_events(char *channel_name,
                case LTTNG_KERNEL_ABI_ALL:
                        /* fall-through. */
                default:
-                       assert(0);
+                       abort();
                        break;
                }
 
@@ -753,7 +752,7 @@ static enum lttng_error_code add_uri_to_consumer(
        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.");
@@ -853,7 +852,7 @@ static int init_kernel_tracing(struct ltt_kernel_session *session)
        struct lttng_ht_iter iter;
        struct consumer_socket *socket;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        rcu_read_lock();
 
@@ -987,7 +986,7 @@ static enum lttng_error_code send_consumer_relayd_socket(
        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) {
@@ -1059,8 +1058,8 @@ static enum lttng_error_code send_consumer_relayd_sockets(
 {
        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) {
@@ -1104,7 +1103,7 @@ int cmd_setup_relayd(struct ltt_session *session)
        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;
@@ -1369,9 +1368,9 @@ int cmd_enable_channel(struct ltt_session *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));
@@ -1865,7 +1864,7 @@ int cmd_disable_event(struct ltt_session *session,
                struct agent *agt;
                struct ltt_ust_session *usess = session->ust_session;
 
-               assert(usess);
+               LTTNG_ASSERT(usess);
 
                switch (event->type) {
                case LTTNG_EVENT_ALL:
@@ -1934,7 +1933,7 @@ int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
 
        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 */
@@ -1978,7 +1977,7 @@ int cmd_add_context(struct ltt_session *session, enum lttng_domain_type domain,
                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) {
@@ -2023,7 +2022,7 @@ error:
                        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);
        }
 
@@ -2033,7 +2032,7 @@ error:
                                        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);
@@ -2093,12 +2092,12 @@ static int _cmd_enable_event(struct ltt_session *session,
        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);
@@ -2259,7 +2258,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                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
@@ -2296,7 +2295,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                        /* 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) {
@@ -2348,7 +2347,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                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");
@@ -2399,7 +2398,7 @@ static int _cmd_enable_event(struct ltt_session *session,
                        break;
                default:
                        /* The switch/case we are in makes this impossible */
-                       assert(0);
+                       abort();
                }
 
                {
@@ -2605,7 +2604,7 @@ int cmd_start_trace(struct ltt_session *session)
        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;
@@ -2664,7 +2663,7 @@ int cmd_start_trace(struct ltt_session *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);
@@ -2766,7 +2765,7 @@ int cmd_stop_trace(struct ltt_session *session)
        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 */
@@ -2851,9 +2850,9 @@ int cmd_set_consumer_uri(struct ltt_session *session, size_t nb_uri,
        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) {
@@ -3289,7 +3288,7 @@ int cmd_destroy_session(struct ltt_session *session,
        }
 
        /* Safety net */
-       assert(session);
+       LTTNG_ASSERT(session);
 
        DBG("Begin destroy session %s (id %" PRIu64 ")", session->name,
                        session->id);
@@ -3412,7 +3411,7 @@ int cmd_destroy_session(struct ltt_session *session,
                ret = lttng_strncpy(destroy_completion_handler.shm_path,
                                session->shm_path,
                                sizeof(destroy_completion_handler.shm_path));
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
        }
 
        /*
@@ -3448,16 +3447,16 @@ int cmd_register_consumer(struct ltt_session *session,
        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) {
@@ -3802,7 +3801,7 @@ int cmd_data_pending(struct ltt_session *session)
        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);
 
@@ -3868,8 +3867,8 @@ int cmd_snapshot_add_output(struct ltt_session *session,
        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);
 
@@ -3936,8 +3935,8 @@ int cmd_snapshot_del_output(struct ltt_session *session,
        int ret;
        struct snapshot_output *sout = NULL;
 
-       assert(session);
-       assert(output);
+       LTTNG_ASSERT(session);
+       LTTNG_ASSERT(output);
 
        rcu_read_lock();
 
@@ -3988,8 +3987,8 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
        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);
 
@@ -4017,7 +4016,7 @@ ssize_t cmd_snapshot_list_outputs(struct ltt_session *session,
        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,
@@ -4073,7 +4072,7 @@ int check_regenerate_metadata_support(struct ltt_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        if (session->live_timer != 0) {
                ret = LTTNG_ERR_LIVE_SESSION;
@@ -4091,7 +4090,7 @@ int check_regenerate_metadata_support(struct ltt_session *session)
                        ret = LTTNG_ERR_PER_PID_SESSION;
                        goto end;
                default:
-                       assert(0);
+                       abort();
                        ret = LTTNG_ERR_UNK;
                        goto end;
                }
@@ -4213,7 +4212,7 @@ int cmd_regenerate_metadata(struct ltt_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        ret = check_regenerate_metadata_support(session);
        if (ret) {
@@ -4254,7 +4253,7 @@ int cmd_regenerate_statedump(struct ltt_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        if (!session->active) {
                ret = LTTNG_ERR_SESSION_NOT_STARTED;
@@ -4313,10 +4312,10 @@ enum lttng_error_code synchronize_tracer_notifier_register(
                                        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);
@@ -4401,7 +4400,7 @@ enum lttng_error_code cmd_register_trigger(const struct lttng_credentials *cmd_c
 
        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,
@@ -4498,8 +4497,8 @@ enum lttng_error_code synchronize_tracer_notifier_unregister(
                        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();
@@ -4526,7 +4525,7 @@ enum lttng_error_code synchronize_tracer_notifier_unregister(
                 * 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;
@@ -4559,7 +4558,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
        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,
@@ -4591,7 +4590,7 @@ enum lttng_error_code cmd_unregister_trigger(const struct lttng_credentials *cmd
                goto end;
        }
 
-       assert(sessiond_trigger);
+       LTTNG_ASSERT(sessiond_trigger);
 
        /*
         * From this point on, no matter what, consider the trigger
@@ -4691,7 +4690,7 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
                abort();
        }
 
-       assert(query_target_trigger);
+       LTTNG_ASSERT(query_target_trigger);
 
        ret_code = notification_thread_command_get_trigger(notification_thread,
                        query_target_trigger, &matching_trigger);
@@ -4715,7 +4714,7 @@ enum lttng_error_code cmd_execute_error_query(const struct lttng_credentials *cm
                        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) {
@@ -4819,8 +4818,8 @@ static enum lttng_error_code set_relayd_for_snapshot(
        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");
 
@@ -4895,9 +4894,9 @@ static enum lttng_error_code record_kernel_snapshot(
 {
        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);
@@ -4916,9 +4915,9 @@ static enum lttng_error_code record_ust_snapshot(struct ltt_ust_session *usess,
 {
        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);
@@ -5114,7 +5113,7 @@ enum lttng_error_code snapshot_record(struct ltt_session *session,
                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;
@@ -5197,8 +5196,8 @@ int cmd_snapshot_record(struct ltt_session *session,
        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);
 
@@ -5321,7 +5320,7 @@ int cmd_set_session_shm_path(struct ltt_session *session,
                const char *shm_path)
 {
        /* Safety net */
-       assert(session);
+       LTTNG_ASSERT(session);
 
        /*
         * Can only set shm path before session is started.
@@ -5359,7 +5358,7 @@ int cmd_rotate_session(struct ltt_session *session,
        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;
@@ -5477,7 +5476,7 @@ int cmd_rotate_session(struct ltt_session *session,
        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);
@@ -5557,7 +5556,7 @@ int cmd_rotate_get_info(struct ltt_session *session,
                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 :
@@ -5697,7 +5696,7 @@ int cmd_rotation_set_schedule(struct ltt_session *session,
        int ret;
        uint64_t *parameter_value;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        DBG("Cmd rotate set schedule session %s", session->name);
 
index 8afb4ea1c667e43052762f83a11675aaf2dc34cf..caab613aa733c8e534e36674f837e21561808b37 100644 (file)
@@ -87,7 +87,7 @@ unsigned long lttng_condition_session_rotation_hash(
                        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;
 }
@@ -102,7 +102,7 @@ static unsigned long lttng_condition_event_rule_matches_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);
index 4ba40a075fdae27516c53406f6cc1a1e9938f45d..7c36d61be793d669fa6ef5eeb779c887d469c744 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -41,8 +40,8 @@ char *setup_channel_trace_path(struct consumer_output *consumer,
        int ret;
        char *pathname;
 
-       assert(consumer);
-       assert(session_path);
+       LTTNG_ASSERT(consumer);
+       LTTNG_ASSERT(session_path);
 
        health_code_update();
 
@@ -99,9 +98,9 @@ int consumer_socket_send(
        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;
@@ -143,9 +142,9 @@ int consumer_socket_recv(struct consumer_socket *socket, void *msg, size_t len)
        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;
@@ -186,7 +185,7 @@ int consumer_recv_status_reply(struct consumer_socket *sock)
        int ret;
        struct lttcomm_consumer_status_msg reply;
 
-       assert(sock);
+       LTTNG_ASSERT(sock);
 
        ret = consumer_socket_recv(sock, &reply, sizeof(reply));
        if (ret < 0) {
@@ -219,9 +218,9 @@ int consumer_recv_status_channel(struct consumer_socket *sock,
        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) {
@@ -253,8 +252,8 @@ int consumer_send_destroy_relayd(struct consumer_socket *sock,
        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);
 
@@ -287,7 +286,7 @@ void consumer_output_send_destroy_relayd(struct consumer_output *consumer)
        struct lttng_ht_iter iter;
        struct consumer_socket *socket;
 
-       assert(consumer);
+       LTTNG_ASSERT(consumer);
 
        /* Destroy any relayd connection */
        if (consumer->type == CONSUMER_DST_NET) {
@@ -319,7 +318,7 @@ int consumer_create_socket(struct consumer_data *data,
        int ret = 0;
        struct consumer_socket *socket;
 
-       assert(data);
+       LTTNG_ASSERT(data);
 
        if (output == NULL || data->cmd_sock < 0) {
                /*
@@ -376,7 +375,7 @@ struct consumer_socket *consumer_find_socket_by_bitness(int bits,
                consumer_fd = uatomic_read(&the_ust_consumerd32_fd);
                break;
        default:
-               assert(0);
+               abort();
                goto end;
        }
 
@@ -424,7 +423,7 @@ struct consumer_socket *consumer_allocate_socket(int *fd)
 {
        struct consumer_socket *socket = NULL;
 
-       assert(fd);
+       LTTNG_ASSERT(fd);
 
        socket = zmalloc(sizeof(struct consumer_socket));
        if (socket == NULL) {
@@ -446,8 +445,8 @@ error:
 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);
 }
@@ -462,12 +461,12 @@ void consumer_del_socket(struct consumer_socket *sock,
        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);
 }
 
 /*
@@ -489,7 +488,7 @@ static void destroy_socket_rcu(struct rcu_head *head)
  */
 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
@@ -604,7 +603,7 @@ struct consumer_output *consumer_copy_output(struct consumer_output *src)
        int ret;
        struct consumer_output *output;
 
-       assert(src);
+       LTTNG_ASSERT(src);
 
        output = consumer_create_output(src->type);
        if (output == NULL) {
@@ -643,8 +642,8 @@ int consumer_copy_sockets(struct consumer_output *dst,
        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) {
@@ -691,8 +690,8 @@ int consumer_set_network_uri(const struct ltt_session *session,
        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:
@@ -839,10 +838,10 @@ int consumer_send_fds(struct consumer_socket *sock, const int *fds,
 {
        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) {
@@ -866,9 +865,9 @@ int consumer_send_msg(struct consumer_socket *sock,
 {
        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) {
@@ -891,8 +890,8 @@ int consumer_send_channel(struct consumer_socket *sock,
 {
        int ret;
 
-       assert(msg);
-       assert(sock);
+       LTTNG_ASSERT(msg);
+       LTTNG_ASSERT(sock);
 
        ret = consumer_send_msg(sock, msg);
        if (ret < 0) {
@@ -936,7 +935,7 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                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));
@@ -948,7 +947,7 @@ void consumer_init_ask_channel_comm_msg(struct lttcomm_consumer_msg *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 =
@@ -1023,7 +1022,7 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *msg,
                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));
@@ -1033,7 +1032,7 @@ void consumer_init_add_channel_comm_msg(struct lttcomm_consumer_msg *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);
        }
 
@@ -1068,7 +1067,7 @@ void consumer_init_add_stream_comm_msg(struct lttcomm_consumer_msg *msg,
                uint64_t stream_key,
                int32_t cpu)
 {
-       assert(msg);
+       LTTNG_ASSERT(msg);
 
        memset(msg, 0, sizeof(struct lttcomm_consumer_msg));
 
@@ -1082,7 +1081,7 @@ void consumer_init_streams_sent_comm_msg(struct lttcomm_consumer_msg *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));
 
@@ -1100,10 +1099,10 @@ int consumer_send_stream(struct consumer_socket *sock,
 {
        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) {
@@ -1138,9 +1137,9 @@ int consumer_send_relayd_socket(struct consumer_socket *consumer_sock,
        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 */
@@ -1265,7 +1264,7 @@ int consumer_is_data_pending(uint64_t session_id,
        struct lttng_ht_iter iter;
        struct lttcomm_consumer_msg msg;
 
-       assert(consumer);
+       LTTNG_ASSERT(consumer);
 
        DBG3("Consumer data pending for id %" PRIu64, session_id);
 
@@ -1321,7 +1320,7 @@ int consumer_flush_channel(struct consumer_socket *socket, uint64_t key)
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG2("Consumer flush channel key %" PRIu64, key);
 
@@ -1353,7 +1352,7 @@ int consumer_clear_quiescent_channel(struct consumer_socket *socket, uint64_t ke
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG2("Consumer clear quiescent channel key %" PRIu64, key);
 
@@ -1387,7 +1386,7 @@ int consumer_close_metadata(struct consumer_socket *socket,
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG2("Consumer close metadata channel key %" PRIu64, metadata_key);
 
@@ -1420,7 +1419,7 @@ int consumer_setup_metadata(struct consumer_socket *socket,
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG2("Consumer setup metadata channel key %" PRIu64, metadata_key);
 
@@ -1455,7 +1454,7 @@ int consumer_push_metadata(struct consumer_socket *socket,
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG2("Consumer push metadata to consumer socket %d", *socket->fd_ptr);
 
@@ -1508,8 +1507,8 @@ enum lttng_error_code consumer_snapshot_channel(struct consumer_socket *socket,
        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);
 
@@ -1570,7 +1569,7 @@ int consumer_get_discarded_events(uint64_t session_id, uint64_t channel_key,
        struct lttng_ht_iter iter;
        struct lttcomm_consumer_msg msg;
 
-       assert(consumer);
+       LTTNG_ASSERT(consumer);
 
        DBG3("Consumer discarded events id %" PRIu64, session_id);
 
@@ -1627,7 +1626,7 @@ int consumer_get_lost_packets(uint64_t session_id, uint64_t channel_key,
        struct lttng_ht_iter iter;
        struct lttcomm_consumer_msg msg;
 
-       assert(consumer);
+       LTTNG_ASSERT(consumer);
 
        DBG3("Consumer lost packets id %" PRIu64, session_id);
 
@@ -1687,7 +1686,7 @@ int consumer_rotate_channel(struct consumer_socket *socket, uint64_t key,
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG("Consumer rotate channel key %" PRIu64, key);
 
@@ -1730,7 +1729,7 @@ int consumer_open_channel_packets(struct consumer_socket *socket, uint64_t key)
                .u.open_channel_packets.key = key,
        };
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG("Consumer open channel packets: channel key = %" PRIu64, key);
 
@@ -1753,7 +1752,7 @@ int consumer_clear_channel(struct consumer_socket *socket, uint64_t key)
        int ret;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        DBG("Consumer clear channel %" PRIu64, key);
 
@@ -1784,7 +1783,7 @@ int consumer_init(struct consumer_socket *socket,
                .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);
@@ -1829,8 +1828,8 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
                .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,
@@ -1927,7 +1926,7 @@ int consumer_create_trace_chunk(struct consumer_socket *socket,
                 */
                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);
@@ -1989,7 +1988,7 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
        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) {
@@ -2018,7 +2017,7 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
         * (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,
@@ -2028,7 +2027,7 @@ int consumer_close_trace_chunk(struct consumer_socket *socket,
         * 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) {
@@ -2110,7 +2109,7 @@ int consumer_trace_chunk_exists(struct consumer_socket *socket,
        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,
index 0ea6c400f7c8b438dc1234de4eaecc157d4f7ec9..c8c89243823fe47a883e675532252065a75a551f 100644 (file)
@@ -33,8 +33,8 @@ static int add_kctx_all_channels(struct ltt_kernel_session *ksession,
        int ret;
        struct ltt_kernel_channel *kchan;
 
-       assert(ksession);
-       assert(kctx);
+       LTTNG_ASSERT(ksession);
+       LTTNG_ASSERT(kctx);
 
        DBG("Adding kernel context to all channels");
 
@@ -74,8 +74,8 @@ static int add_kctx_to_channel(struct ltt_kernel_context *kctx,
 {
        int ret;
 
-       assert(kchan);
-       assert(kctx);
+       LTTNG_ASSERT(kchan);
+       LTTNG_ASSERT(kctx);
 
        DBG("Add kernel context to channel '%s'", kchan->channel->name);
 
@@ -103,9 +103,9 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
        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) {
@@ -150,7 +150,7 @@ static int add_uctx_to_channel(struct ltt_ust_session *usess,
        case LTTNG_DOMAIN_UST:
                break;
        default:
-               assert(0);
+               abort();
        }
 
        /* Create ltt UST context */
@@ -193,9 +193,9 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        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) {
@@ -373,9 +373,9 @@ int context_ust_add(struct ltt_ust_session *usess,
        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();
 
index ab6c34846bf315243942ef0afce7b7914bfd0550..a767ccbdd90c4dc7a9d142a94136e65ec07ac180 100644 (file)
@@ -45,7 +45,7 @@ static void update_ust_app(int app_sock)
        }
 
        rcu_read_lock();
-       assert(app_sock >= 0);
+       LTTNG_ASSERT(app_sock >= 0);
        app = ust_app_find_by_sock(app_sock);
        if (app == NULL) {
                /*
@@ -94,7 +94,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
        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);
 
@@ -110,7 +110,7 @@ static void sanitize_wait_queue(struct ust_reg_wait_queue *wait_queue)
 
        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) {
index e7b2def91c4b2675d7500c6c8c664e39e1339fb6..d3e3692f53e2b1bb60c979582d965db48de9e82b 100644 (file)
@@ -87,7 +87,7 @@ static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
 
        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
@@ -219,7 +219,7 @@ init_error_accounting_state(struct error_accounting_state *state,
 {
        enum event_notifier_error_accounting_status status;
 
-       assert(state);
+       LTTNG_ASSERT(state);
 
        state->number_indices = index_count;
 
@@ -251,7 +251,7 @@ end:
 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
@@ -1028,7 +1028,7 @@ enum event_notifier_error_accounting_status create_error_counter_index_for_token
        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,
@@ -1180,7 +1180,7 @@ event_notifier_error_accounting_kernel_get_count(
        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,
@@ -1206,7 +1206,7 @@ event_notifier_error_accounting_kernel_get_count(
        }
 
        /* 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;
@@ -1343,7 +1343,7 @@ void event_notifier_error_accounting_unregister_event_notifier(
                }
 
                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);
        }
 
index ab39ca65a1cf2b1d92ffdffc44618a4e5d131307..51425737608c3f02e72cae8ca53011593fe2289e 100644 (file)
@@ -43,9 +43,9 @@ static void add_unique_ust_event(struct lttng_ht *ht,
        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;
@@ -56,7 +56,7 @@ static void add_unique_ust_event(struct lttng_ht *ht,
        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);
 }
 
 /*
@@ -71,7 +71,7 @@ int event_kernel_disable_event(struct ltt_kernel_channel *kchan,
        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) {
@@ -110,8 +110,8 @@ int event_kernel_enable_event(struct ltt_kernel_channel *kchan,
        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);
@@ -162,9 +162,9 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
        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();
 
@@ -188,7 +188,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
 
        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;
        }
@@ -264,9 +264,9 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
        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;
 
@@ -287,7 +287,7 @@ int event_ust_disable_tracepoint(struct ltt_ust_session *usess,
 
        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 */
@@ -330,8 +330,8 @@ int event_ust_disable_all_tracepoints(struct ltt_ust_session *usess,
        struct ltt_ust_event *uevent = NULL;
        struct lttng_event *events = NULL;
 
-       assert(usess);
-       assert(uchan);
+       LTTNG_ASSERT(usess);
+       LTTNG_ASSERT(uchan);
 
        rcu_read_lock();
 
@@ -397,7 +397,7 @@ int event_agent_enable_all(struct ltt_ust_session *usess,
 {
        int ret;
 
-       assert(usess);
+       LTTNG_ASSERT(usess);
 
        DBG("Event agent enabling ALL events for session %" PRIu64, usess->id);
 
@@ -487,8 +487,8 @@ static int agent_enable(struct agent *agt,
        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);
@@ -503,7 +503,7 @@ static int agent_enable(struct agent *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) {
@@ -554,9 +554,9 @@ int event_agent_enable(struct ltt_ust_session *usess,
                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,
@@ -587,8 +587,8 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        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) {
@@ -596,16 +596,16 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        }
 
        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:
@@ -618,7 +618,7 @@ int trigger_agent_enable(const struct lttng_trigger *trigger, struct agent *agt)
        }
 
        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) {
@@ -683,7 +683,7 @@ const char *event_get_default_agent_ust_name(enum lttng_domain_type domain)
                default_event_name = DEFAULT_PYTHON_EVENT_NAME;
                break;
        default:
-               assert(0);
+               abort();
        }
 
        return default_event_name;
@@ -696,9 +696,9 @@ static int trigger_agent_disable_one(const struct lttng_trigger *trigger,
 {
        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
@@ -740,9 +740,9 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
        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,
@@ -790,7 +790,7 @@ static int event_agent_disable_one(struct ltt_ust_session *usess,
        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);
@@ -829,8 +829,8 @@ int trigger_agent_disable(
        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));
@@ -869,9 +869,9 @@ int event_agent_disable(struct ltt_ust_session *usess, struct agent *agt,
        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);
 
@@ -913,8 +913,8 @@ int event_agent_disable_all(struct ltt_ust_session *usess,
        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
index c130ce0f29522460366e1c63c04dba56a03c4a2a..050f18e2bc38a5fb0e65f1044c687b516b0f240a 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/hashtable/hashtable.h>
 #include <common/common.h>
index 11a34af2a4e13a293d096b39d60251963f9d2705..364705fcb31d7f91e5d095d0740b38488c0bd712 100644 (file)
@@ -30,7 +30,7 @@ static char *create_channel_path(struct consumer_output *consumer,
        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 ||
@@ -97,9 +97,9 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        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 *)
@@ -170,9 +170,9 @@ int kernel_consumer_add_channel(struct consumer_socket *sock,
        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,
@@ -211,9 +211,9 @@ int kernel_consumer_add_metadata(struct consumer_socket *sock,
        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);
@@ -285,11 +285,11 @@ int kernel_consumer_add_stream(struct consumer_socket *sock,
        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);
@@ -327,8 +327,8 @@ int kernel_consumer_streams_sent(struct consumer_socket *sock,
        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 */
@@ -364,10 +364,10 @@ int kernel_consumer_send_channel_streams(struct consumer_socket *sock,
        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();
 
@@ -420,9 +420,9 @@ int kernel_consumer_send_session(struct consumer_socket *sock,
        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) {
@@ -478,8 +478,8 @@ int kernel_consumer_destroy_channel(struct consumer_socket *socket,
        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);
 
@@ -507,8 +507,8 @@ int kernel_consumer_destroy_metadata(struct consumer_socket *socket,
        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);
 
index 34975a3126dffde8ad7f0b100c485ad1149a404c..59b94137f8f30590410912bccb7a7335fdf8e0fb 100644 (file)
@@ -72,8 +72,8 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
 {
        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);
@@ -115,7 +115,7 @@ int kernel_create_session(struct ltt_session *session)
        int ret;
        struct ltt_kernel_session *lks;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        /* Allocate data structure */
        lks = trace_kernel_create_session();
@@ -184,8 +184,8 @@ int kernel_create_channel(struct ltt_kernel_session *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);
@@ -242,7 +242,7 @@ static int kernel_create_event_notifier_group(int *event_notifier_group_fd)
        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);
@@ -297,7 +297,7 @@ int extract_userspace_probe_offset_function_elf(
        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(
@@ -310,7 +310,7 @@ int extract_userspace_probe_offset_function_elf(
        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(
@@ -359,7 +359,7 @@ int extract_userspace_probe_offset_tracepoint_sdt(
        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);
@@ -371,7 +371,7 @@ int extract_userspace_probe_offset_tracepoint_sdt(
        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);
 
 
@@ -504,8 +504,8 @@ int userspace_probe_event_add_callsites(struct lttng_event *ev,
        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) {
@@ -538,11 +538,11 @@ static int userspace_probe_event_rule_add_callsites(
        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) {
@@ -576,8 +576,8 @@ int kernel_create_event(struct lttng_event *ev,
        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,
@@ -684,7 +684,7 @@ int kernel_disable_channel(struct ltt_kernel_channel *chan)
 {
        int ret;
 
-       assert(chan);
+       LTTNG_ASSERT(chan);
 
        ret = kernctl_disable(chan->fd);
        if (ret < 0) {
@@ -709,7 +709,7 @@ int kernel_enable_channel(struct ltt_kernel_channel *chan)
 {
        int ret;
 
-       assert(chan);
+       LTTNG_ASSERT(chan);
 
        ret = kernctl_enable(chan->fd);
        if (ret < 0 && ret != -EEXIST) {
@@ -734,7 +734,7 @@ int kernel_enable_event(struct ltt_kernel_event *event)
 {
        int ret;
 
-       assert(event);
+       LTTNG_ASSERT(event);
 
        ret = kernctl_enable(event->fd);
        if (ret < 0) {
@@ -765,7 +765,7 @@ int kernel_disable_event(struct ltt_kernel_event *event)
 {
        int ret;
 
-       assert(event);
+       LTTNG_ASSERT(event);
 
        ret = kernctl_disable(event->fd);
        if (ret < 0) {
@@ -791,7 +791,7 @@ int kernel_disable_event_notifier_rule(struct ltt_kernel_event_notifier_rule *ev
 {
        int ret;
 
-       assert(event);
+       LTTNG_ASSERT(event);
 
        rcu_read_lock();
        cds_lfht_del(kernel_token_to_event_notifier_rule_ht, &event->ht_node);
@@ -1187,7 +1187,7 @@ int kernel_open_metadata(struct ltt_kernel_session *session)
        int ret;
        struct ltt_kernel_metadata *lkm = NULL;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        /* Allocate kernel metadata */
        lkm = trace_kernel_create_metadata();
@@ -1228,7 +1228,7 @@ int kernel_start_session(struct ltt_kernel_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        ret = kernctl_start_session(session->fd);
        if (ret < 0) {
@@ -1286,7 +1286,7 @@ int kernel_flush_buffer(struct ltt_kernel_channel *channel)
        int ret;
        struct ltt_kernel_stream *stream;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        DBG("Flush buffer for channel %s", channel->channel->name);
 
@@ -1310,7 +1310,7 @@ int kernel_stop_session(struct ltt_kernel_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        ret = kernctl_stop_session(session->fd);
        if (ret < 0) {
@@ -1340,7 +1340,7 @@ int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
        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,
@@ -1384,7 +1384,7 @@ int kernel_open_metadata_stream(struct ltt_kernel_session *session)
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        ret = kernctl_create_stream(session->metadata->fd);
        if (ret < 0) {
@@ -1417,7 +1417,7 @@ ssize_t kernel_list_events(struct lttng_event **events)
        FILE *fp;
        struct lttng_event *elist;
 
-       assert(events);
+       LTTNG_ASSERT(events);
 
        fd = kernctl_tracepoint_list(kernel_tracer_fd);
        if (fd < 0) {
@@ -1633,8 +1633,8 @@ void kernel_destroy_channel(struct ltt_kernel_channel *kchan)
 {
        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);
 
@@ -1674,9 +1674,9 @@ enum lttng_error_code kernel_snapshot_record(
        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");
 
@@ -1772,8 +1772,8 @@ error:
  */
 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);
 }
@@ -1852,8 +1852,8 @@ enum lttng_error_code kernel_rotate_session(struct ltt_session *session)
        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);
@@ -1905,7 +1905,7 @@ enum lttng_error_code kernel_create_channel_subdirectories(
        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
@@ -2091,7 +2091,7 @@ void cleanup_kernel_tracer(void)
        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");
@@ -2140,8 +2140,8 @@ enum lttng_error_code kernel_clear_session(struct ltt_session *session)
        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);
@@ -2213,7 +2213,7 @@ enum lttng_error_code kernel_create_event_notifier_group_notification_fd(
        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);
@@ -2307,22 +2307,22 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
        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(
@@ -2406,7 +2406,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule(
        /* 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 =
@@ -2485,15 +2485,15 @@ enum lttng_error_code kernel_register_event_notifier(
                        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) {
index 16eead6260783fd0d6ce1742004489623133e129..ccd8f25e679b51e2cb05265c315dcfa163dab299 100644 (file)
@@ -162,7 +162,7 @@ static void destroy_syscall_ht(struct lttng_ht *ht)
                int ret;
 
                ret = lttng_ht_del(ht, &iter);
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
                free(ksyscall);
        }
        ht_cleanup_push(ht);
@@ -198,8 +198,8 @@ static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
        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);
@@ -217,7 +217,7 @@ static struct syscall *lookup_syscall(struct lttng_ht *ht, const char *name)
 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;
@@ -237,7 +237,7 @@ static int add_syscall_to_ht(struct lttng_ht *ht, unsigned int index,
        int ret;
        struct syscall *ksyscall;
 
-       assert(ht);
+       LTTNG_ASSERT(ht);
 
        ksyscall = zmalloc(sizeof(*ksyscall));
        if (!ksyscall) {
@@ -271,7 +271,7 @@ ssize_t syscall_table_list(struct lttng_event **_events)
        /* Hash table used to filter duplicate out. */
        struct lttng_ht *syscalls_ht = NULL;
 
-       assert(_events);
+       LTTNG_ASSERT(_events);
 
        DBG("Syscall table listing.");
 
index ee4d0c78ec499800cd5e149c95a02afa4f3a53e4..868f9a4a9261cff9e68458d2e0c33ba9aa1f12fa 100644 (file)
@@ -1105,7 +1105,7 @@ static int set_consumer_sockets(struct consumer_data *consumer_data)
                ret = -EINVAL;
                goto error;
        }
-       assert(path);
+       LTTNG_ASSERT(path);
 
        DBG2("Creating consumer directory: %s", path);
 
@@ -1374,7 +1374,7 @@ static void unregister_all_triggers(void)
        }
 
        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;
@@ -1382,11 +1382,11 @@ static void unregister_all_triggers(void)
                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 ?
index de17c325a8099235793cb92f0e958ee44042edf1..719d42b18b364e43478c3cc1a1d0b1ea9c031348 100644 (file)
@@ -356,7 +356,7 @@ error:
                uatomic_set(&the_ust_consumerd_state, CONSUMER_ERROR);
        } else {
                /* Code flow error... */
-               assert(0);
+               abort();
        }
 
        if (consumer_data->err_sock >= 0) {
index f701ca5f892b684063ec1e834af807a02ae8a4cd..24b34d0942b320a8fb9b888a8fd9db0d43620592 100644 (file)
@@ -14,7 +14,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/wait.h>
@@ -644,7 +643,7 @@ static int append_list_to_probes(const char *list)
        int ret;
        char *tmp_list, *cur_list, *saveptr;
 
-       assert(list);
+       LTTNG_ASSERT(list);
 
        cur_list = tmp_list = strdup(list);
        if (!tmp_list) {
index f678a0d8d14a1d6d253799c2ef8e01875d1e2ccb..a083d51af124f369692e8828a99b4c40b81be50c 100644 (file)
@@ -118,7 +118,7 @@ enum lttng_error_code notification_thread_command_register_trigger(
        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;
@@ -282,7 +282,7 @@ enum lttng_error_code notification_thread_command_add_tracer_event_source(
        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);
 
@@ -336,8 +336,8 @@ enum lttng_error_code notification_thread_command_list_triggers(
        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);
 
@@ -367,7 +367,7 @@ void notification_thread_command_quit(
 
        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(
@@ -423,8 +423,8 @@ struct lttng_event_notifier_notification *lttng_event_notifier_notification_crea
 {
        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) {
index 747740233094477c00fb59065cce2dd3f9861013..e2fa30681ca5283a563703f037d2c3187001d8be 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <time.h>
 #include <unistd.h>
-#include <assert.h>
 #include <inttypes.h>
 #include <fcntl.h>
 
@@ -311,7 +310,7 @@ int match_client_list_condition(struct cds_lfht_node *node, const void *key)
        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);
@@ -526,7 +525,7 @@ void session_info_destroy(void *_data)
        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) {
@@ -568,7 +567,7 @@ struct session_info *session_info_create(const char *name, uid_t uid, gid_t gid,
 {
        struct session_info *session_info;
 
-       assert(name);
+       LTTNG_ASSERT(name);
 
        session_info = zmalloc(sizeof(*session_info));
        if (!session_info) {
@@ -690,7 +689,7 @@ void notification_client_list_release(struct urcu_ref *list_ref)
                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);
@@ -852,7 +851,7 @@ int evaluate_channel_condition_for_client(
                                        lttng_trigger_get_const_condition(
                                                element->trigger);
 
-                       assert(current_condition);
+                       LTTNG_ASSERT(current_condition);
                        if (!lttng_condition_is_equal(condition,
                                        current_condition)) {
                                continue;
@@ -882,7 +881,7 @@ int evaluate_channel_condition_for_client(
                        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);
 
@@ -1038,10 +1037,10 @@ int evaluate_condition_for_client(const struct lttng_trigger *trigger,
        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:
@@ -1371,18 +1370,18 @@ bool buffer_usage_condition_applies_to_channel(
 
        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;
@@ -1406,7 +1405,7 @@ bool session_consumed_size_condition_applies_to_channel(
 
        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;
@@ -1582,7 +1581,7 @@ bool trigger_applies_to_session(const struct lttng_trigger *trigger,
                        goto end;
                }
 
-               assert(condition_session_name);
+               LTTNG_ASSERT(condition_session_name);
                applies = !strcmp(condition_session_name, session_name);
                break;
        }
@@ -1663,8 +1662,8 @@ struct session_info *find_or_create_session_info(
                                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;
        }
@@ -1875,7 +1874,7 @@ int handle_notification_thread_command_remove_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);
        cds_lfht_del(state->channels_ht, node);
@@ -1937,7 +1936,7 @@ int handle_notification_thread_command_session_rotation(
 
                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 &&
@@ -2135,7 +2134,7 @@ int remove_tracer_event_source_from_pollset(
 {
        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,
@@ -2177,7 +2176,7 @@ int handle_notification_thread_tracer_event_source_died(
        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) {
@@ -2200,7 +2199,7 @@ int handle_notification_thread_command_remove_tracer_event_source(
        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);
@@ -2296,7 +2295,7 @@ static inline void get_trigger_info_for_log(const struct lttng_trigger *trigger,
 
        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(
@@ -2354,7 +2353,7 @@ bool condition_is_supported(struct lttng_condition *condition)
 
                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;
@@ -2379,7 +2378,7 @@ bool condition_is_supported(struct lttng_condition *condition)
                                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) {
@@ -2476,7 +2475,7 @@ int bind_trigger_to_matching_channels(struct lttng_trigger *trigger,
                                &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);
@@ -2506,7 +2505,7 @@ bool is_trigger_action_notify(const struct lttng_trigger *trigger)
                        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;
@@ -2516,7 +2515,7 @@ bool is_trigger_action_notify(const struct lttng_trigger *trigger)
        }
 
        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 =
@@ -2570,7 +2569,7 @@ enum lttng_error_code generate_trigger_name(
                }
 
                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);
@@ -2583,8 +2582,8 @@ void notif_thread_state_remove_trigger_ht_elem(
                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);
@@ -2717,7 +2716,7 @@ int handle_notification_thread_command_register_trigger(
        }
 
        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)) {
@@ -3077,7 +3076,7 @@ int handle_notification_thread_command_unregister_trigger(
                 * 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);
@@ -3562,7 +3561,7 @@ enum client_transmission_status client_flush_outgoing_queue(
                 * 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;
        }
 
@@ -3740,7 +3739,7 @@ int client_handle_message_unknown(struct notification_client *client,
         */
        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;
 
@@ -4011,7 +4010,7 @@ int handle_notification_thread_client_in(
        }
 
 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) {
@@ -4029,7 +4028,7 @@ receive_fds:
                        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. */
@@ -4041,7 +4040,7 @@ receive_fds:
        }
 
        /* 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) {
@@ -4911,7 +4910,7 @@ int handle_notification_thread_channel_sample(
                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
index 0b39a5a3e61cb489c8340ef51a12926a3a76959a..c15e356ada4187f7e044897a3d0a23ae0d48791c 100644 (file)
@@ -50,7 +50,7 @@ void notification_thread_handle_destroy(
                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);
 
@@ -335,48 +335,48 @@ void fini_thread_state(struct notification_thread_state *state)
 
        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.
@@ -384,14 +384,14 @@ void fini_thread_state(struct notification_thread_state *state)
         */
        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);
@@ -610,7 +610,7 @@ static bool fd_is_event_notification_source(const struct notification_thread_sta
 {
        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) {
index 55a4b74fd56d2c5b733690784cec3e71b7c7af79..7c86b57c8a8aa9e01dc63c2082efc5cfdf6d16c9 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 
 #include <common/common.h>
 #include <common/utils.h>
index ac149c845b79c9436674908ee9c5b942db79c0d2..3373443f099bfaf064af8774f7fb92f3f7fb3e0d 100644 (file)
@@ -111,7 +111,7 @@ void rotation_thread_timer_queue_destroy(
        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);
@@ -325,7 +325,7 @@ void check_session_rotation_pending_on_consumers(struct ltt_session *session,
        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
@@ -398,7 +398,7 @@ end:
                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);
@@ -437,7 +437,7 @@ int check_session_rotation_pending(struct ltt_session *session,
 
        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);
@@ -468,7 +468,7 @@ int check_session_rotation_pending(struct ltt_session *session,
         */
        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) {
@@ -498,7 +498,7 @@ check_ongoing_rotation:
                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);
index f1929a5f0ce24bf47ed1697f18a28d4e728bdf0c..f0a6e43d55e810ccb332667dfae8de39602af108 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <string.h>
 #include <urcu/uatomic.h>
@@ -555,7 +554,7 @@ int save_kernel_kprobe_event(struct config_writer *writer,
                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;
@@ -1404,8 +1403,8 @@ int save_ust_context_perf_thread_counter(struct config_writer *writer,
 {
        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);
@@ -1454,8 +1453,8 @@ int save_ust_context_app_ctx(struct config_writer *writer,
 {
        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);
@@ -1500,8 +1499,8 @@ int save_ust_context_generic(struct config_writer *writer,
        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(
@@ -1532,8 +1531,8 @@ int save_ust_context(struct config_writer *writer,
        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) {
@@ -1591,8 +1590,8 @@ int save_kernel_channel(struct config_writer *writer,
 {
        int ret;
 
-       assert(writer);
-       assert(kchan);
+       LTTNG_ASSERT(writer);
+       LTTNG_ASSERT(kchan);
 
        ret = config_writer_open_element(writer, config_element_channel);
        if (ret) {
@@ -1649,9 +1648,9 @@ int save_ust_channel(struct config_writer *writer,
 {
        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) {
@@ -1752,8 +1751,8 @@ int save_kernel_session(struct config_writer *writer,
        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);
@@ -1818,7 +1817,7 @@ const char *get_config_domain_str(enum lttng_domain_type domain)
                str_dom = config_domain_type_python;
                break;
        default:
-               assert(0);
+               abort();
        }
 
        return str_dom;
@@ -1877,14 +1876,14 @@ static int save_process_attr_tracker(struct config_writer *writer,
        {
                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:
@@ -1935,7 +1934,7 @@ static int save_process_attr_tracker(struct config_writer *writer,
                                        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) {
@@ -1958,11 +1957,11 @@ static int save_process_attr_tracker(struct config_writer *writer,
                                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();
@@ -2089,8 +2088,8 @@ int save_ust_domain(struct config_writer *writer,
        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);
@@ -2194,8 +2193,8 @@ int save_domains(struct config_writer *writer, struct ltt_session *session)
 {
        int ret = LTTNG_OK;
 
-       assert(writer);
-       assert(session);
+       LTTNG_ASSERT(writer);
+       LTTNG_ASSERT(session);
 
        if (!session->kernel_session && !session->ust_session) {
                goto end;
@@ -2288,8 +2287,8 @@ int save_consumer_output(struct config_writer *writer,
 {
        int ret;
 
-       assert(writer);
-       assert(output);
+       LTTNG_ASSERT(writer);
+       LTTNG_ASSERT(output);
 
        ret = config_writer_open_element(writer, config_element_consumer_output);
        if (ret) {
@@ -2417,8 +2416,8 @@ int save_snapshot_outputs(struct config_writer *writer,
        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) {
@@ -2486,8 +2485,8 @@ int save_session_output(struct config_writer *writer,
 {
        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)) {
@@ -2624,9 +2623,9 @@ int save_session(struct ltt_session *session,
        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));
index 2d95aa2687cf2be475faf953a93172c54c7a81ed..dc6dea4439a6b77417863f0c1626ce89bfaf4490 100644 (file)
@@ -80,7 +80,7 @@ static int validate_name(const char *name)
        int ret;
        char *tok, *tmp_name;
 
-       assert(name);
+       LTTNG_ASSERT(name);
 
        tmp_name = strdup(name);
        if (!tmp_name) {
@@ -111,7 +111,7 @@ error:
  */
 static uint64_t add_session_list(struct ltt_session *ls)
 {
-       assert(ls);
+       LTTNG_ASSERT(ls);
 
        cds_list_add(&ls->list, &ltt_session_list.head);
        return ltt_session_list.next_uuid++;
@@ -124,7 +124,7 @@ static uint64_t add_session_list(struct ltt_session *ls)
  */
 static void del_session_list(struct ltt_session *ls)
 {
-       assert(ls);
+       LTTNG_ASSERT(ls);
 
        cds_list_del(&ls->list);
 }
@@ -352,7 +352,7 @@ static void add_session_ht(struct ltt_session *ls)
 {
        int ret;
 
-       assert(ls);
+       LTTNG_ASSERT(ls);
 
        if (!ltt_sessions_ht_by_id) {
                ret = ltt_sessions_ht_alloc();
@@ -363,7 +363,7 @@ static void add_session_ht(struct ltt_session *ls)
        }
 
        /* 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);
@@ -389,10 +389,10 @@ static int ltt_sessions_ht_empty(void)
                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;
 }
@@ -407,17 +407,17 @@ static void del_session_ht(struct ltt_session *ls)
        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");
@@ -430,7 +430,7 @@ static void del_session_ht(struct ltt_session *ls)
  */
 void session_lock(struct ltt_session *session)
 {
-       assert(session);
+       LTTNG_ASSERT(session);
 
        pthread_mutex_lock(&session->lock);
 }
@@ -440,7 +440,7 @@ void session_lock(struct ltt_session *session)
  */
 void session_unlock(struct ltt_session *session)
 {
-       assert(session);
+       LTTNG_ASSERT(session);
 
        pthread_mutex_unlock(&session->lock);
 }
@@ -480,7 +480,7 @@ int _session_set_trace_chunk_no_lock_check(struct ltt_session *session,
                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;
@@ -616,7 +616,7 @@ struct lttng_trace_chunk *session_create_new_trace_chunk(
        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;
@@ -959,7 +959,7 @@ void session_release(struct urcu_ref *ref)
        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;
@@ -1048,7 +1048,7 @@ void session_put(struct ltt_session *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);
 }
 
@@ -1065,7 +1065,7 @@ void session_put(struct ltt_session *session)
  */
 void session_destroy(struct ltt_session *session)
 {
-       assert(!session->destroyed);
+       LTTNG_ASSERT(!session->destroyed);
        session->destroyed = true;
        session_put(session);
 }
@@ -1104,7 +1104,7 @@ struct ltt_session *session_find_by_name(const char *name)
 {
        struct ltt_session *iter;
 
-       assert(name);
+       LTTNG_ASSERT(name);
        ASSERT_LOCKED(ltt_session_list.lock);
 
        DBG2("Trying to find session by name %s", name);
@@ -1334,7 +1334,7 @@ error:
  */
 bool session_access_ok(struct ltt_session *session, uid_t uid)
 {
-       assert(session);
+       LTTNG_ASSERT(session);
        return (uid == session->uid) || uid == 0;
 }
 
@@ -1372,7 +1372,7 @@ int session_reset_rotation_state(struct ltt_session *session,
                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);
index bf7b26cb484ffea047e8ef69001960ebe93f7fbf..2cdbbad52792190f6c7ea09b6e8f19ea2342ae3f 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "version.h"
 #include "sessiond-config.h"
-#include <assert.h>
 #include "lttng-ust-ctl.h"
 #include <common/defaults.h>
 #include <limits.h>
@@ -84,7 +83,7 @@ void config_string_set_static(struct config_string *config_str,
 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;
@@ -254,7 +253,7 @@ int sessiond_config_init(struct sessiond_config *config)
        bool is_root = (getuid() == 0);
        char *str;
 
-       assert(config);
+       LTTNG_ASSERT(config);
        memcpy(config, &sessiond_config_build_defaults, sizeof(*config));
 
        if (is_root) {
index cc1d242f21aef6b8976c45d396bbb1fcc8ecc6c1..6e4a0c3f172a1ca577ae5972cbfbd7343b5bfeea 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <string.h>
 #include <urcu/uatomic.h>
@@ -178,15 +177,15 @@ void snapshot_delete_output(struct snapshot *snapshot,
        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.
@@ -200,9 +199,9 @@ void snapshot_delete_output(struct snapshot *snapshot,
 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);
@@ -219,7 +218,7 @@ void snapshot_add_output(struct snapshot *snapshot,
  */
 void snapshot_output_destroy(struct snapshot_output *obj)
 {
-       assert(obj);
+       LTTNG_ASSERT(obj);
 
        if (obj->consumer) {
                consumer_output_send_destroy_relayd(obj->consumer);
@@ -240,8 +239,8 @@ struct snapshot_output *snapshot_find_output_by_name(const char *name,
        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) {
@@ -267,7 +266,7 @@ struct snapshot_output *snapshot_find_output_by_id(uint32_t id,
        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);
@@ -290,7 +289,7 @@ int snapshot_init(struct snapshot *obj)
 {
        int ret;
 
-       assert(obj);
+       LTTNG_ASSERT(obj);
 
        memset(obj, 0, sizeof(struct snapshot));
 
index 5e42d110fbc27d244acf9538f7c1da297b2c5b6b..1eb25eabe6e09cf753413ad17c9a79e1e2fa9d3b 100644 (file)
@@ -114,7 +114,7 @@ int __sessiond_set_thread_pollset(struct lttng_poll_event *events, size_t size,
 {
        int ret;
 
-       assert(events);
+       LTTNG_ASSERT(events);
 
        ret = lttng_poll_create(events, size, LTTNG_CLOEXEC);
        if (ret < 0) {
index ae7f45fd97f8257b645d37513e80c3274410d938..a4e3cb86e125f7b3e365a80a27a82e2f610e2323 100644 (file)
@@ -134,7 +134,7 @@ void lttng_thread_put(struct lttng_thread *thread)
        if (!thread) {
                return;
        }
-       assert(thread->ref.refcount);
+       LTTNG_ASSERT(thread->ref.refcount);
        urcu_ref_put(&thread->ref, lttng_thread_release);
 }
 
index d87b5d2d0d20c247a803c150f900b64aa0ef14e1..4e522a7fc70e4770b30904cd0ddd01065f8c2bd9 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <signal.h>
 
@@ -23,7 +22,7 @@
 
 #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)
@@ -238,8 +237,8 @@ int timer_session_rotation_pending_check_stop(struct ltt_session *session)
 {
        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);
@@ -289,7 +288,7 @@ int timer_session_rotation_schedule_timer_stop(struct ltt_session *session)
 {
        int ret = 0;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        if (!session->rotation_schedule_timer_enabled) {
                goto end;
index 29a60cef5f8dbb715fde1a19be4e294d45a5a29e..cbafd12bd45ebbb35177894136a30e0cf7269ca5 100644 (file)
@@ -44,8 +44,8 @@ struct ltt_kernel_channel *trace_kernel_get_channel_by_name(
 {
        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
@@ -77,8 +77,8 @@ struct ltt_kernel_event *trace_kernel_find_event(
        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) {
@@ -119,8 +119,8 @@ struct ltt_kernel_event *trace_kernel_get_event_by_name(
        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) {
@@ -220,7 +220,7 @@ struct ltt_kernel_channel *trace_kernel_create_channel(
        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) {
@@ -309,7 +309,7 @@ struct ltt_kernel_context *trace_kernel_copy_context(
 {
        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");
@@ -339,7 +339,7 @@ enum lttng_error_code trace_kernel_create_event(
        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));
@@ -497,21 +497,21 @@ enum lttng_error_code trace_kernel_create_event_notifier_rule(
        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));
@@ -572,14 +572,14 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_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;
@@ -605,7 +605,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                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;
        }
@@ -652,7 +652,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
 
                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;
        }
@@ -662,7 +662,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                                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;
 
@@ -679,8 +679,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule(
                        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:
@@ -798,7 +798,7 @@ struct ltt_kernel_stream *trace_kernel_create_stream(const char *name,
        int ret;
        struct ltt_kernel_stream *lks;
 
-       assert(name);
+       LTTNG_ASSERT(name);
 
        lks = zmalloc(sizeof(struct ltt_kernel_stream));
        if (lks == NULL) {
@@ -830,7 +830,7 @@ error:
  */
 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 */
@@ -853,7 +853,7 @@ void trace_kernel_destroy_stream(struct ltt_kernel_stream *stream)
  */
 void trace_kernel_destroy_event(struct ltt_kernel_event *event)
 {
-       assert(event);
+       LTTNG_ASSERT(event);
 
        if (event->fd >= 0) {
                int ret;
@@ -892,7 +892,7 @@ static void free_token_event_rule_rcu(struct rcu_head *rcu_node)
 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);
@@ -915,7 +915,7 @@ void trace_kernel_destroy_event_notifier_rule(
  */
 void trace_kernel_destroy_context(struct ltt_kernel_context *ctx)
 {
-       assert(ctx);
+       LTTNG_ASSERT(ctx);
 
        if (ctx->in_list) {
                cds_list_del(&ctx->list);
@@ -934,7 +934,7 @@ void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
        int ret;
        enum lttng_error_code status;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        DBG("[trace] Closing channel fd %d", channel->fd);
        /* Close kernel fd */
@@ -968,7 +968,7 @@ void trace_kernel_destroy_channel(struct ltt_kernel_channel *channel)
                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);
@@ -980,7 +980,7 @@ void trace_kernel_destroy_channel(struct ltt_kernel_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 */
@@ -1007,7 +1007,7 @@ void trace_kernel_destroy_session(struct ltt_kernel_session *session)
        struct ltt_kernel_channel *channel, *ctmp;
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        DBG("[trace] Closing session fd %d", session->fd);
        /* Close kernel fds */
index 5d7d14dca15d033f2ad4eb86941bed3231199d9d..47e98cc782a28277309cb12d38796788d725eb93 100644 (file)
@@ -35,8 +35,8 @@ int trace_ust_ht_match_event_by_name(struct cds_lfht_node *node,
        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;
@@ -66,8 +66,8 @@ int trace_ust_ht_match_event(struct cds_lfht_node *node, const void *_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;
@@ -202,8 +202,8 @@ struct ltt_ust_event *trace_ust_find_event(struct lttng_ht *ht,
        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;
@@ -242,7 +242,7 @@ struct agent *trace_ust_find_agent(struct ltt_ust_session *session,
        struct lttng_ht_iter iter;
        uint64_t key;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        DBG3("Trace ust agent lookup for domain %d", domain_type);
 
@@ -346,7 +346,7 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *chan,
 {
        struct ltt_ust_channel *luc;
 
-       assert(chan);
+       LTTNG_ASSERT(chan);
 
        luc = zmalloc(sizeof(struct ltt_ust_channel));
        if (luc == NULL) {
@@ -415,7 +415,7 @@ static int validate_exclusion(struct lttng_event_exclusion *exclusion)
        size_t i;
        int ret = 0;
 
-       assert(exclusion);
+       LTTNG_ASSERT(exclusion);
 
        for (i = 0; i < exclusion->count; ++i) {
                size_t j;
@@ -454,7 +454,7 @@ enum lttng_error_code trace_ust_create_event(struct lttng_event *ev,
        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;
@@ -651,8 +651,8 @@ int trace_ust_match_context(const struct ltt_ust_context *uctx,
                }
                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,
@@ -677,7 +677,7 @@ struct ltt_ust_context *trace_ust_create_context(
        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) {
@@ -770,7 +770,7 @@ static void fini_id_tracker(struct ust_id_tracker *id_tracker)
                        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();
@@ -839,7 +839,7 @@ static int id_tracker_del_id(struct ust_id_tracker *id_tracker, int id)
                goto end;
        }
        ret = lttng_ht_del(id_tracker->ht, &iter);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
 
        destroy_id_tracker_node(tracker_node);
 end:
@@ -1216,7 +1216,7 @@ static void destroy_contexts(struct lttng_ht *ht)
        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) {
@@ -1239,7 +1239,7 @@ static void destroy_contexts(struct lttng_ht *ht)
  */
 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);
@@ -1253,7 +1253,7 @@ void trace_ust_destroy_event(struct ltt_ust_event *event)
  */
 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);
@@ -1284,12 +1284,12 @@ static void destroy_events(struct lttng_ht *events)
        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();
@@ -1304,7 +1304,7 @@ static void destroy_events(struct lttng_ht *events)
  */
 static void _trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 {
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        DBG2("Trace destroy UST channel %s", channel->name);
 
@@ -1343,12 +1343,12 @@ void trace_ust_delete_channel(struct lttng_ht *ht,
        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);
 }
 
 /*
@@ -1359,7 +1359,7 @@ static void destroy_channels(struct lttng_ht *channels)
        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) {
@@ -1379,7 +1379,7 @@ static void destroy_channels(struct lttng_ht *channels)
  */
 static void destroy_domain_global(struct ltt_ust_domain_global *dom)
 {
-       assert(dom);
+       LTTNG_ASSERT(dom);
 
        destroy_channels(dom->channels);
 }
@@ -1396,7 +1396,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        struct buffer_reg_uid *reg, *sreg;
        struct lttng_ht_iter iter;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        DBG2("Trace UST destroy session %" PRIu64, session->id);
 
@@ -1407,7 +1407,7 @@ void trace_ust_destroy_session(struct ltt_ust_session *session)
        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();
index 05e2fe6cd12d689269b4ba254e2f5b63f1f1ceb8..8293904fbfeb693a2024d73f293ffbbe726743a4 100644 (file)
@@ -98,14 +98,14 @@ static void process_attr_tracker_clear_inclusion_set(
        }
        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;
@@ -166,7 +166,7 @@ static struct process_attr_tracker_value_node *process_attr_tracker_lookup(
        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,
index 1826a2d8b785197eb0b42b49c8b52aefce43b1c9..9c6ff36dea855defd11ba22e1ddf0e9e318efab8 100644 (file)
@@ -35,7 +35,7 @@ enum lttng_trigger_status lttng_trigger_condition_add_error_results(
                        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.
@@ -96,7 +96,7 @@ enum lttng_trigger_status lttng_trigger_add_action_error_query_results(
                        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);
index ae2db857dd7835554c57f9683bae6ce5524a3445..4d3a08508c8f2a3e0b28ee00f6c895859833aa8b 100644 (file)
@@ -118,8 +118,8 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
        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;
@@ -195,9 +195,9 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
        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;
@@ -208,7 +208,7 @@ static void add_unique_ust_app_event(struct ust_app_channel *ua_chan,
        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);
 }
 
 /*
@@ -222,7 +222,7 @@ static void close_notify_sock_rcu(struct rcu_head *head)
                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) {
@@ -238,14 +238,14 @@ static void close_notify_sock_rcu(struct rcu_head *head)
  * 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:
@@ -269,7 +269,7 @@ static struct ust_registry_session *get_session_registry(
                break;
        }
        default:
-               assert(0);
+               abort();
        };
 
 error:
@@ -286,7 +286,7 @@ void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx,
 {
        int ret;
 
-       assert(ua_ctx);
+       LTTNG_ASSERT(ua_ctx);
 
        if (ua_ctx->obj) {
                pthread_mutex_lock(&app->sock_lock);
@@ -311,7 +311,7 @@ void delete_ust_app_event(int sock, struct ust_app_event *ua_event,
 {
        int ret;
 
-       assert(ua_event);
+       LTTNG_ASSERT(ua_event);
 
        free(ua_event->filter);
        if (ua_event->exclusion != NULL)
@@ -351,7 +351,7 @@ static void delete_ust_app_event_notifier_rule(int sock,
 {
        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);
@@ -384,7 +384,7 @@ static int release_ust_app_stream(int sock, struct ust_app_stream *stream,
 {
        int ret = 0;
 
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        if (stream->obj) {
                pthread_mutex_lock(&app->sock_lock);
@@ -409,7 +409,7 @@ static
 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);
@@ -515,7 +515,7 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
        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);
 
@@ -529,7 +529,7 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
        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);
        }
 
@@ -537,7 +537,7 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
        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);
        }
 
@@ -562,7 +562,7 @@ void delete_ust_app_channel(int sock, struct ust_app_channel *ua_chan,
                /* 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);
@@ -624,8 +624,8 @@ ssize_t ust_app_push_metadata(struct ust_registry_session *registry,
        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;
 
@@ -760,8 +760,8 @@ static int push_metadata(struct ust_registry_session *registry,
        ssize_t ret;
        struct consumer_socket *socket;
 
-       assert(registry);
-       assert(consumer);
+       LTTNG_ASSERT(registry);
+       LTTNG_ASSERT(consumer);
 
        pthread_mutex_lock(&registry->lock);
        if (registry->metadata_closed) {
@@ -810,8 +810,8 @@ static int close_metadata(struct ust_registry_session *registry,
        uint64_t metadata_key;
        bool registry_was_already_closed;
 
-       assert(registry);
-       assert(consumer);
+       LTTNG_ASSERT(registry);
+       LTTNG_ASSERT(consumer);
 
        rcu_read_lock();
 
@@ -882,11 +882,11 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
        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);
@@ -910,7 +910,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *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);
        }
 
@@ -938,7 +938,7 @@ void delete_ust_app_session(int sock, struct ust_app_session *ua_sess,
                /* 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);
@@ -986,7 +986,7 @@ void delete_ust_app(struct ust_app *app)
        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);
@@ -1088,8 +1088,8 @@ static void destroy_app_session(struct ust_app *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);
@@ -1266,14 +1266,14 @@ static struct ust_app_event_notifier_rule *alloc_ust_app_event_notifier_rule(
                        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);
@@ -1363,7 +1363,7 @@ static struct lttng_ust_abi_filter_bytecode *create_ust_filter_bytecode_from_byt
                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:
@@ -1387,7 +1387,7 @@ create_ust_capture_bytecode_from_bytecode(const struct lttng_bytecode *orig_f)
                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:
@@ -1455,8 +1455,8 @@ static struct ust_app_event *find_ust_app_event(struct lttng_ht *ht,
        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;
@@ -1492,7 +1492,7 @@ static struct ust_app_event_notifier_rule *find_ust_app_event_notifier_rule(
        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);
@@ -1665,7 +1665,7 @@ struct lttng_ust_abi_event_exclusion *create_ust_exclusion_from_exclusion(
                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:
@@ -1682,7 +1682,7 @@ static int set_ust_object_exclusions(struct ust_app *app,
        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();
 
@@ -1882,9 +1882,9 @@ static int send_channel_pid_to_ust(struct ust_app *app,
        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();
 
@@ -1997,7 +1997,7 @@ int create_ust_event(struct ust_app *app, struct ust_app_session *ua_sess,
                        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;
@@ -2040,7 +2040,7 @@ static int init_ust_event_notifier_from_event_rule(
        } 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);
@@ -2071,7 +2071,7 @@ static int init_ust_event_notifier_from_event_rule(
                                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();
@@ -2110,22 +2110,22 @@ static int create_ust_event_notifier(struct ust_app *app,
        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 ||
@@ -2191,7 +2191,7 @@ static int create_ust_event_notifier(struct ust_app *app,
        /* 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 =
@@ -2356,12 +2356,12 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
                                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;
        }
 
@@ -2384,12 +2384,12 @@ static void shadow_copy_session(struct ust_app_session *ua_sess,
                                        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,
@@ -2448,8 +2448,8 @@ static int setup_buffer_reg_pid(struct ust_app_session *ua_sess,
        int ret = 0;
        struct buffer_reg_pid *reg_pid;
 
-       assert(ua_sess);
-       assert(app);
+       LTTNG_ASSERT(ua_sess);
+       LTTNG_ASSERT(app);
 
        rcu_read_lock();
 
@@ -2517,8 +2517,8 @@ static int setup_buffer_reg_uid(struct ltt_ust_session *usess,
        int ret = 0;
        struct buffer_reg_uid *reg_uid;
 
-       assert(usess);
-       assert(app);
+       LTTNG_ASSERT(usess);
+       LTTNG_ASSERT(app);
 
        rcu_read_lock();
 
@@ -2590,9 +2590,9 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
        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();
 
@@ -2628,7 +2628,7 @@ static int find_or_create_ust_app_session(struct ltt_ust_session *usess,
                }
                break;
        default:
-               assert(0);
+               abort();
                ret = -EINVAL;
                goto error;
        }
@@ -2701,8 +2701,8 @@ static int ht_match_ust_app_ctx(struct cds_lfht_node *node, const void *_key)
        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;
@@ -2753,8 +2753,8 @@ struct ust_app_ctx *find_ust_app_context(struct lttng_ht *ht,
        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),
@@ -2919,10 +2919,10 @@ static int do_consumer_create_channel(struct ltt_ust_session *usess,
        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();
@@ -3011,8 +3011,8 @@ static int duplicate_stream_object(struct buffer_reg_stream *reg_stream,
 {
        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);
@@ -3047,8 +3047,8 @@ static int duplicate_channel_object(struct buffer_reg_channel *buf_reg_chan,
 {
        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);
@@ -3087,8 +3087,8 @@ static int setup_buffer_reg_streams(struct buffer_reg_channel *buf_reg_chan,
        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");
 
@@ -3132,8 +3132,8 @@ static int create_buffer_reg_channel(struct buffer_reg_session *reg_sess,
        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);
 
@@ -3142,7 +3142,7 @@ static int create_buffer_reg_channel(struct buffer_reg_session *reg_sess,
        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;
@@ -3180,10 +3180,10 @@ static int setup_buffer_reg_channel(struct buffer_reg_session *reg_sess,
 {
        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);
 
@@ -3216,10 +3216,10 @@ static int send_channel_uid_to_ust(struct buffer_reg_channel *buf_reg_chan,
        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);
 
@@ -3291,10 +3291,10 @@ static int create_channel_per_uid(struct ust_app *app,
        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);
 
@@ -3304,7 +3304,7 @@ static int create_channel_per_uid(struct ust_app *app,
         * 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);
@@ -3321,9 +3321,9 @@ static int create_channel_per_uid(struct ust_app *app,
        }
 
        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
@@ -3361,7 +3361,7 @@ static int create_channel_per_uid(struct ust_app *app,
        pthread_mutex_lock(&reg_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(&reg_uid->registry->reg.ust->lock);
@@ -3416,10 +3416,10 @@ static int create_channel_per_pid(struct ust_app *app,
        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);
 
@@ -3427,7 +3427,7 @@ static int create_channel_per_pid(struct ust_app *app,
 
        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);
@@ -3438,10 +3438,10 @@ static int create_channel_per_pid(struct ust_app *app,
        }
 
        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,
@@ -3464,7 +3464,7 @@ static int create_channel_per_pid(struct ust_app *app,
        chan_reg_key = ua_chan->key;
        pthread_mutex_lock(&registry->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(&registry->lock);
 
@@ -3510,11 +3510,11 @@ static int ust_app_channel_send(struct ust_app *app,
 {
        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) {
@@ -3535,7 +3535,7 @@ static int ust_app_channel_send(struct ust_app *app,
                break;
        }
        default:
-               assert(0);
+               abort();
                ret = -EINVAL;
                goto error;
        }
@@ -3728,13 +3728,13 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
        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(&registry->lock);
 
@@ -3777,10 +3777,10 @@ static int create_ust_app_metadata(struct ust_app_session *ua_sess,
        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
@@ -3861,8 +3861,8 @@ struct ust_app *ust_app_create(struct ust_register_msg *msg, int sock)
        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);
 
@@ -3957,8 +3957,8 @@ error:
  */
 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);
 
@@ -3999,7 +3999,7 @@ int ust_app_version(struct ust_app *app)
 {
        int ret;
 
-       assert(app);
+       LTTNG_ASSERT(app);
 
        pthread_mutex_lock(&app->sock_lock);
        ret = lttng_ust_ctl_tracer_version(app->sock, &app->version);
@@ -4039,7 +4039,7 @@ int ust_app_setup_event_notifier_group(struct ust_app *app)
        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;
@@ -4152,7 +4152,7 @@ void ust_app_unregister(int sock)
        /* 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);
@@ -4222,7 +4222,7 @@ void ust_app_unregister(int 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
@@ -4545,7 +4545,7 @@ void ust_app_clean_list(void)
                         * 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);
                }
@@ -4554,7 +4554,7 @@ void ust_app_clean_list(void)
        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);
                }
        }
@@ -4564,7 +4564,7 @@ void ust_app_clean_list(void)
                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);
                }
        }
 
@@ -4615,7 +4615,7 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
        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);
 
@@ -4640,11 +4640,11 @@ int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
                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);
@@ -4669,7 +4669,7 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
        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);
 
@@ -4715,7 +4715,7 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
        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);
@@ -4777,7 +4777,7 @@ int ust_app_channel_create(struct ltt_ust_session *usess,
        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,
@@ -4857,7 +4857,7 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
        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);
 
@@ -4943,7 +4943,7 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
        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);
 
@@ -4975,7 +4975,7 @@ int ust_app_create_event_glb(struct ltt_ust_session *usess,
                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);
 
@@ -5171,7 +5171,7 @@ int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app)
        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);
@@ -5235,7 +5235,7 @@ int ust_app_flush_app_session(struct ust_app *app,
                break;
        case LTTNG_BUFFER_PER_UID:
        default:
-               assert(0);
+               abort();
                break;
        }
 
@@ -5318,7 +5318,7 @@ int ust_app_flush_session(struct ltt_ust_session *usess)
        }
        default:
                ret = -1;
-               assert(0);
+               abort();
                break;
        }
 
@@ -5378,7 +5378,7 @@ int ust_app_clear_quiescent_app_session(struct ust_app *app,
                break;
        case LTTNG_BUFFER_PER_UID:
        default:
-               assert(0);
+               abort();
                ret = -1;
                break;
        }
@@ -5467,7 +5467,7 @@ int ust_app_clear_quiescent_session(struct ltt_ust_session *usess)
        }
        default:
                ret = -1;
-               assert(0);
+               abort();
                break;
        }
 
@@ -5713,7 +5713,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                goto end;
        }
 
-       assert(triggers);
+       LTTNG_ASSERT(triggers);
 
        t_status = lttng_triggers_get_count(triggers, &count);
        if (t_status != LTTNG_TRIGGER_STATUS_OK) {
@@ -5729,7 +5729,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                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);
@@ -5743,7 +5743,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                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. */
@@ -5783,7 +5783,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                                        lttng_triggers_get_at_index(
                                                        triggers, i);
 
-                       assert(trigger);
+                       LTTNG_ASSERT(trigger);
 
                        notification_thread_token =
                                        lttng_trigger_get_tracer_token(trigger);
@@ -5805,7 +5805,7 @@ void ust_app_synchronize_event_notifier_rules(struct ust_app *app)
                 */
                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);
@@ -5833,9 +5833,9 @@ void ust_app_synchronize_all_channels(struct ltt_ust_session *usess,
        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) {
@@ -5899,7 +5899,7 @@ void ust_app_synchronize(struct ltt_ust_session *usess,
         * 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) {
@@ -5909,7 +5909,7 @@ void ust_app_synchronize(struct ltt_ust_session *usess,
                }
                goto end;
        }
-       assert(ua_sess);
+       LTTNG_ASSERT(ua_sess);
 
        pthread_mutex_lock(&ua_sess->lock);
        if (ua_sess->deleted) {
@@ -5963,8 +5963,8 @@ void ust_app_global_destroy(struct ltt_ust_session *usess, struct ust_app *app)
  */
 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);
@@ -6056,7 +6056,7 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
        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) {
@@ -6109,7 +6109,7 @@ int ust_app_recv_registration(int sock, struct ust_register_msg *msg)
        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,
@@ -6160,7 +6160,7 @@ static struct ust_app_session *find_session_by_objd(struct ust_app *app,
        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);
@@ -6187,7 +6187,7 @@ static struct ust_app_channel *find_channel_by_objd(struct ust_app *app,
        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);
@@ -6242,7 +6242,7 @@ static int reply_ust_register_channel(int sock, int cobjd,
                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. */
@@ -6263,7 +6263,7 @@ static int reply_ust_register_channel(int sock, int cobjd,
        pthread_mutex_lock(&registry->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) {
                /*
@@ -6358,7 +6358,7 @@ static int add_event_ust_registry(int sock, int sobjd, int cobjd, char *name,
                goto error_rcu_unlock;
        }
 
-       assert(ua_chan->session);
+       LTTNG_ASSERT(ua_chan->session);
        ua_sess = ua_chan->session;
 
        registry = get_session_registry(ua_sess);
@@ -6626,7 +6626,7 @@ int ust_app_recv_notify(int sock)
        }
        default:
                /* Should NEVER happen. */
-               assert(0);
+               abort();
        }
 
 error:
@@ -6649,7 +6649,7 @@ void ust_app_notify_sock_unregister(int sock)
        struct ust_app *app;
        struct ust_app_notify_sock_obj *obj;
 
-       assert(sock >= 0);
+       LTTNG_ASSERT(sock >= 0);
 
        rcu_read_lock();
 
@@ -6739,8 +6739,8 @@ enum lttng_error_code ust_app_snapshot_record(
        struct ust_app *app;
        char *trace_path = NULL;
 
-       assert(usess);
-       assert(output);
+       LTTNG_ASSERT(usess);
+       LTTNG_ASSERT(output);
 
        rcu_read_lock();
 
@@ -6889,7 +6889,7 @@ enum lttng_error_code ust_app_snapshot_record(
                break;
        }
        default:
-               assert(0);
+               abort();
                break;
        }
 
@@ -6909,7 +6909,7 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
        struct ust_app *app;
        struct lttng_ht_iter iter;
 
-       assert(usess);
+       LTTNG_ASSERT(usess);
 
        switch (usess->buffer_type) {
        case LTTNG_BUFFER_PER_UID:
@@ -6965,7 +6965,7 @@ uint64_t ust_app_get_size_one_more_packet_per_stream(
                break;
        }
        default:
-               assert(0);
+               abort();
                break;
        }
 
@@ -7035,7 +7035,7 @@ int ust_app_pid_get_channel_runtime_stats(struct ltt_ust_session *usess,
                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);
 
@@ -7143,7 +7143,7 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
        struct ust_app *app;
        struct ltt_ust_session *usess = session->ust_session;
 
-       assert(usess);
+       LTTNG_ASSERT(usess);
 
        rcu_read_lock();
 
@@ -7271,7 +7271,7 @@ enum lttng_error_code ust_app_rotate_session(struct ltt_session *session)
                break;
        }
        default:
-               assert(0);
+               abort();
                break;
        }
 
@@ -7291,7 +7291,7 @@ enum lttng_error_code ust_app_create_channel_subdirectories(
        char *pathname_index;
        int fmt_ret;
 
-       assert(usess->current_trace_chunk);
+       LTTNG_ASSERT(usess->current_trace_chunk);
        rcu_read_lock();
 
        switch (usess->buffer_type) {
@@ -7402,7 +7402,7 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
        struct ust_app *app;
        struct ltt_ust_session *usess = session->ust_session;
 
-       assert(usess);
+       LTTNG_ASSERT(usess);
 
        rcu_read_lock();
 
@@ -7515,7 +7515,7 @@ enum lttng_error_code ust_app_clear_session(struct ltt_session *session)
                break;
        }
        default:
-               assert(0);
+               abort();
                break;
        }
 
@@ -7559,7 +7559,7 @@ enum lttng_error_code ust_app_open_packets(struct ltt_session *session)
        struct lttng_ht_iter iter;
        struct ltt_ust_session *usess = session->ust_session;
 
-       assert(usess);
+       LTTNG_ASSERT(usess);
 
        rcu_read_lock();
 
index 14cce9b4f683940d6fa62fcd269a364563dcad64..0fe560661a0b125ceefc3a545d8fc020f1a57854 100644 (file)
@@ -48,11 +48,11 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
        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");
 
@@ -106,7 +106,7 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                 */
        } 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));
@@ -170,10 +170,10 @@ static int ask_channel_creation(struct ust_app_session *ua_sess,
                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,
@@ -201,11 +201,11 @@ int ust_consumer_ask_channel(struct ust_app_session *ua_sess,
 {
        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;
@@ -238,8 +238,8 @@ int ust_consumer_get_channel(struct consumer_socket *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_GET_CHANNEL;
@@ -302,7 +302,7 @@ int ust_consumer_get_channel(struct consumer_socket *socket,
        }
 
        /* 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);
@@ -332,8 +332,8 @@ int ust_consumer_destroy_channel(struct consumer_socket *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;
@@ -363,9 +363,9 @@ int ust_consumer_send_stream_to_ust(struct ust_app *app,
 {
        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);
 
@@ -398,10 +398,10 @@ int ust_consumer_send_channel_to_ust(struct ust_app *app,
 {
        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);
@@ -438,7 +438,7 @@ int ust_consumer_metadata_request(struct consumer_socket *socket)
        struct ust_registry_session *ust_reg;
        struct lttcomm_consumer_msg msg;
 
-       assert(socket);
+       LTTNG_ASSERT(socket);
 
        rcu_read_lock();
        health_code_update();
@@ -481,7 +481,7 @@ int ust_consumer_metadata_request(struct consumer_socket *socket)
                }
                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);
index 6c807ccee8673712dbf059739f4dfd35aa133e0f..7110662c744b99508a04932864ed15d718e92d59 100644 (file)
@@ -45,7 +45,7 @@ int get_count_order(unsigned int count)
        if (count & (count - 1)) {
                order++;
        }
-       assert(order >= 0);
+       LTTNG_ASSERT(order >= 0);
        return order;
 }
 
@@ -1183,7 +1183,7 @@ int ust_metadata_session_statedump(struct ust_registry_session *session,
                clock_uuid_s[LTTNG_UUID_STR_LEN];
        int ret = 0;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        lttng_uuid_to_str(session->uuid, uuid_s);
 
index 8a6d313f08141401b6dec4e3484dc4268e718625..93131abaae1b8a1474591441b662a590111cf8d0 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/common.h>
@@ -30,11 +29,11 @@ static int ht_match_event(struct cds_lfht_node *node, const void *_key)
        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. */
@@ -82,7 +81,7 @@ static unsigned long ht_hash_event(const void *_key, unsigned long seed)
        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);
 
@@ -95,7 +94,7 @@ static int compare_enums(const struct ust_registry_enum *reg_enum_a,
        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;
@@ -141,12 +140,12 @@ static int ht_match_enum(struct cds_lfht_node *node, const void *_key)
        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)) {
@@ -172,11 +171,11 @@ static int ht_match_enum_id(struct cds_lfht_node *node, const void *_key)
        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;
@@ -197,7 +196,7 @@ static unsigned long ht_hash_enum(void *_key, unsigned long seed)
 {
        struct ust_registry_enum *key = _key;
 
-       assert(key);
+       LTTNG_ASSERT(key);
        return hash_key_str(key->name, seed);
 }
 
@@ -367,9 +366,9 @@ struct ust_registry_event *ust_registry_find_event(
        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));
@@ -410,10 +409,10 @@ int ust_registry_create_event(struct ust_registry_session *session,
        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();
 
@@ -466,7 +465,7 @@ int ust_registry_create_event(struct ust_registry_session *session,
                        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, "
@@ -516,13 +515,13 @@ void ust_registry_destroy_event(struct ust_registry_channel *chan,
        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);
 
@@ -618,8 +617,8 @@ int ust_registry_create_or_find_enum(struct ust_registry_session *session,
        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();
 
@@ -666,7 +665,7 @@ int ust_registry_create_or_find_enum(struct ust_registry_session *session,
                                ht_hash_enum(reg_enum, lttng_ht_seed),
                                ht_match_enum_id, reg_enum,
                                &reg_enum->node.node);
-               assert(nodep == &reg_enum->node.node);
+               LTTNG_ASSERT(nodep == &reg_enum->node.node);
        }
        DBG("UST registry reply with enum %s with id %" PRIu64 " in sess_objd: %u",
                        enum_name, reg_enum->id, session_objd);
@@ -688,13 +687,13 @@ static void ust_registry_destroy_enum(struct ust_registry_session *reg_session,
        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 = &reg_enum->node.node;
        ret = lttng_ht_del(reg_session->enums, &iter);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
        call_rcu(&reg_enum->rcu_head, destroy_enum_rcu);
 }
 
@@ -728,7 +727,7 @@ static void destroy_channel(struct ust_registry_channel *chan, bool notif)
        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(
@@ -761,7 +760,7 @@ int ust_registry_channel_add(struct ust_registry_session *session,
        int ret = 0;
        struct ust_registry_channel *chan;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        chan = zmalloc(sizeof(*chan));
        if (!chan) {
@@ -818,8 +817,8 @@ struct ust_registry_channel *ust_registry_channel_find(
        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);
 
@@ -844,7 +843,7 @@ void ust_registry_channel_del_free(struct ust_registry_session *session,
        struct ust_registry_channel *chan;
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        rcu_read_lock();
        chan = ust_registry_channel_find(session, key);
@@ -855,7 +854,7 @@ void ust_registry_channel_del_free(struct ust_registry_session *session,
 
        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);
 
@@ -891,7 +890,7 @@ int ust_registry_session_init(struct ust_registry_session **sessionp,
        int ret;
        struct ust_registry_session *session;
 
-       assert(sessionp);
+       LTTNG_ASSERT(sessionp);
 
        session = zmalloc(sizeof(*session));
        if (!session) {
@@ -1007,7 +1006,7 @@ void ust_registry_session_destroy(struct ust_registry_session *reg)
 
        /* On error, EBUSY can be returned if lock. Code flow error. */
        ret = pthread_mutex_destroy(&reg->lock);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
 
        if (reg->channels) {
                rcu_read_lock();
@@ -1016,7 +1015,7 @@ void ust_registry_session_destroy(struct ust_registry_session *reg)
                                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();
index e806082e324678c026a5e112ac7b2d3e28ccc272..6936a03f963de2d0d37a18040f39fbd32b99d2a1 100644 (file)
@@ -60,7 +60,7 @@ void ht_cleanup_push(struct lttng_ht *ht)
        /* 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,
index de066e6dc3410648fff47cb8720ff50ef9885f0c..90a54f7eef87eae4a884737a9d8a8bba67d3d98f 100644 (file)
@@ -15,7 +15,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <urcu/list.h>
 
@@ -559,7 +558,7 @@ enum lttng_domain_type get_domain(void)
        } else if (opt_log4j) {
                return LTTNG_DOMAIN_LOG4J;
        } else {
-               assert(0);
+               abort();
        }
 }
 
index 8fb79d3786c577842475ea9724f92293ec591800..6eaee74b274a56f80c3d474cab35835c332e3ceb 100644 (file)
@@ -437,10 +437,10 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                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) :
@@ -462,10 +462,10 @@ struct lttng_event_expr *ir_op_load_expr_to_event_expr(
                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
@@ -560,7 +560,7 @@ struct lttng_event_expr *ir_op_load_to_event_expr(
 {
        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:
@@ -609,7 +609,7 @@ struct lttng_event_expr *ir_op_root_to_event_expr(const struct ir_op *ir,
 {
        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) {
@@ -706,7 +706,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                        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 =
@@ -909,7 +909,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
         * 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;
 
@@ -1238,7 +1238,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
                        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.");
@@ -1384,8 +1384,8 @@ struct lttng_condition *handle_condition_event(int *argc, const char ***argv)
                                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) {
@@ -1466,7 +1466,7 @@ static struct lttng_rate_policy *parse_rate_policy(const char *policy_str)
        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 ':'. */
@@ -1564,7 +1564,7 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv)
                        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 =
@@ -1585,7 +1585,7 @@ struct lttng_action *handle_action_notify(int *argc, const char ***argv)
                } 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;
 
@@ -1652,8 +1652,8 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
        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 },
@@ -1682,7 +1682,7 @@ static struct lttng_action *handle_action_simple_session_with_policy(int *argc,
                        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;
@@ -1841,7 +1841,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                        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 =
@@ -1898,7 +1898,7 @@ struct lttng_action *handle_action_snapshot_session(int *argc,
                } 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;
 
@@ -2242,7 +2242,7 @@ int cmd_add_trigger(int argc, const char **argv)
                        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 =
index 677c17329070276f6530139f315c1e17409ff0f5..b266c10a9397a8e250c0c156a5d7e2fef547db46 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
@@ -89,8 +88,8 @@ static int mi_created_session(const char *session_name)
        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) {
index 398646f2e65183e5ce77d34eaec60dad3d006f3b..78bbbaaad37e25a6e94648236860fe11a60252db 100644 (file)
@@ -241,7 +241,7 @@ static int destroy_all_sessions(struct lttng_session *sessions, int count)
        int i;
        bool error_occurred = false;
 
-       assert(count >= 0);
+       LTTNG_ASSERT(count >= 0);
        if (count == 0) {
                MSG("No session found, nothing to do.");
        }
index f75c5feb0257bdccfaf1bfa9faad652d359b2ae9..cf9f20bb6d3fd2a539651c6c08d6a09699ca68c5 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 #include <lttng/domain-internal.h>
@@ -55,8 +54,8 @@ static int mi_partial_channel_print(char *channel_name, unsigned int enabled,
 {
        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);
@@ -113,7 +112,7 @@ static int disable_channels(char *session_name)
                dom.type = LTTNG_DOMAIN_UST;
        } else {
                /* Checked by the caller. */
-               assert(0);
+               abort();
        }
 
        handle = lttng_create_handle(session_name, &dom);
index 0bfd0c506c850e4fedca383615c13d67365a7006..687da1f92abf63e47466f7bc640e697fa5029341 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 #include <lttng/domain-internal.h>
@@ -111,8 +110,8 @@ static int mi_print_event(const char *event_name, int enabled, int success)
 {
        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);
@@ -175,7 +174,7 @@ static int disable_events(char *session_name)
                dom.type = LTTNG_DOMAIN_PYTHON;
        } else {
                /* Checked by the caller. */
-               assert(0);
+               abort();
        }
 
        channel_name = opt_channel_name;
index dd79926f81d6c80b3ef70d56cb8a188d4b491a9c..194ec541eae167077597997fce467e3f10c101bd 100644 (file)
@@ -14,7 +14,6 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <assert.h>
 #include <ctype.h>
 
 #include <common/sessiond-comm/sessiond-comm.h>
@@ -181,7 +180,7 @@ static int enable_channel(char *session_name)
                }
        } else {
                /* Checked by the caller. */
-               assert(0);
+               abort();
        }
 
        set_default_attr(&dom);
@@ -222,7 +221,7 @@ static int enable_channel(char *session_name)
 
        /* Mi open channels element */
        if (lttng_opt_mi) {
-               assert(writer);
+               LTTNG_ASSERT(writer);
                ret = mi_lttng_channels_open(writer);
                if (ret) {
                        ret = CMD_ERROR;
@@ -427,7 +426,7 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
 
                        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!",
@@ -443,7 +442,7 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
 
                        /* 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;
@@ -463,7 +462,7 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
 
                        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!",
@@ -479,7 +478,7 @@ int cmd_enable_channels(int argc, const char **argv)
                        }
 
                        /* 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;
index 948663412fe1c563e2b5f6a08e902eaac0a618ed..bbf7c569906c1f9ef7d4db0c2f2fb7c0d446b1cd 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -200,7 +199,7 @@ int mi_print_exclusion(const struct lttng_dynamic_pointer_array *exclusions)
        size_t i;
        const size_t count = lttng_dynamic_pointer_array_get_count(exclusions);
 
-       assert(writer);
+       LTTNG_ASSERT(writer);
 
        if (count == 0) {
                ret = 0;
@@ -477,7 +476,7 @@ static int enable_events(char *session_name)
                dom.buf_type = LTTNG_BUFFER_PER_UID;
        } else {
                /* Checked by the caller. */
-               assert(0);
+               abort();
        }
 
        if (opt_exclude) {
@@ -494,7 +493,7 @@ static int enable_events(char *session_name)
                        /* Exclusions supported */
                        break;
                default:
-                       assert(0);
+                       abort();
                }
        }
 
@@ -554,7 +553,7 @@ static int enable_events(char *session_name)
                        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;
@@ -585,7 +584,7 @@ static int enable_events(char *session_name)
                                        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) {
@@ -844,7 +843,7 @@ static int enable_events(char *session_name)
                                }
                                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) {
@@ -999,7 +998,7 @@ static int enable_events(char *session_name)
                        strncpy(ev->name, event_name, LTTNG_SYMBOL_NAME_LEN);
                        ev->name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                } else {
-                       assert(0);
+                       abort();
                }
 
                if (!opt_filter) {
@@ -1078,7 +1077,7 @@ static int enable_events(char *session_name)
                                                exclusion_string);
                                        break;
                                default:
-                                       assert(0);
+                                       abort();
                                }
                        }
                        free(exclusion_string);
index 7ef21c2f58008117d5d2a645a890e0819af067e4..a9a01e7f14a65db8084e5b8cdbdaa6c0ad038c8d 100644 (file)
@@ -10,7 +10,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #include "../command.h"
 #include <common/utils.h>
@@ -112,7 +111,7 @@ int cmd_help(int argc, const char **argv, const struct cmd_struct commands[])
        /* 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:
index 34a9c8aa0d612e7dc49ea78d9f0dbfa9d762230e..f4c97cbd1c345d669f5d95ee84b655ade3f51367 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 #include <common/time.h>
@@ -426,7 +425,7 @@ static void print_events(struct lttng_event *event)
                /* Fall-through. */
        default:
                /* We should never have "all" events in list. */
-               assert(0);
+               abort();
                break;
        }
 
index 0ef94f83677d93a673ba7b343af54c3418afff9d..50c5894df1e3a50b9e263177fe55937fb3fb065f 100644 (file)
@@ -61,11 +61,11 @@ static void print_condition_session_consumed_size(
        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);
@@ -81,15 +81,15 @@ static void print_condition_buffer_usage(
 
        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);
@@ -102,12 +102,12 @@ static void print_condition_buffer_usage(
        } 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);
        }
@@ -121,7 +121,7 @@ static void print_condition_session_rotation(
 
        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);
 }
@@ -170,7 +170,7 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
 
        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);
 
@@ -179,7 +179,7 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
        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(
@@ -204,7 +204,7 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_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);
@@ -215,12 +215,12 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
                        _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++) {
@@ -228,7 +228,7 @@ void print_event_rule_user_tracepoint(const struct lttng_event_rule *event_rule)
 
                        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);
                }
@@ -246,7 +246,7 @@ void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rul
 
        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);
 
@@ -255,7 +255,7 @@ void print_event_rule_kernel_tracepoint(const struct lttng_event_rule *event_rul
        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(")");
@@ -308,7 +308,7 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
 
        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);
 
@@ -317,7 +317,7 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
        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(
@@ -342,7 +342,7 @@ void print_event_rule_logging(const struct lttng_event_rule *event_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);
@@ -353,7 +353,7 @@ void print_event_rule_logging(const struct lttng_event_rule *event_rule)
                        _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(")");
@@ -420,7 +420,7 @@ void print_event_rule_kernel_probe(const struct lttng_event_rule *event_rule)
        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) {
@@ -453,7 +453,7 @@ void print_event_rule_userspace_probe(const struct lttng_event_rule *event_rule)
        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);
@@ -517,14 +517,14 @@ void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
        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(
@@ -535,7 +535,7 @@ void print_event_rule_syscall(const struct lttng_event_rule *event_rule)
        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(")");
@@ -623,13 +623,13 @@ void print_one_event_expr(const struct lttng_event_expr *event_expr)
 
                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);
 
@@ -658,9 +658,9 @@ void print_error_query_results(struct lttng_error_query_results *results,
        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:");
@@ -674,21 +674,21 @@ void print_error_query_results(struct lttng_error_query_results *results,
 
                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;
@@ -722,14 +722,14 @@ static void print_condition_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);
 
        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:");
@@ -760,19 +760,19 @@ static void print_action_errors(const struct lttng_trigger *trigger,
        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);
@@ -804,7 +804,7 @@ void print_one_action(const struct lttng_trigger *trigger,
        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:
@@ -820,7 +820,7 @@ void print_one_action(const struct lttng_trigger *trigger,
        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(
@@ -833,7 +833,7 @@ void print_one_action(const struct lttng_trigger *trigger,
        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(
@@ -846,7 +846,7 @@ void print_one_action(const struct lttng_trigger *trigger,
        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(
@@ -862,7 +862,7 @@ void print_one_action(const struct lttng_trigger *trigger,
 
                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(
@@ -874,10 +874,10 @@ void print_one_action(const struct lttng_trigger *trigger,
                        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;
@@ -892,13 +892,13 @@ void print_one_action(const struct lttng_trigger *trigger,
                        } 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);
                        }
@@ -980,15 +980,15 @@ void print_trigger_errors(const struct lttng_trigger *trigger)
        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);
@@ -1018,15 +1018,15 @@ void print_condition_errors(const struct lttng_trigger *trigger)
        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);
@@ -1065,10 +1065,10 @@ void print_one_trigger(const struct lttng_trigger *trigger)
                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);
@@ -1106,7 +1106,7 @@ void print_one_trigger(const struct lttng_trigger *trigger)
                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;
@@ -1138,10 +1138,10 @@ int compare_triggers_by_name(const void *a, const void *b)
 
        /* 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);
 }
@@ -1219,8 +1219,8 @@ static enum lttng_error_code mi_error_query_trigger_callback(
        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);
@@ -1230,11 +1230,11 @@ static enum lttng_error_code mi_error_query_trigger_callback(
                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,
@@ -1254,8 +1254,8 @@ static enum lttng_error_code mi_error_query_action_callback(
        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);
@@ -1265,11 +1265,11 @@ static enum lttng_error_code mi_error_query_action_callback(
                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,
@@ -1288,8 +1288,8 @@ static enum lttng_error_code mi_error_query_condition_callback(
        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);
@@ -1299,11 +1299,11 @@ static enum lttng_error_code mi_error_query_condition_callback(
                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,
index 7f5f1a0c59ac37daae5d11d73ca909a340926ab0..cdc3905168a7b12ee37c8f34f99d88364c4315ff 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 #include <common/config/session-config.h>
@@ -57,8 +56,8 @@ static struct poptOption the_load_opts[] = {
 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);
@@ -84,7 +83,7 @@ end:
 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 */
index f36be65fd3b66a76a31d1a3cc74486d30f8159ba..35aea004e67aecb05b5c44c54630468b82c551ce 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
@@ -58,7 +57,7 @@ static int count_arguments(const char **argv)
 {
        int i = 0;
 
-       assert(argv);
+       LTTNG_ASSERT(argv);
 
        while (argv[i] != NULL) {
                i++;
@@ -98,7 +97,7 @@ static int handle_command(const char **argv)
        }
 
        argc = count_arguments(argv);
-       assert(argc >= 1);
+       LTTNG_ASSERT(argc >= 1);
 
        cmd = &actions[i];
        while (cmd->func != NULL) {
index 5328ee37336e36014f204caf06e8f20a4119fa73..0e904f8abcba1cdc6c92f6e4b5be3030ba84dac9 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <ctype.h>
 #include <popt.h>
 #include <stdio.h>
@@ -60,7 +59,7 @@ static int count_arguments(const char **argv)
 {
        int i = 0;
 
-       assert(argv);
+       LTTNG_ASSERT(argv);
 
        while (argv[i] != NULL) {
                i++;
@@ -117,7 +116,7 @@ static int handle_command(const char **argv)
        }
 
        argc = count_arguments(argv);
-       assert(argc >= 1);
+       LTTNG_ASSERT(argc >= 1);
 
        cmd = &actions[i];
        while (cmd->func != NULL) {
index ce0e83ec7dfe5bef3c48fd8383e3f2d9fa7e1d71..2ac237c3a872ee7449a065d403f601458f615794 100644 (file)
@@ -170,7 +170,7 @@ int cmd_remove_trigger(int argc, const char **argv)
        }
 
        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;
@@ -191,7 +191,7 @@ int cmd_remove_trigger(int argc, const char **argv)
 
                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;
index ec816315789b83ec5cedb9602db88dc2394fa522..aa0923cc20d2af039b66d4ac5904adc4a6bddba3 100644 (file)
@@ -15,7 +15,6 @@
 #include <unistd.h>
 #include <inttypes.h>
 #include <ctype.h>
-#include <assert.h>
 
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/mi-lttng.h>
index 7d09a42a28192d0328ad6eb04c1772d9258853a2..4231922ad3f724f5ac36995184efd5c6053e7cdb 100644 (file)
@@ -11,7 +11,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 
@@ -49,8 +48,8 @@ static struct poptOption save_opts[] = {
 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);
@@ -76,7 +75,7 @@ end:
 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 */
index 947feb9d44dff4b64058e6797e3560c771b3a2e4..fb42d14d5d5e5b931485383c71c291c52e30821e 100644 (file)
@@ -13,7 +13,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <common/mi-lttng.h>
 
@@ -48,8 +47,8 @@ static int mi_print(char *session_name)
 {
        int ret;
 
-       assert(writer);
-       assert(session_name);
+       LTTNG_ASSERT(writer);
+       LTTNG_ASSERT(session_name);
 
        /*
         * Open a sessions element
index 513257a3c43f8bf8785f60b5ec52fddbf1714d36..c37e09a7dbed02eb1c192481c0955544808e4d7b 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <popt.h>
 #include <stdio.h>
@@ -15,7 +14,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <common/utils.h>
 #include <common/mi-lttng.h>
@@ -81,7 +79,7 @@ static int count_arguments(const char **argv)
 {
        int i = 0;
 
-       assert(argv);
+       LTTNG_ASSERT(argv);
 
        while (argv[i] != NULL) {
                i++;
@@ -473,7 +471,7 @@ static enum cmd_error_code handle_command(const char **argv)
 
        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) {
index 448efd5cd3cd8eec84f2d1567c92c3e15a1d2f14..d69da40abe677b63c6ba5860416667ff97b6917c 100644 (file)
@@ -13,7 +13,6 @@
 #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>
@@ -49,8 +48,8 @@ static struct poptOption long_options[] = {
 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);
index e796aa97c448da5ebde65f908b4456a56dbb680a..f175e2a86bb4f571061cfe6743d2492730cf19e6 100644 (file)
@@ -17,7 +17,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#include <assert.h>
 
 #include <urcu/list.h>
 
index 4ac795f5b4a44a121f4169f9f2c004cf6c6c5597..07f3cb71105127b36df329b44996109c967422dc 100644 (file)
@@ -9,7 +9,6 @@
 #include <string.h>
 #include <strings.h>
 #include <ctype.h>
-#include <assert.h>
 
 struct loglevel_name_value {
        const char *name;
index 6af20bbdee0e6836a5bd668058345898390d6f3a..2d0bf4763a8e95fabecacecd91db2ffeabe8af50 100644 (file)
@@ -209,7 +209,7 @@ int parse_userspace_probe_opts(const char *opt,
        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 ':'.
index 54d08c16007edbeede162e78dd31075983f3d4ed..6440ca7dfc883db2bd282aeff098e4acaa910977 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <limits.h>
@@ -318,7 +317,7 @@ const char *get_event_type_str(enum lttng_event_type type)
                break;
        default:
                /* Should not have an unknown event type or else define it. */
-               assert(0);
+               abort();
        }
 
        return str_event_type;
@@ -570,7 +569,7 @@ int show_cmd_help(const char *cmd_name, const char *help_msg)
        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);
index 4dabfff303e547bc973c389e5d7baae38954a792..56bd2977a8ef3d2b7cd0b5c00a7531e641ea96db 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/mi-lttng.h>
 #include <lttng/action/action-internal.h>
@@ -94,7 +93,7 @@ void lttng_action_put(struct lttng_action *action)
                return;
        }
 
-       assert(action->destroy);
+       LTTNG_ASSERT(action->destroy);
        urcu_ref_put(&action->ref, action_destroy_ref);
 }
 
@@ -222,7 +221,7 @@ ssize_t lttng_action_create_from_payload(struct lttng_payload_view *view,
                goto end;
        }
 
-       assert(*action);
+       LTTNG_ASSERT(*action);
 
        consumed_len = sizeof(struct lttng_action_comm) +
                       specific_action_consumed_len;
@@ -250,7 +249,7 @@ bool lttng_action_is_equal(const struct lttng_action *a,
                goto end;
        }
 
-       assert(a->equal);
+       LTTNG_ASSERT(a->equal);
        is_equal = a->equal(a, b);
 end:
        return is_equal;
@@ -351,8 +350,8 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig
        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);
@@ -375,7 +374,7 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig
                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;
@@ -397,7 +396,7 @@ enum lttng_error_code lttng_action_mi_serialize(const struct lttng_trigger *trig
                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);
index 8c5a5bffccf3252bd610c17739e60aec83f711a8..59d8279385a3677d9e8f5e902b348a90f1e31b22 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/buffer-view.h>
 #include <common/dynamic-buffer.h>
 #include <common/error.h>
@@ -293,7 +292,7 @@ ssize_t lttng_firing_policy_create_from_payload(struct lttng_payload_view *view,
                goto end;
        }
 
-       assert(*firing_policy);
+       LTTNG_ASSERT(*firing_policy);
 
        consumed_len = sizeof(struct lttng_firing_policy_comm) +
                        specific_firing_policy_consumed_len;
@@ -321,7 +320,7 @@ bool lttng_firing_policy_is_equal(const struct lttng_firing_policy *a,
                goto end;
        }
 
-       assert(a->equal);
+       LTTNG_ASSERT(a->equal);
        is_equal = a->equal(a, b);
 end:
        return is_equal;
@@ -349,7 +348,7 @@ static const struct lttng_firing_policy_every_n *
 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);
@@ -363,8 +362,8 @@ static int lttng_firing_policy_every_n_serialize(
        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;
@@ -474,7 +473,7 @@ static bool lttng_firing_policy_every_n_should_execute(
                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);
@@ -499,7 +498,7 @@ static const struct lttng_firing_policy_once_after_n *
 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);
@@ -513,8 +512,8 @@ static int lttng_firing_policy_once_after_n_serialize(
        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(
@@ -628,7 +627,7 @@ LTTNG_HIDDEN
 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);
 }
 
@@ -637,7 +636,7 @@ static bool lttng_firing_policy_once_after_n_should_execute(
 {
        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(
index 3713cbd76da49f69c319f86a46def560f284616c..4429c0d766dfa29a427a84f76060ee474a43fdd9 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/dynamic-array.h>
 #include <common/error.h>
 #include <common/macros.h>
@@ -45,7 +44,7 @@ static void destroy_lttng_action_list_element(void *ptr)
 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);
 }
@@ -53,7 +52,7 @@ static struct lttng_action_list *action_list_from_action(
 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);
 }
@@ -64,7 +63,7 @@ static bool lttng_action_list_validate(struct lttng_action *action)
        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);
 
@@ -75,7 +74,7 @@ static bool lttng_action_list_validate(struct lttng_action *action)
                                lttng_dynamic_pointer_array_get_pointer(
                                                &action_list->actions, i);
 
-               assert(child);
+               LTTNG_ASSERT(child);
 
                if (!lttng_action_validate(child)) {
                        valid = false;
@@ -116,8 +115,8 @@ static bool lttng_action_list_is_equal(
                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;
@@ -137,9 +136,9 @@ static int lttng_action_list_serialize(
        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);
 
@@ -161,7 +160,7 @@ static int lttng_action_list_serialize(
                                lttng_dynamic_pointer_array_get_pointer(
                                                &action_list->actions, i);
 
-               assert(child);
+               LTTNG_ASSERT(child);
 
                ret = lttng_action_serialize(child, payload);
                if (ret) {
@@ -293,9 +292,9 @@ enum lttng_error_code lttng_action_list_mi_serialize(
        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(
@@ -312,7 +311,7 @@ enum lttng_error_code lttng_action_list_mi_serialize(
                                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.
index 93726468e166004ef10cfb4589358a74ca78c134..c34f3845f7423725f5f0c5a83e5be0f9bb7c3bf3 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -20,7 +19,7 @@
 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);
 }
@@ -28,7 +27,7 @@ static struct lttng_action_notify *action_notify_from_action(
 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);
 }
@@ -92,13 +91,13 @@ static enum lttng_error_code lttng_action_notify_mi_serialize(
        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(
index 4ee649928f646cee1de22306f71e690fc1bac9fa..9e1b448a6e20a9a6a6ac48ea1965c608bbc82900 100644 (file)
@@ -102,8 +102,8 @@ int lttng_action_path_copy(const struct lttng_action_path *src,
        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);
index 8b3065767cd015890c402179db8f04d7a8b63bc5..bb1366eab8f68b6e869e1da2306df676c89a1cbb 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/buffer-view.h>
 #include <common/dynamic-buffer.h>
 #include <common/error.h>
@@ -296,7 +295,7 @@ ssize_t lttng_rate_policy_create_from_payload(struct lttng_payload_view *view,
                goto end;
        }
 
-       assert(*rate_policy);
+       LTTNG_ASSERT(*rate_policy);
 
        consumed_len = sizeof(struct lttng_rate_policy_comm) +
                        specific_rate_policy_consumed_len;
@@ -324,7 +323,7 @@ bool lttng_rate_policy_is_equal(const struct lttng_rate_policy *a,
                goto end;
        }
 
-       assert(a->equal);
+       LTTNG_ASSERT(a->equal);
        is_equal = a->equal(a, b);
 end:
        return is_equal;
@@ -351,7 +350,7 @@ bool lttng_rate_policy_should_execute(
 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);
 }
@@ -360,7 +359,7 @@ static const struct lttng_rate_policy_every_n *
 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);
 }
@@ -373,8 +372,8 @@ static int lttng_rate_policy_every_n_serialize(
        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;
@@ -445,9 +444,9 @@ static enum lttng_error_code lttng_rate_policy_every_n_mi_serialize(
        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);
@@ -539,7 +538,7 @@ static bool lttng_rate_policy_every_n_should_execute(
                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);
@@ -563,7 +562,7 @@ static bool lttng_rate_policy_every_n_should_execute(
 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);
@@ -573,7 +572,7 @@ static const struct lttng_rate_policy_once_after_n *
 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);
@@ -586,8 +585,8 @@ static int lttng_rate_policy_once_after_n_serialize(
        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;
@@ -661,9 +660,9 @@ static enum lttng_error_code lttng_rate_policy_once_after_n_mi_serialize(
        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);
@@ -756,7 +755,7 @@ LTTNG_HIDDEN
 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);
 }
 
@@ -765,7 +764,7 @@ static bool lttng_rate_policy_once_after_n_should_execute(
 {
        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);
@@ -788,9 +787,9 @@ enum lttng_error_code lttng_rate_policy_mi_serialize(
        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(
index 1eddacaea5b3fdd23db7eec64af65f6e867318d6..e519d45d827b2b7771dbb198560aac54d02c1110 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -46,7 +45,7 @@ lttng_action_rotate_session_internal_get_rate_policy(
 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);
 }
@@ -54,7 +53,7 @@ static struct lttng_action_rotate_session *action_rotate_session_from_action(
 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);
 }
@@ -93,8 +92,8 @@ static bool lttng_action_rotate_session_is_equal(
        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;
        }
@@ -111,12 +110,12 @@ static int lttng_action_rotate_session_serialize(
        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);
@@ -214,7 +213,7 @@ ssize_t lttng_action_rotate_session_create_from_payload(
                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;
@@ -240,17 +239,17 @@ static enum lttng_error_code lttng_action_rotate_session_mi_serialize(
        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(
index 6c765edeac12cf90b71202aab1d91439d7a1797d..26ddd1ba693465139e8466958a14ba2aeb13cf6e 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -63,7 +62,7 @@ lttng_action_snapshot_session_internal_get_rate_policy(
 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);
@@ -72,7 +71,7 @@ action_snapshot_session_from_action(struct lttng_action *action)
 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);
@@ -115,8 +114,8 @@ static bool lttng_action_snapshot_session_is_equal(
        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;
        }
@@ -146,8 +145,8 @@ static int lttng_action_snapshot_session_serialize(
        int ret;
        size_t size_before_comm;
 
-       assert(action);
-       assert(payload);
+       LTTNG_ASSERT(action);
+       LTTNG_ASSERT(payload);
 
        size_before_comm = payload->buffer.size;
 
@@ -162,7 +161,7 @@ static int lttng_action_snapshot_session_serialize(
                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);
 
@@ -384,17 +383,17 @@ static enum lttng_error_code lttng_action_snapshot_session_mi_serialize(
        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(
@@ -413,7 +412,7 @@ static enum lttng_error_code lttng_action_snapshot_session_mi_serialize(
        /* 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;
index 7920982588e96e55e18017a76bb918294b5cdfea..da7aad81fc7f0e4773183f5802e112fb50dfcbd4 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -46,7 +45,7 @@ lttng_action_start_session_internal_get_rate_policy(
 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);
 }
@@ -54,7 +53,7 @@ static struct lttng_action_start_session *action_start_session_from_action(
 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);
 }
@@ -93,8 +92,8 @@ static bool lttng_action_start_session_is_equal(
        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;
        }
@@ -112,12 +111,12 @@ static int lttng_action_start_session_serialize(
        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);
@@ -217,7 +216,7 @@ ssize_t lttng_action_start_session_create_from_payload(
                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;
@@ -243,17 +242,17 @@ static enum lttng_error_code lttng_action_start_session_mi_serialize(
        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(
index 39d174277345b10e444fb4ecd1c6be1a2c6f1c50..fa2c77b1352cf3bff466c89cc627602cd28ed279 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -46,7 +45,7 @@ lttng_action_stop_session_internal_get_rate_policy(
 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);
 }
@@ -54,7 +53,7 @@ static struct lttng_action_stop_session *action_stop_session_from_action(
 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);
 }
@@ -93,8 +92,8 @@ static bool lttng_action_stop_session_is_equal(
        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;
        }
@@ -112,12 +111,12 @@ static int lttng_action_stop_session_serialize(
        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);
@@ -217,7 +216,7 @@ ssize_t lttng_action_stop_session_create_from_payload(
                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;
@@ -243,17 +242,17 @@ static enum lttng_error_code lttng_action_stop_session_mi_serialize(
        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(
index 68bb5a426d5fb471747e7cd81495a959a12ec7c2..21edec0ab7a85b23c26ab38ee2956c00450a1626 100644 (file)
@@ -4,7 +4,6 @@
  * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
  */
 
-#include <assert.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -17,7 +16,7 @@
 #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
index 04bd1ca354f5555b4b78063ba523684cd93b52c2..bab0559a9f079f02a6c46cb2812e437f864035b0 100644 (file)
@@ -8,7 +8,6 @@
 #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(
@@ -31,7 +30,7 @@ struct lttng_buffer_view lttng_buffer_view_from_view(
 {
        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",
@@ -58,7 +57,7 @@ struct lttng_buffer_view lttng_buffer_view_from_dynamic_buffer(
 {
        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",
index a66d768e871f5eef5ae4be4556d3636c69c9fdca..ed7f46a1856d40b704742754dad335cc5dffe9a9 100644 (file)
@@ -13,7 +13,6 @@
 #include <lttng/constant.h>
 #include <common/dynamic-array.h>
 
-#include <assert.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
@@ -485,7 +484,7 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle(
        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) {
@@ -561,7 +560,7 @@ LTTNG_HIDDEN
 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);
 }
 
@@ -943,7 +942,7 @@ int create_directory_recursive(const struct lttng_directory_handle *handle,
        size_t len;
        int ret;
 
-       assert(path);
+       LTTNG_ASSERT(path);
 
        ret = lttng_strncpy(tmp, path, sizeof(tmp));
        if (ret) {
@@ -1002,7 +1001,7 @@ void lttng_directory_handle_put(struct lttng_directory_handle *handle)
        if (!handle) {
                return;
        }
-       assert(handle->ref.refcount);
+       LTTNG_ASSERT(handle->ref.refcount);
        urcu_ref_put(&handle->ref, lttng_directory_handle_release);
 }
 
@@ -1262,10 +1261,10 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                                lttng_dynamic_array_get_element(
                                                &frames, current_frame_idx);
 
-               assert(current_frame->dir);
+               LTTNG_ASSERT(current_frame->dir);
                ret = lttng_dynamic_buffer_set_size(
                                &current_path, current_frame->path_size);
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
                current_path.data[current_path.size - 1] = '\0';
 
                while ((entry = readdir(current_frame->dir))) {
@@ -1279,7 +1278,7 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
                        /* Set current_path to the entry's path. */
                        ret = lttng_dynamic_buffer_set_size(
                                        &current_path, current_path.size - 1);
-                       assert(!ret);
+                       LTTNG_ASSERT(!ret);
                        ret = lttng_dynamic_buffer_append(&current_path,
                                        &separator, sizeof(separator));
                        if (ret) {
@@ -1370,7 +1369,7 @@ int remove_directory_recursive(const struct lttng_directory_handle *handle,
 
                        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(
index c5dd494b8920317140eb44afbd9f37e52b936e24..398d9d7b0582ab38178335fb18f41df5d4b23319 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdlib.h>
 #include <stdbool.h>
 
@@ -48,7 +47,7 @@ static int resize_poll_event(struct lttng_poll_event *events,
 {
        struct epoll_event *ptr;
 
-       assert(events);
+       LTTNG_ASSERT(events);
 
        ptr = realloc(events->events, new_size * sizeof(*ptr));
        if (ptr == NULL) {
@@ -374,7 +373,7 @@ static int resize_poll_event(struct compat_poll_event_array *array,
 {
        struct pollfd *ptr;
 
-       assert(array);
+       LTTNG_ASSERT(array);
 
        /* Refuse to resize the array more than the max size. */
        if (new_size > poll_max_size) {
@@ -408,7 +407,7 @@ static int update_current_events(struct lttng_poll_event *events)
        int ret;
        struct compat_poll_event_array *current, *wait;
 
-       assert(events);
+       LTTNG_ASSERT(events);
 
        current = &events->current;
        wait = &events->wait;
@@ -602,7 +601,7 @@ int compat_poll_del(struct lttng_poll_event *events, int fd)
        }
 
        /* 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. */
index 7dce4e6eb836c34f3337675bbb4bba722734bdd7..e2a424abe132d564769d69de28aba40b50512324 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef _LTT_POLL_H
 #define _LTT_POLL_H
 
-#include <assert.h>
 #include <string.h>
 #include <unistd.h>
 
@@ -74,8 +73,8 @@ struct compat_epoll_event {
 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;
@@ -117,7 +116,7 @@ static inline int compat_glibc_epoll_create(int size, int flags)
         * fcntl(..).
         */
        int efd = epoll_create(size);
-       assert(fcntl(efd, F_SETFD, flags) != -1);
+       LTTNG_ASSERT(fcntl(efd, F_SETFD, flags) != -1);
        return efd;
 }
 #endif
@@ -279,8 +278,8 @@ struct compat_poll_event {
 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;
index 0b9cfcd8e81df62e1570ca4fe1a5deb9acc25d73..22da01c7a057f62fd88176f30ff80bb8bd6c34b9 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -172,20 +171,20 @@ bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *_a,
        }
 
        /* 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;
        }
@@ -208,22 +207,22 @@ static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
        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);
@@ -238,7 +237,7 @@ static enum lttng_error_code lttng_condition_buffer_usage_mi_serialize(
        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)) {
index 2a21f8190d22ec7e2357df94bd77888557d56493..564b9c344cb4b1b1590e846c62815e2305708d49 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/buffer-view.h>
 #include <common/dynamic-buffer.h>
 #include <common/error.h>
@@ -51,7 +50,7 @@ void lttng_condition_put(struct lttng_condition *condition)
                return;
        }
 
-       assert(condition->destroy);
+       LTTNG_ASSERT(condition->destroy);
        urcu_ref_put(&condition->ref, condition_destroy_ref);
 }
 
@@ -252,9 +251,9 @@ enum lttng_error_code lttng_condition_mi_serialize(
        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);
index 21963d1ae9f12d380ed2cbbf82339f3d6ffcc19f..52bb6ae19f00752d38ae45fb1315af370528e4a2 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -444,17 +443,17 @@ static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
        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(
@@ -481,7 +480,7 @@ static enum lttng_error_code lttng_condition_event_rule_matches_mi_serialize(
 
                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) {
@@ -741,7 +740,7 @@ ssize_t lttng_condition_event_rule_matches_create_from_payload(
        }
 
        /* 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;
@@ -1051,7 +1050,7 @@ bool msgpack_str_is_equal(const struct msgpack_object *obj, const char *str)
 {
        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;
@@ -1074,12 +1073,12 @@ const msgpack_object *get_msgpack_map_obj(const struct msgpack_object *map_obj,
        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;
@@ -1109,8 +1108,8 @@ int event_field_value_from_obj(const msgpack_object *obj,
 {
        int ret = 0;
 
-       assert(obj);
-       assert(field_val);
+       LTTNG_ASSERT(obj);
+       LTTNG_ASSERT(field_val);
 
        switch (obj->type) {
        case MSGPACK_OBJECT_NIL:
@@ -1292,8 +1291,8 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
        size_t i;
        size_t count;
 
-       assert(condition);
-       assert(capture_payload);
+       LTTNG_ASSERT(condition);
+       LTTNG_ASSERT(capture_payload);
 
        /* Initialize value. */
        msgpack_unpacked_init(&unpacked);
@@ -1338,7 +1337,7 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
         */
        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 =
@@ -1348,7 +1347,7 @@ static struct lttng_event_field_value *event_field_value_from_capture_payload(
                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,
index c366a0efcc0899bdad270edc7a2314dfc95df79e..3c1721ff82a670593c1884bdd6ba3b4f0b20c1f3 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -128,8 +127,8 @@ bool lttng_condition_session_consumed_size_is_equal(const struct lttng_condition
                }
        }
 
-       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;
        }
@@ -150,18 +149,18 @@ enum lttng_error_code lttng_condition_session_consumed_size_mi_serialize(
        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,
index cf6a1c5a6539679a3815ca3524e730355b67c127..e2a5adf2d40b74ba2b784b1c4e37ae7758073d7e 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/macros.h>
 #include <common/mi-lttng.h>
@@ -615,9 +614,9 @@ enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
        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:
@@ -635,8 +634,8 @@ enum lttng_error_code lttng_condition_session_rotation_mi_serialize(
 
        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);
index 2263d9478039311163fa5bce2e79554b71f5367b..416f9046ebb702cb4ac0fb3f87633293ecb378b7 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "lttng/tracker.h"
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -260,7 +259,7 @@ static int config_entry_handler_filter(struct handler_filter_args *args,
        int ret = 0;
        struct config_entry entry = { section, name, value };
 
-       assert(args);
+       LTTNG_ASSERT(args);
 
        if (!section || !name || !value) {
                ret = -EIO;
@@ -410,7 +409,7 @@ static xmlChar *encode_string(const char *in_str)
        xmlCharEncodingHandlerPtr handler;
        int out_len, ret, in_len;
 
-       assert(in_str);
+       LTTNG_ASSERT(in_str);
 
        handler = xmlFindCharEncodingHandler(config_xml_encoding);
        if (!handler) {
@@ -1258,7 +1257,7 @@ int process_consumer_output(xmlNodePtr consumer_output_node,
        int ret;
        xmlNodePtr node;
 
-       assert(output);
+       LTTNG_ASSERT(output);
 
        for (node = xmlFirstElementChild(consumer_output_node); node;
                        node = xmlNextElementSibling(node)) {
@@ -1324,7 +1323,7 @@ int create_session_net_output(const char *name, const char *control_uri,
        struct lttng_handle *handle;
        const char *uri = NULL;
 
-       assert(name);
+       LTTNG_ASSERT(name);
 
        handle = lttng_create_handle(name, NULL);
        if (!handle) {
@@ -1353,7 +1352,7 @@ int create_snapshot_session(const char *session_name, xmlNodePtr output_node,
        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) {
@@ -1506,7 +1505,7 @@ int create_session(const char *name,
        const char *data_uri = NULL;
        const char *path = NULL;
 
-       assert(name);
+       LTTNG_ASSERT(name);
 
        if (output_node) {
                consumer_output_node = xmlFirstElementChild(output_node);
@@ -1772,8 +1771,8 @@ int process_probe_attribute_node(xmlNodePtr probe_attribute_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)) {
@@ -1856,9 +1855,9 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
        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) {
@@ -1883,7 +1882,7 @@ int process_event_node(xmlNodePtr event_node, struct lttng_handle *handle,
                event->loglevel = LTTNG_LOGLEVEL_DEBUG;
                break;
        default:
-               assert(0);
+               abort();
        }
 
        for (node = xmlFirstElementChild(event_node); node;
@@ -2188,9 +2187,9 @@ int process_events_node(xmlNodePtr events_node, struct lttng_handle *handle,
        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)) {
@@ -2232,10 +2231,10 @@ int process_channel_attr_node(xmlNodePtr attr_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;
@@ -2538,8 +2537,8 @@ int process_context_node(xmlNodePtr context_node,
        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;
@@ -2783,7 +2782,7 @@ static int process_legacy_pid_tracker_node(
                                        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,
@@ -2911,8 +2910,8 @@ static int process_id_tracker_node(xmlNodePtr id_tracker_node,
        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,
@@ -3099,7 +3098,7 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name)
        xmlNodePtr vgid_tracker_node = NULL;
        xmlNodePtr node;
 
-       assert(session_name);
+       LTTNG_ASSERT(session_name);
 
        ret = init_domain(domain_node, &domain);
        if (ret) {
@@ -3735,7 +3734,7 @@ static int validate_file_read_creds(const char *path)
 {
        int ret;
 
-       assert(path);
+       LTTNG_ASSERT(path);
 
        /* Can we read the file. */
        ret = access(path, R_OK);
@@ -3762,8 +3761,8 @@ int load_session_from_file(const char *path, const char *session_name,
        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) {
@@ -3837,8 +3836,8 @@ int load_session_from_path(const char *path, const char *session_name,
        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) {
@@ -3999,7 +3998,7 @@ static int validate_path_creds(const char *path)
        int ret, uid = getuid();
        struct stat buf;
 
-       assert(path);
+       LTTNG_ASSERT(path);
 
        if (uid == 0) {
                goto valid;
index 1038b84e63fd58cb3fb2dc49a76a6e1a3fc7cdc8..8ef2848400ee150834daa8a72bfd24a7e676f322 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <pthread.h>
 #include <stdlib.h>
 #include <string.h>
@@ -38,7 +37,7 @@ void metadata_cache_reset(struct consumer_metadata_cache *cache)
 {
        const int ret = lttng_dynamic_buffer_set_size(&cache->contents, 0);
 
-       assert(ret == 0);
+       LTTNG_ASSERT(ret == 0);
 }
 
 /*
@@ -83,7 +82,7 @@ consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
        bool cache_is_invalidated = false;
        uint64_t original_size;
 
-       assert(cache);
+       LTTNG_ASSERT(cache);
        ASSERT_LOCKED(cache->lock);
        original_size = cache->contents.size;
 
@@ -112,7 +111,7 @@ consumer_metadata_cache_write(struct consumer_metadata_cache *cache,
                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:
@@ -128,7 +127,7 @@ int consumer_metadata_cache_allocate(struct lttng_consumer_channel *channel)
 {
        int ret;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        channel->metadata_cache = zmalloc(
                        sizeof(struct consumer_metadata_cache));
@@ -196,8 +195,8 @@ int consumer_metadata_cache_flushed(struct lttng_consumer_channel *channel,
        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
index ad0f7024d524f4d82d076d3963d086c93e607b89..be19c1bfd17a3bcf3526096f51ed389c387bd849 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <sys/mman.h>
 #include <unistd.h>
@@ -246,9 +245,9 @@ static int do_sync_metadata(struct lttng_consumer_stream *metadata,
        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
@@ -366,7 +365,7 @@ int consumer_stream_sync_metadata(struct lttng_consumer_local_data *ctx,
        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;
@@ -408,7 +407,7 @@ static int consumer_stream_sync_metadata_index(
 
        /* 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);
 
@@ -776,12 +775,12 @@ void consumer_stream_relayd_close(struct lttng_consumer_stream *stream,
 {
        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. */
@@ -816,7 +815,7 @@ void consumer_stream_close(struct lttng_consumer_stream *stream)
        int ret;
        struct consumer_relayd_sock_pair *relayd;
 
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -865,7 +864,7 @@ void consumer_stream_close(struct lttng_consumer_stream *stream)
        }
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
        }
 
        /* Close output fd. Could be a socket or local file at this point. */
@@ -906,16 +905,16 @@ void consumer_stream_delete(struct lttng_consumer_stream *stream,
        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. */
@@ -937,7 +936,7 @@ void consumer_stream_delete(struct lttng_consumer_stream *stream,
 
        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--;
        }
 }
@@ -947,7 +946,7 @@ void consumer_stream_delete(struct lttng_consumer_stream *stream,
  */
 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);
@@ -958,7 +957,7 @@ void consumer_stream_free(struct lttng_consumer_stream *stream)
  */
 void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream)
 {
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        switch (the_consumer_data.type) {
        case LTTNG_CONSUMER_KERNEL:
@@ -969,7 +968,7 @@ void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream)
                break;
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
        }
 }
 
@@ -978,7 +977,7 @@ void consumer_stream_destroy_buffers(struct lttng_consumer_stream *stream)
  */
 static void destroy_close_stream(struct lttng_consumer_stream *stream)
 {
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        DBG("Consumer stream destroy monitored key: %" PRIu64, stream->key);
 
@@ -997,8 +996,8 @@ static struct lttng_consumer_channel *unref_channel(
 {
        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)
@@ -1020,7 +1019,7 @@ static struct lttng_consumer_channel *unref_channel(
 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) {
@@ -1081,8 +1080,8 @@ int consumer_stream_write_index(struct lttng_consumer_stream *stream,
 {
        int ret;
 
-       assert(stream);
-       assert(element);
+       LTTNG_ASSERT(stream);
+       LTTNG_ASSERT(element);
 
        rcu_read_lock();
        if (stream->net_seq_idx != (uint64_t) -1ULL) {
@@ -1133,7 +1132,7 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream,
        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,
@@ -1213,7 +1212,7 @@ bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream)
         * 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);
 }
 
@@ -1257,9 +1256,9 @@ int consumer_stream_enable_metadata_bucketization(
 {
        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);
@@ -1276,7 +1275,7 @@ end:
 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;
 
index d0cf170dacf1b08f88dcdc77ba1b541d0ede23c6..6d2e6b2b2cbc0ff0183b93f3b67afda3aa846f0b 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <signal.h>
 
@@ -84,7 +83,7 @@ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx,
        struct lttng_consumer_channel *channel;
 
        channel = si->si_value.sival_ptr;
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        if (channel->switch_timer_error) {
                return;
@@ -115,7 +114,7 @@ static void metadata_switch_timer(struct lttng_consumer_local_data *ctx,
                break;
        case LTTNG_CONSUMER_KERNEL:
        case LTTNG_CONSUMER_UNKNOWN:
-               assert(0);
+               abort();
                break;
        }
 }
@@ -282,7 +281,7 @@ static void live_timer(struct lttng_consumer_local_data *ctx,
                                        consumer_flush_ust_index;
 
        channel = si->si_value.sival_ptr;
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        if (channel->switch_timer_error) {
                goto error;
@@ -375,8 +374,8 @@ int consumer_channel_timer_start(timer_t *timer_id,
        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. */
@@ -438,8 +437,8 @@ void consumer_timer_switch_start(struct lttng_consumer_channel *channel,
 {
        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);
@@ -454,7 +453,7 @@ void consumer_timer_switch_stop(struct lttng_consumer_channel *channel)
 {
        int ret;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        ret = consumer_channel_timer_stop(&channel->switch_timer,
                        LTTNG_CONSUMER_SIG_SWITCH);
@@ -473,8 +472,8 @@ void consumer_timer_live_start(struct lttng_consumer_channel *channel,
 {
        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);
@@ -489,7 +488,7 @@ void consumer_timer_live_stop(struct lttng_consumer_channel *channel)
 {
        int ret;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        ret = consumer_channel_timer_stop(&channel->live_timer,
                        LTTNG_CONSUMER_SIG_LIVE);
@@ -511,9 +510,9 @@ int consumer_timer_monitor_start(struct lttng_consumer_channel *channel,
 {
        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);
@@ -528,8 +527,8 @@ int consumer_timer_monitor_stop(struct lttng_consumer_channel *channel)
 {
        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);
@@ -655,7 +654,7 @@ void monitor_timer(struct lttng_consumer_channel *channel)
        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;
@@ -690,7 +689,7 @@ void monitor_timer(struct lttng_consumer_channel *channel)
         * 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));
@@ -787,7 +786,7 @@ void *consumer_timer_thread(void *data)
                        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);
index a903ff9d2a643cda5c090f23ea84829416a55292..e3a873a0f3c8f44b4a0f687cce2d099407b532b9 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "common/index/ctf-index.h"
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <poll.h>
 #include <pthread.h>
 #include <stdlib.h>
@@ -105,7 +104,7 @@ static void notify_thread_lttng_pipe(struct lttng_pipe *pipe)
 {
        struct lttng_consumer_stream *null_stream = NULL;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        (void) lttng_pipe_write(pipe, &null_stream, sizeof(null_stream));
 }
@@ -173,7 +172,7 @@ static void clean_channel_stream_list(struct lttng_consumer_channel *channel)
 {
        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,
@@ -201,7 +200,7 @@ static struct lttng_consumer_stream *find_stream(uint64_t key,
        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) {
@@ -394,7 +393,7 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
                break;
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                goto end;
        }
 
@@ -407,12 +406,12 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
                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();
        }
 
@@ -491,7 +490,7 @@ void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd)
 {
        uint64_t netidx;
 
-       assert(relayd);
+       LTTNG_ASSERT(relayd);
 
        DBG("Cleaning up relayd object ID %"PRIu64, relayd->net_seq_idx);
 
@@ -525,7 +524,7 @@ void lttng_consumer_cleanup_relayd(struct consumer_relayd_sock_pair *relayd)
  */
 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);
@@ -576,8 +575,8 @@ void consumer_add_data_stream(struct lttng_consumer_stream *stream)
 {
        struct lttng_ht *ht = data_ht;
 
-       assert(stream);
-       assert(ht);
+       LTTNG_ASSERT(stream);
+       LTTNG_ASSERT(ht);
 
        DBG3("Adding consumer stream %" PRIu64, stream->key);
 
@@ -637,7 +636,7 @@ static int add_relayd(struct consumer_relayd_sock_pair *relayd)
        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);
@@ -721,9 +720,9 @@ int consumer_send_relayd_stream(struct lttng_consumer_stream *stream,
        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();
@@ -770,7 +769,7 @@ int consumer_send_relayd_streams_sent(uint64_t net_seq_idx)
        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();
@@ -830,8 +829,8 @@ static int write_relayd_stream_header(struct lttng_consumer_stream *stream,
        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));
@@ -928,8 +927,8 @@ int consumer_metadata_stream_dump(struct lttng_consumer_stream *stream)
 
        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:
@@ -984,7 +983,7 @@ int lttng_consumer_channel_set_trace_chunk(
                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);
@@ -1056,7 +1055,7 @@ struct lttng_consumer_channel *consumer_allocate_channel(uint64_t key,
                channel->output = CONSUMER_CHANNEL_MMAP;
                break;
        default:
-               assert(0);
+               abort();
                free(channel);
                channel = NULL;
                goto end;
@@ -1168,10 +1167,10 @@ static int update_poll_array(struct lttng_consumer_local_data *ctx,
        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;
@@ -1421,7 +1420,7 @@ struct lttng_consumer_local_data *lttng_consumer_create(
        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;
 
@@ -1635,7 +1634,7 @@ ssize_t lttng_consumer_on_read_subbuffer_mmap(
 
        /* 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. */
@@ -1811,7 +1810,7 @@ ssize_t lttng_consumer_on_read_subbuffer_splice(
                return -ENOSYS;
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
        }
 
        /* RCU lock for the relayd pointer */
@@ -2014,7 +2013,7 @@ int lttng_consumer_sample_snapshot_positions(struct lttng_consumer_stream *strea
                return lttng_ustconsumer_sample_snapshot_positions(stream);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -2033,7 +2032,7 @@ int lttng_consumer_take_snapshot(struct lttng_consumer_stream *stream)
                return lttng_ustconsumer_take_snapshot(stream);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -2054,7 +2053,7 @@ int lttng_consumer_get_produced_snapshot(struct lttng_consumer_stream *stream,
                return lttng_ustconsumer_get_produced_snapshot(stream, pos);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -2075,7 +2074,7 @@ int lttng_consumer_get_consumed_snapshot(struct lttng_consumer_stream *stream,
                return lttng_ustconsumer_get_consumed_snapshot(stream, pos);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -2091,7 +2090,7 @@ int lttng_consumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                return lttng_ustconsumer_recv_cmd(ctx, sock, consumer_sockpoll);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -2119,7 +2118,7 @@ void lttng_consumer_close_all_metadata(void)
                break;
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
        }
 }
 
@@ -2132,12 +2131,12 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream,
        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);
 
@@ -2204,8 +2203,8 @@ void consumer_add_metadata_stream(struct lttng_consumer_stream *stream)
        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);
 
@@ -2227,7 +2226,7 @@ void consumer_add_metadata_stream(struct lttng_consumer_stream *stream)
         */
        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
@@ -2296,7 +2295,7 @@ static void validate_endpoint_status_metadata_stream(
 
        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) {
@@ -2448,7 +2447,7 @@ restart:
                                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);
@@ -2456,7 +2455,7 @@ restart:
                        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();
@@ -2873,7 +2872,7 @@ void consumer_close_channel_streams(struct lttng_consumer_channel *channel)
                        break;
                default:
                        ERR("Unknown consumer_data type");
-                       assert(0);
+                       abort();
                }
        next:
                pthread_mutex_unlock(&stream->lock);
@@ -2894,7 +2893,7 @@ static void destroy_channel_ht(struct lttng_ht *ht)
        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();
 
@@ -3032,7 +3031,7 @@ restart:
                                                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:
@@ -3045,7 +3044,7 @@ restart:
                                                        break;
                                                default:
                                                        ERR("Unknown consumer_data type");
-                                                       assert(0);
+                                                       abort();
                                                }
 
                                                /*
@@ -3093,7 +3092,7 @@ restart:
                                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);
@@ -3104,7 +3103,7 @@ restart:
 
                                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
@@ -3152,8 +3151,8 @@ static int set_metadata_socket(struct lttng_consumer_local_data *ctx,
 {
        int ret;
 
-       assert(ctx);
-       assert(sockpoll);
+       LTTNG_ASSERT(ctx);
+       LTTNG_ASSERT(sockpoll);
 
        ret = lttng_consumer_poll_socket(sockpoll);
        if (ret) {
@@ -3497,7 +3496,7 @@ int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream)
                return lttng_ustconsumer_on_recv_stream(stream);
        default:
                ERR("Unknown consumer_data type");
-               assert(0);
+               abort();
                return -ENOSYS;
        }
 }
@@ -3571,15 +3570,15 @@ error:
        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) {
@@ -3599,7 +3598,7 @@ error:
                /*
                 * 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. */
@@ -3801,7 +3800,7 @@ int consumer_data_pending(uint64_t id)
                break;
        default:
                ERR("Unknown consumer data type");
-               assert(0);
+               abort();
        }
 
        /* Ease our life a bit */
@@ -3928,7 +3927,7 @@ int consumer_send_status_channel(int sock,
 {
        struct lttcomm_consumer_status_channel msg;
 
-       assert(sock >= 0);
+       LTTNG_ASSERT(sock >= 0);
 
        memset(&msg, 0, sizeof(msg));
        if (!channel) {
@@ -4025,7 +4024,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *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) {
@@ -4125,7 +4124,7 @@ int lttng_consumer_rotate_channel(struct lttng_consumer_channel *channel,
                                                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. "
@@ -4762,7 +4761,7 @@ enum lttcomm_return_code lttng_consumer_create_trace_chunk(
        }
 
        /* 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));
index 0aeaabaeb3a4249cc7c9e25e54f1906fb97dffd0..8b4621c7c03970b832b20385c5b641e320baee5a 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdbool.h>
 #include "credentials.h"
 
@@ -25,8 +24,8 @@ LTTNG_HIDDEN
 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) {
@@ -45,8 +44,8 @@ LTTNG_HIDDEN
 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) {
@@ -65,8 +64,8 @@ LTTNG_HIDDEN
 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);
index 71cf9af189c97a8ef6d30ffabce1f9ba0946928b..be27cc4958d51a2f2b42320044e371a0e664b492 100644 (file)
@@ -9,7 +9,6 @@
 #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);
@@ -52,7 +51,7 @@ static inline
 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);
 }
 
index 4e87c58ac1b43778cee695bbe2f78596b99d3f8d..4a08aa80e53eb85b0e495c078b104a5cfd36b0f2 100644 (file)
@@ -8,7 +8,6 @@
 #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
@@ -20,9 +19,9 @@ size_t round_to_power_of_2(size_t val)
        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;
 }
@@ -30,7 +29,7 @@ size_t round_to_power_of_2(size_t val)
 LTTNG_HIDDEN
 void lttng_dynamic_buffer_init(struct lttng_dynamic_buffer *buffer)
 {
-       assert(buffer);
+       LTTNG_ASSERT(buffer);
        memset(buffer, 0, sizeof(*buffer));
 }
 
@@ -50,7 +49,7 @@ int lttng_dynamic_buffer_append(struct lttng_dynamic_buffer *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 +
index 2eb1c971715902767e6550c2971d7026c346c6b5..e86940461b710d455dd64b0b75d67c2796a69cdd 100644 (file)
@@ -264,7 +264,7 @@ int lttng_error_query_result_counter_serialize(
 {
        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,
@@ -337,8 +337,8 @@ int lttng_error_query_result_init(
 {
        int ret;
 
-       assert(name);
-       assert(description);
+       LTTNG_ASSERT(name);
+       LTTNG_ASSERT(description);
 
        result->type = result_type;
 
@@ -982,7 +982,7 @@ lttng_error_query_results_get_result(
 
        *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;
@@ -1070,11 +1070,11 @@ enum lttng_error_code lttng_error_query_result_counter_mi_serialize(
        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(
@@ -1118,17 +1118,17 @@ enum lttng_error_code lttng_error_query_result_mi_serialize(
        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(
@@ -1191,8 +1191,8 @@ enum lttng_error_code lttng_error_query_results_mi_serialize(
        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(
@@ -1202,14 +1202,14 @@ enum lttng_error_code lttng_error_query_results_mi_serialize(
        }
 
        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);
index 4d6b26b229c0a8773fe9ebb427b880c5986afc84..1e3bd2d9b5137b5ea2f82391b1d5b79b70001694 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <pthread.h>
 #include <stdlib.h>
@@ -74,7 +73,7 @@ void logger_set_thread_name(const char *name, bool set_pthread_name)
 {
        int ret;
 
-       assert(name);
+       LTTNG_ASSERT(name);
        URCU_TLS(logger_thread_name) = name;
 
        if (set_pthread_name) {
index b43ec661b76a5ee742495c438b0232007768491f..daef71fdbc90646be59ebc781131a59688ad6c0c 100644 (file)
@@ -221,7 +221,7 @@ static inline void __lttng_print_check_abort(enum lttng_error_level type)
                        DBG3(fmt, ## args);     \
                        break;                  \
                default:                        \
-                       assert(0);              \
+                       abort();                \
                }                               \
        } while(0);
 
index 15e4f11ee3d6f53b2e4389fc834d619c7c5453c1..6b59949e39f00c45d867cad761715a85dffef6c1 100644 (file)
@@ -14,7 +14,6 @@
 #include <common/macros.h>
 #include <common/error.h>
 #include <stdbool.h>
-#include <assert.h>
 
 LTTNG_HIDDEN
 void lttng_evaluation_init(struct lttng_evaluation *evaluation,
@@ -118,8 +117,8 @@ ssize_t lttng_evaluation_create_from_payload(
                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,
@@ -155,6 +154,6 @@ void lttng_evaluation_destroy(struct lttng_evaluation *evaluation)
                return;
        }
 
-       assert(evaluation->destroy);
+       LTTNG_ASSERT(evaluation->destroy);
        evaluation->destroy(evaluation);
 }
index c41987e1ddb3247cc7da6cc945c925915314d8ad..01895c300ff09cf4a91661ae65aec05edfb2e5f2 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stddef.h>
 
 #include <common/bytecode/bytecode.h>
@@ -66,7 +65,7 @@ struct lttng_event_expr_field *create_field_event_expr(
                goto error;
        }
 
-       assert(name);
+       LTTNG_ASSERT(name);
        expr->name = strdup(name);
        if (!expr->name) {
                goto error;
@@ -665,12 +664,12 @@ enum lttng_error_code lttng_event_expr_event_payload_field_mi_serialize(
        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(
@@ -710,12 +709,12 @@ enum lttng_error_code lttng_event_expr_channel_context_field_mi_serialize(
        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,
@@ -756,18 +755,18 @@ enum lttng_error_code lttng_event_expr_app_specific_context_field_mi_serialize(
        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,
@@ -817,17 +816,17 @@ enum lttng_error_code lttng_event_expr_array_field_element_mi_serialize(
        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,
@@ -872,8 +871,8 @@ enum lttng_error_code lttng_event_expr_mi_serialize(
        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) {
index b57c7c53e206fc249de919575583e04234aef923..2babd3de16f70503e7f0d9bc17d7c86d0388dedf 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stddef.h>
 #include <stdbool.h>
 
@@ -190,7 +189,7 @@ struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(
                goto error;
        }
 
-       assert(val);
+       LTTNG_ASSERT(val);
        field_val->val = strndup(val, size);
        if (!field_val->val) {
                goto error;
@@ -209,7 +208,7 @@ LTTNG_HIDDEN
 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));
 }
@@ -298,8 +297,8 @@ int lttng_event_field_value_enum_append_label_with_size(
        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;
@@ -324,7 +323,7 @@ int lttng_event_field_value_enum_append_label(
                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));
 }
@@ -334,8 +333,8 @@ int lttng_event_field_value_array_append(
                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,
@@ -346,7 +345,7 @@ LTTNG_HIDDEN
 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,
index 2a84a1328ca577e668e15dfccbce3768e8d70315..144000e0b2503c97f0295da0c9f63c41eda4565e 100644 (file)
@@ -6,7 +6,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
 #include <common/hashtable/utils.h>
@@ -69,7 +68,7 @@ static void lttng_event_rule_release(struct urcu_ref *ref)
        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);
 }
 
@@ -215,7 +214,7 @@ ssize_t lttng_event_rule_create_from_payload(
                goto end;
        }
 
-       assert(create_from_payload);
+       LTTNG_ASSERT(create_from_payload);
 
        {
                struct lttng_payload_view child_view =
@@ -261,7 +260,7 @@ void lttng_event_rule_put(struct lttng_event_rule *event_rule)
                return;
        }
 
-       assert(event_rule->ref.refcount);
+       LTTNG_ASSERT(event_rule->ref.refcount);
        urcu_ref_put(&event_rule->ref, lttng_event_rule_release);
 }
 
@@ -270,14 +269,14 @@ enum lttng_error_code lttng_event_rule_generate_filter_bytecode(
                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);
 }
 
@@ -285,7 +284,7 @@ LTTNG_HIDDEN
 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);
 }
 
@@ -294,7 +293,7 @@ enum lttng_event_rule_generate_exclusions_status
 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);
 }
 
@@ -302,7 +301,7 @@ LTTNG_HIDDEN
 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);
 }
 
@@ -359,7 +358,7 @@ const char *lttng_event_rule_type_str(enum lttng_event_rule_type type)
 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);
 }
 
@@ -370,9 +369,9 @@ enum lttng_error_code lttng_event_rule_mi_serialize(
        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);
index 5f69f84c723b0636c48d844c4a920c2e7629afe3..e8d33dbee3c56f64fd4f2e3ec9e32458e4a70828 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -152,8 +151,8 @@ static bool lttng_event_rule_jul_logging_is_equal(
        }
 
        /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -195,8 +194,8 @@ static int generate_agent_filter(
        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) {
@@ -303,7 +302,7 @@ lttng_event_rule_jul_logging_generate_filter_bytecode(
        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);
@@ -357,7 +356,7 @@ static const char *lttng_event_rule_jul_logging_get_internal_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.filter;
@@ -369,7 +368,7 @@ lttng_event_rule_jul_logging_get_internal_filter_bytecode(
 {
        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;
@@ -490,22 +489,22 @@ static enum lttng_error_code lttng_event_rule_jul_logging_mi_serialize(
        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. */
@@ -698,7 +697,7 @@ skip_filter_expression:
                        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. */
index 0b78786308b1da9cf39fdca033c17e7742802ec3..2819f2d2b50107f57bcac3dc7525146addf3a43d 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -138,8 +137,8 @@ static bool lttng_event_rule_kernel_kprobe_is_equal(const struct lttng_event_rul
        }
 
        /* Long check */
-       assert(a->name);
-       assert(b->name);
+       LTTNG_ASSERT(a->name);
+       LTTNG_ASSERT(b->name);
        if (strcmp(a->name, b->name)) {
                goto end;
        }
@@ -234,18 +233,18 @@ enum lttng_error_code lttng_event_rule_kernel_kprobe_mi_serialize(
        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(
index 5f944d1bebce5572711ad2229fbd7dee21368710..f9e2792a65081e234fea8638ca64a29fae844065 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -122,8 +121,8 @@ static bool lttng_event_rule_kernel_syscall_is_equal(const struct lttng_event_ru
                goto end;
        }
 
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -153,7 +152,7 @@ static enum lttng_error_code lttng_event_rule_kernel_syscall_generate_filter_byt
        const char *filter;
        struct lttng_bytecode *bytecode = NULL;
 
-       assert(rule);
+       LTTNG_ASSERT(rule);
 
        syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
 
@@ -202,7 +201,7 @@ static const char *lttng_event_rule_kernel_syscall_get_internal_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.filter;
@@ -214,7 +213,7 @@ lttng_event_rule_kernel_syscall_get_internal_filter_bytecode(
 {
        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;
@@ -260,17 +259,17 @@ static enum lttng_error_code lttng_event_rule_kernel_syscall_mi_serialize(
        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);
index 0c62308f5045fc95f5c409461603c4a09d471721..98882bda4887eaa15de317e6118a6b297a5e210f 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -133,8 +132,8 @@ static bool lttng_event_rule_kernel_tracepoint_is_equal(
        }
 
        /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -165,7 +164,7 @@ lttng_event_rule_kernel_tracepoint_generate_filter_bytecode(
        const char *filter;
        struct lttng_bytecode *bytecode = NULL;
 
-       assert(rule);
+       LTTNG_ASSERT(rule);
 
        tracepoint = container_of(
                        rule, struct lttng_event_rule_kernel_tracepoint, parent);
@@ -221,7 +220,7 @@ static const char *lttng_event_rule_kernel_tracepoint_get_internal_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.filter;
@@ -233,7 +232,7 @@ lttng_event_rule_kernel_tracepoint_get_internal_filter_bytecode(
 {
        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;
@@ -276,17 +275,17 @@ static enum lttng_error_code lttng_event_rule_kernel_tracepoint_mi_serialize(
        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. */
index 2af1a028c80d9ae1e7f778105435d528177da403..99c59648173fc6f2064568c845a6dc3acb959d19 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -127,14 +126,14 @@ static bool lttng_event_rule_kernel_uprobe_is_equal(const struct lttng_event_rul
        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:
@@ -224,18 +223,18 @@ static enum lttng_error_code lttng_event_rule_kernel_uprobe_mi_serialize(
        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(
@@ -377,7 +376,7 @@ ssize_t lttng_event_rule_kernel_uprobe_create_from_payload(
                }
        }
 
-       assert(ret == uprobe_comm->location_len);
+       LTTNG_ASSERT(ret == uprobe_comm->location_len);
 
        /* Skip after the location. */
        offset += uprobe_comm->location_len;
@@ -438,7 +437,7 @@ lttng_event_rule_kernel_uprobe_get_location_mutable(
 {
        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;
index 755ae26c626c4afc045b603d2f37bf357ee68389..03c4df8a385ece2ebd87b845a33c618f4f7acca0 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -152,8 +151,8 @@ static bool lttng_event_rule_log4j_logging_is_equal(
        }
 
        /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -195,8 +194,8 @@ static int generate_agent_filter(
        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) {
@@ -303,7 +302,7 @@ lttng_event_rule_log4j_logging_generate_filter_bytecode(
        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);
@@ -357,7 +356,7 @@ static const char *lttng_event_rule_log4j_logging_get_internal_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.filter;
@@ -369,7 +368,7 @@ lttng_event_rule_log4j_logging_get_internal_filter_bytecode(
 {
        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;
@@ -489,22 +488,22 @@ static enum lttng_error_code lttng_event_rule_log4j_logging_mi_serialize(
        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. */
@@ -697,7 +696,7 @@ skip_filter_expression:
                        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. */
index 4b5cebaf02f6e4a1cceac1022db64c9f6847c1d8..fc072b45f0eb8487e80e6c39fdfc2cb3bc7036f8 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -152,8 +151,8 @@ static bool lttng_event_rule_python_logging_is_equal(
        }
 
        /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -195,8 +194,8 @@ static int generate_agent_filter(
        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) {
@@ -303,7 +302,7 @@ lttng_event_rule_python_logging_generate_filter_bytecode(
        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);
@@ -357,7 +356,7 @@ static const char *lttng_event_rule_python_logging_get_internal_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.filter;
@@ -369,7 +368,7 @@ lttng_event_rule_python_logging_get_internal_filter_bytecode(
 {
        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;
@@ -489,22 +488,22 @@ static enum lttng_error_code lttng_event_rule_python_logging_mi_serialize(
        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. */
@@ -697,7 +696,7 @@ skip_filter_expression:
                        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. */
index 503e7163fe3cd847bd2224cb1915ffd18e03168e..8fa2eeb49d06c63e3b4674df396339555dce4353 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -95,7 +94,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
                        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;
 
@@ -112,7 +111,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
 
                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);
@@ -160,7 +159,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
 
                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. */
@@ -182,7 +181,7 @@ static int lttng_event_rule_user_tracepoint_serialize(
                exclusions_appended_len += len;
        }
 
-       assert(exclusions_len == exclusions_appended_len);
+       LTTNG_ASSERT(exclusions_len == exclusions_appended_len);
 
 end:
        return ret;
@@ -202,9 +201,9 @@ static bool lttng_event_rule_user_tracepoint_is_equal(
        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) {
@@ -216,8 +215,8 @@ static bool lttng_event_rule_user_tracepoint_is_equal(
        }
 
        /* Long check. */
-       assert(a->pattern);
-       assert(b->pattern);
+       LTTNG_ASSERT(a->pattern);
+       LTTNG_ASSERT(b->pattern);
        if (strcmp(a->pattern, b->pattern)) {
                goto end;
        }
@@ -241,10 +240,10 @@ static bool lttng_event_rule_user_tracepoint_is_equal(
 
                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;
                }
@@ -267,7 +266,7 @@ lttng_event_rule_user_tracepoint_generate_filter_bytecode(
        const char *filter;
        struct lttng_bytecode *bytecode = NULL;
 
-       assert(rule);
+       LTTNG_ASSERT(rule);
 
        tracepoint = container_of(
                        rule, struct lttng_event_rule_user_tracepoint, parent);
@@ -323,7 +322,7 @@ static const char *lttng_event_rule_user_tracepoint_get_internal_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.filter;
@@ -335,7 +334,7 @@ lttng_event_rule_user_tracepoint_get_internal_filter_bytecode(
 {
        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;
@@ -351,11 +350,11 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
        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;
@@ -379,7 +378,7 @@ lttng_event_rule_user_tracepoint_generate_exclusions(
                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);
@@ -426,14 +425,14 @@ static unsigned long lttng_event_rule_user_tracepoint_hash(
 
        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);
        }
 
@@ -451,27 +450,27 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
        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(
@@ -521,7 +520,7 @@ static enum lttng_error_code lttng_event_rule_user_tracepoint_mi_serialize(
 
                        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,
@@ -703,7 +702,7 @@ skip_filter_expression:
                        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. */
@@ -912,7 +911,7 @@ static bool log_level_rule_valid(const struct lttng_log_level_rule *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. */
index ddf70afadea98fa9a1aa4414bcee74a73e4c7c1a..510e1181bd1193435a06b158e737d54c9051d53f 100644 (file)
@@ -21,7 +21,7 @@ static void fd_handle_release(struct urcu_ref *ref)
        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",
@@ -78,7 +78,7 @@ void fd_handle_put(struct fd_handle *handle)
 LTTNG_HIDDEN
 int fd_handle_get_fd(struct fd_handle *handle)
 {
-       assert(handle);
+       LTTNG_ASSERT(handle);
        return handle->fd;
 }
 
index 772bf04bc5994efa5fc351a2ed933514506de36c..08ecb3cce2cda96ec84d305beb1771222b4840a5 100644 (file)
@@ -232,7 +232,7 @@ static int fs_handle_tracked_suspend(struct fs_handle_tracked *handle)
        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;
@@ -292,8 +292,8 @@ static int fs_handle_tracked_restore(struct fs_handle_tracked *handle)
        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) {
@@ -480,7 +480,7 @@ int fd_tracker_destroy(struct fd_tracker *tracker)
 
        if (tracker->unsuspendable_fds) {
                ret = cds_lfht_destroy(tracker->unsuspendable_fds, NULL);
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
        }
 
        lttng_inode_registry_destroy(tracker->inode_registry);
@@ -840,7 +840,7 @@ static int fs_handle_tracked_get_fd(struct fs_handle *_handle)
         */
        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) {
index f105f5bd334df020e3d4800257ca3c0690f072eb..182c84a6bb6a978ca03980e2a9c19cd9f9f40026 100644 (file)
@@ -114,7 +114,7 @@ static int lttng_unlinked_file_pool_add_inode(
        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) {
@@ -152,7 +152,7 @@ static int lttng_unlinked_file_pool_add_inode(
        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);
@@ -217,8 +217,8 @@ static void lttng_inode_destroy(struct lttng_inode *inode)
        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);
@@ -279,7 +279,7 @@ LTTNG_HIDDEN void lttng_unlinked_file_pool_destroy(
                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);
@@ -298,7 +298,7 @@ lttng_inode_get_location_directory_handle(
                const bool reference_acquired = lttng_directory_handle_get(
                                inode->location.directory_handle);
 
-               assert(reference_acquired);
+               LTTNG_ASSERT(reference_acquired);
        }
        return inode->location.directory_handle;
 }
@@ -373,7 +373,7 @@ LTTNG_HIDDEN int lttng_inode_rename(
        }
 
        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;
@@ -430,7 +430,7 @@ static struct lttng_inode *lttng_inode_create(const struct inode_id *id,
        }
 
        reference_acquired = lttng_directory_handle_get(directory_handle);
-       assert(reference_acquired);
+       LTTNG_ASSERT(reference_acquired);
 
        inode = zmalloc(sizeof(*inode));
        if (!inode) {
@@ -487,7 +487,7 @@ LTTNG_HIDDEN void lttng_inode_registry_destroy(
        if (registry->inodes) {
                int ret = cds_lfht_destroy(registry->inodes, NULL);
 
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
        }
        free(registry);
 }
@@ -535,7 +535,7 @@ LTTNG_HIDDEN struct lttng_inode *lttng_inode_registry_get_inode(
        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:
index aec0a5c676148c2fcda52721aaac389a1af66085..bd8f2de7f148cbd128789770c2253dfdb004df4d 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/compat/errno.h>
index 74541f75610c4460e57f1c4bc598e7b64fd370e2..d2c726007d1043d59c0ec7fefb1e0e244894a532 100644 (file)
@@ -15,7 +15,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 #include "common/bytecode/bytecode.h"
 #include "filter-ast.h"
@@ -317,8 +316,8 @@ int filter_parser_ctx_create_from_filter_expression(
        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
index fb5d815d9958f3bdbf816db74cb52cacffb5f59d..56aa26d27009e25bcb6fff2bccdbcea8ea329215 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 #include "filter-ast.h"
 #include "filter-parser.h"
@@ -63,7 +62,7 @@ struct ir_op *make_op_root(struct ir_op *child, enum ir_side side)
 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)) {
@@ -171,7 +170,7 @@ struct filter_node *load_expression_get_forward_chain(struct filter_node *node)
        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) {
index ae61ae96ba170666dd83107d6e3c4d2c0ac1f6ad..19e5943113c43708a5ef12af583f770da1b2a34e 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/compat/errno.h>
index 9c259f7766aeba5a22b0907849106dbe27dda4ed..35a55edae044e051de3e2027b3ecc87e03938a28 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 #include "filter-ast.h"
 #include "filter-parser.h"
index d6a9132d3692f68a445914d8792b1e805fbd4d6e..679561632606881b23c05d03d9c296f0d1176eb0 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/compat/errno.h>
@@ -42,7 +41,7 @@ int normalize_glob_patterns(struct ir_op *node)
                                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);
                        }
index db64cbdf58201784fdbc6e494df00314fb739f40..df8e9af391a5cb35abfeb767e7ad7a0d706a7be6 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/compat/errno.h>
index b62fbc438cf38d2e56437d04b1bc5136cfdcbaf3..5b0613b190df11a9dd1c256b10fc2a527a2e3eb4 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 
 #include <common/macros.h>
@@ -67,7 +66,7 @@ int validate_string(struct ir_op *node)
                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 (;;) {
index a5aba193b6383e2df6e8233b93b32874b59e2cdb..14d699d69401fd37420e7f1220cfd0eac19e3304 100644 (file)
@@ -13,7 +13,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <inttypes.h>
 #include "filter-ast.h"
 #include "filter-parser.h"
index af16676cca349e21ba63868f2d2a026972593a13..404734f544895a8b9463fe2673136ad75d38e6de 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 #include <urcu.h>
 #include <urcu/compiler.h>
@@ -125,7 +124,7 @@ struct lttng_ht *lttng_ht_new(unsigned long size, int type)
         * 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:
@@ -168,7 +167,7 @@ void lttng_ht_destroy(struct lttng_ht *ht)
        int ret;
 
        ret = cds_lfht_destroy(ht->ht, NULL);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
        free(ht);
 }
 
@@ -178,7 +177,7 @@ void lttng_ht_destroy(struct lttng_ht *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);
@@ -191,7 +190,7 @@ LTTNG_HIDDEN
 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);
@@ -204,7 +203,7 @@ LTTNG_HIDDEN
 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);
@@ -217,7 +216,7 @@ LTTNG_HIDDEN
 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;
@@ -230,7 +229,7 @@ void lttng_ht_node_init_two_u64(struct lttng_ht_node_two_u64 *node,
 LTTNG_HIDDEN
 void lttng_ht_node_free_str(struct lttng_ht_node_str *node)
 {
-       assert(node);
+       LTTNG_ASSERT(node);
        free(node);
 }
 
@@ -240,7 +239,7 @@ void lttng_ht_node_free_str(struct lttng_ht_node_str *node)
 LTTNG_HIDDEN
 void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node)
 {
-       assert(node);
+       LTTNG_ASSERT(node);
        free(node);
 }
 
@@ -250,7 +249,7 @@ void lttng_ht_node_free_ulong(struct lttng_ht_node_ulong *node)
 LTTNG_HIDDEN
 void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node)
 {
-       assert(node);
+       LTTNG_ASSERT(node);
        free(node);
 }
 
@@ -260,7 +259,7 @@ void lttng_ht_node_free_u64(struct lttng_ht_node_u64 *node)
 LTTNG_HIDDEN
 void lttng_ht_node_free_two_u64(struct lttng_ht_node_two_u64 *node)
 {
-       assert(node);
+       LTTNG_ASSERT(node);
        free(node);
 }
 
@@ -271,8 +270,8 @@ LTTNG_HIDDEN
 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);
@@ -286,16 +285,16 @@ void lttng_ht_add_unique_str(struct lttng_ht *ht,
                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);
 }
 
 /*
@@ -305,9 +304,9 @@ LTTNG_HIDDEN
 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();
@@ -322,9 +321,9 @@ void lttng_ht_add_str(struct lttng_ht *ht,
 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();
@@ -339,9 +338,9 @@ void lttng_ht_add_ulong(struct lttng_ht *ht, struct lttng_ht_node_ulong *node)
 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();
@@ -358,9 +357,9 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
                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();
@@ -368,7 +367,7 @@ void lttng_ht_add_unique_ulong(struct lttng_ht *ht,
                        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);
 }
 
 /*
@@ -379,9 +378,9 @@ void lttng_ht_add_unique_u64(struct lttng_ht *ht,
                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();
@@ -389,7 +388,7 @@ void lttng_ht_add_unique_u64(struct lttng_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);
 }
 
 /*
@@ -400,9 +399,9 @@ void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
                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();
@@ -410,7 +409,7 @@ void lttng_ht_add_unique_two_u64(struct lttng_ht *ht,
                        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);
 }
 
 /*
@@ -421,9 +420,9 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
                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();
@@ -436,7 +435,7 @@ struct lttng_ht_node_ulong *lttng_ht_add_replace_ulong(struct lttng_ht *ht,
        } else {
                return caa_container_of(node_ptr, struct lttng_ht_node_ulong, node);
        }
-       assert(node_ptr == &node->node);
+       LTTNG_ASSERT(node_ptr == &node->node);
 }
 
 /*
@@ -447,9 +446,9 @@ struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
                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();
@@ -462,7 +461,7 @@ struct lttng_ht_node_u64 *lttng_ht_add_replace_u64(struct lttng_ht *ht,
        } else {
                return caa_container_of(node_ptr, struct lttng_ht_node_u64, node);
        }
-       assert(node_ptr == &node->node);
+       LTTNG_ASSERT(node_ptr == &node->node);
 }
 
 /*
@@ -473,9 +472,9 @@ int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter)
 {
        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();
@@ -490,9 +489,9 @@ int lttng_ht_del(struct lttng_ht *ht, struct lttng_ht_iter *iter)
 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);
 }
@@ -503,9 +502,9 @@ void lttng_ht_get_first(struct lttng_ht *ht, struct lttng_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);
 }
@@ -519,8 +518,8 @@ unsigned long lttng_ht_get_count(struct lttng_ht *ht)
        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();
@@ -539,7 +538,7 @@ struct lttng_ht_node_str *lttng_ht_iter_get_node_str(
 {
        struct cds_lfht_node *node;
 
-       assert(iter);
+       LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
                return NULL;
@@ -556,7 +555,7 @@ struct lttng_ht_node_ulong *lttng_ht_iter_get_node_ulong(
 {
        struct cds_lfht_node *node;
 
-       assert(iter);
+       LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
                return NULL;
@@ -573,7 +572,7 @@ struct lttng_ht_node_u64 *lttng_ht_iter_get_node_u64(
 {
        struct cds_lfht_node *node;
 
-       assert(iter);
+       LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
                return NULL;
@@ -590,7 +589,7 @@ struct lttng_ht_node_two_u64 *lttng_ht_iter_get_node_two_u64(
 {
        struct cds_lfht_node *node;
 
-       assert(iter);
+       LTTNG_ASSERT(iter);
        node = cds_lfht_iter_get_node(&iter->iter);
        if (!node) {
                return NULL;
index 2c41e6c65f4060f31439640cec8c8c6d62b724c1..fced4570b2cc2f982eb47c2f6cb719629b357533 100644 (file)
@@ -40,7 +40,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdint.h>     /* defines uint32_t etc */
 #include <stdio.h>      /* defines printf for tests */
 #include <string.h>
index 62e211419fe463c28ae5c64cb842f1038295bfc7..8f147c678a95753d26f22584a5831af2c60ba2cb 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -156,7 +155,7 @@ static int validate_state(struct health_app *ha, struct health_state *state)
        unsigned long current, last;
        struct timespec current_time;
 
-       assert(state);
+       LTTNG_ASSERT(state);
 
        last = state->last;
        current = uatomic_read(&state->current);
@@ -224,7 +223,7 @@ int health_check_state(struct health_app *ha, int type)
        int retval = 1;
        struct health_state *state;
 
-       assert(type < ha->nr_types);
+       LTTNG_ASSERT(type < ha->nr_types);
 
        state_lock(ha);
 
@@ -260,7 +259,7 @@ end:
  */
 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);
index 885015d77a3183ea1478b96a00bef87a2895faba..8c73218a950d5275ac70d163ace4893cb53439ea 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 
 #include <urcu.h>
@@ -91,7 +90,7 @@ enum lttng_index_allocator_status lttng_index_allocator_release(
        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) {
index eeaf2fd15f82155a4a89f0cefb124447d8bc1862..f6b8e0716d9c6cc8308aadaab59c1a9e3df46bb3 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
@@ -44,7 +43,7 @@ static enum lttng_trace_chunk_status _lttng_index_file_create_from_trace_chunk(
        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) {
@@ -200,8 +199,8 @@ int lttng_index_file_write(const struct lttng_index_file *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;
@@ -229,7 +228,7 @@ int lttng_index_file_read(const struct lttng_index_file *index_file,
        ssize_t ret;
        const size_t len = index_file->element_len;
 
-       assert(element);
+       LTTNG_ASSERT(element);
 
        if (!index_file->file) {
                goto error;
index 5334d13585842b0d63ab7f61d2b8cfa33e2b3b5e..236c2c98f9d80f98b2e43b7c74ba9175893a64e3 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <poll.h>
 #include <pthread.h>
 #include <stdlib.h>
@@ -74,7 +73,7 @@ int lttng_kconsumer_take_snapshot(struct lttng_consumer_stream *stream)
 int lttng_kconsumer_sample_snapshot_positions(
                struct lttng_consumer_stream *stream)
 {
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        return kernctl_snapshot_sample_positions(stream->wait_fd);
 }
@@ -174,7 +173,7 @@ static int lttng_kconsumer_snapshot_channel(
                 */
                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
@@ -184,7 +183,7 @@ static int lttng_kconsumer_snapshot_channel(
                        ret = -1;
                        goto end_unlock;
                }
-               assert(!stream->trace_chunk);
+               LTTNG_ASSERT(!stream->trace_chunk);
                stream->trace_chunk = channel->trace_chunk;
 
                /*
@@ -366,7 +365,7 @@ static int lttng_kconsumer_snapshot_metadata(
        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);
@@ -374,11 +373,11 @@ static int lttng_kconsumer_snapshot_metadata(
        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) {
@@ -470,7 +469,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        health_code_update();
 
        /* Deprecated command */
-       assert(msg.cmd_type != LTTNG_CONSUMER_STOP);
+       LTTNG_ASSERT(msg.cmd_type != LTTNG_CONSUMER_STOP);
 
        health_code_update();
 
@@ -542,7 +541,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        new_channel->type = msg.u.channel.type;
                        break;
                default:
-                       assert(0);
+                       abort();
                        goto end_nosignal;
                };
 
@@ -1031,13 +1030,13 @@ error_streams_sent_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:
@@ -1432,7 +1431,7 @@ enum sync_metadata_status lttng_kconsumer_sync_metadata(
        int ret;
        enum sync_metadata_status status;
 
-       assert(metadata);
+       LTTNG_ASSERT(metadata);
 
        ret = kernctl_buffer_flush(metadata->wait_fd);
        if (ret < 0) {
@@ -1831,7 +1830,7 @@ int lttng_kconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        /*
         * Don't create anything if this is set for streaming or if there is
@@ -1878,7 +1877,7 @@ error_close_fd:
                int err;
 
                err = close(stream->out_fd);
-               assert(!err);
+               LTTNG_ASSERT(!err);
                stream->out_fd = -1;
        }
 error:
@@ -1897,7 +1896,7 @@ int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        if (stream->endpoint_status != CONSUMER_ENDPOINT_ACTIVE) {
                ret = 0;
@@ -1908,7 +1907,7 @@ int lttng_kconsumer_data_pending(struct lttng_consumer_stream *stream)
        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;
        }
index 5373c703943f7710576337bb9995e8cb4321f28b..34d3356e99967e68271aa00d460d63bf3103331c 100644 (file)
@@ -16,7 +16,6 @@
 #include <common/macros.h>
 #include <common/compat/errno.h>
 #include <stdarg.h>
-#include <assert.h>
 #include <common/time.h>
 
 #include "kernel-ctl.h"
@@ -25,7 +24,7 @@
 #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;                               \
        })
 
index 2beb53fabd94e4c361bf170b21611659b7d81dd9..7d5006af4cc7bd450cb6b4001c5374a83ee93383 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "lttng/lttng-error.h"
-#include <assert.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
 #include <common/hashtable/utils.h>
@@ -71,7 +70,7 @@ static
 void lttng_kernel_probe_location_address_destroy(
                struct lttng_kernel_probe_location *location)
 {
-       assert(location);
+       LTTNG_ASSERT(location);
        free(location);
 }
 
@@ -81,13 +80,13 @@ void lttng_kernel_probe_location_symbol_destroy(
 {
        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);
@@ -187,7 +186,7 @@ lttng_kernel_probe_location_address_get_address(
                        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) {
@@ -231,7 +230,7 @@ lttng_kernel_probe_location_symbol_get_offset(
                        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) {
@@ -264,7 +263,7 @@ int lttng_kernel_probe_location_symbol_serialize(
                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;
@@ -315,8 +314,8 @@ int lttng_kernel_probe_location_address_serialize(
        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;
@@ -383,7 +382,7 @@ int lttng_kernel_probe_location_symbol_create_from_payload(
        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;
@@ -430,7 +429,7 @@ ssize_t lttng_kernel_probe_location_address_create_from_payload(
        ssize_t ret = 0;
        size_t expected_size;
 
-       assert(location);
+       LTTNG_ASSERT(location);
 
        expected_size = sizeof(*location_address_comm);
 
@@ -466,8 +465,8 @@ ssize_t lttng_kernel_probe_location_create_from_payload(
                        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;
@@ -583,8 +582,8 @@ bool lttng_kernel_probe_location_symbol_is_equal(
        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;
        }
@@ -634,8 +633,8 @@ lttng_kernel_probe_location_symbol_copy(
        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);
 
@@ -672,8 +671,8 @@ lttng_kernel_probe_location_address_copy(
        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);
 
@@ -748,13 +747,13 @@ enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
        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(
@@ -796,17 +795,17 @@ enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
        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,
@@ -854,8 +853,8 @@ enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
        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(
index 5c0da4d1a471118de60d968f7dc2d0771398cffc..a88a31687403abe8f3704042309e61fbd0bd77aa 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/dynamic-buffer.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -230,7 +229,7 @@ struct lttng_log_level_rule *lttng_log_level_rule_copy(
 {
        struct lttng_log_level_rule *copy = NULL;
 
-       assert(source);
+       LTTNG_ASSERT(source);
 
        copy = zmalloc(sizeof(struct lttng_log_level_rule));
        if (!copy) {
@@ -249,7 +248,7 @@ void lttng_log_level_rule_to_loglevel(
                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:
@@ -274,7 +273,7 @@ unsigned long lttng_log_level_rule_hash(
        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);
 
@@ -292,7 +291,7 @@ unsigned long lttng_log_level_rule_hash(
                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);
 
@@ -313,8 +312,8 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(
        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:
@@ -331,7 +330,7 @@ enum lttng_error_code lttng_log_level_rule_mi_serialize(
                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(
index 53f5f96c752061448a6f5d1fc629166db2f345a3..2b16e5b68a42fe073b22904f8f645b465efd046a 100644 (file)
@@ -106,7 +106,7 @@ void *zmalloc(size_t len)
 
 #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
@@ -133,4 +133,15 @@ int lttng_strncpy(char *dst, const char *src, size_t dst_len)
        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 */
index 663d38a7d20fe6326bd694972017112507c9b516..e47994ca2063879937c58ef7278ae2a6fefbcad2 100644 (file)
@@ -16,7 +16,6 @@
 #include <lttng/channel.h>
 #include <lttng/snapshot-internal.h>
 
-#include <assert.h>
 
 #define MI_SCHEMA_MAJOR_VERSION 4
 #define MI_SCHEMA_MINOR_VERSION 1
@@ -723,7 +722,7 @@ const char *mi_lttng_domaintype_string(enum lttng_domain_type value)
                return config_domain_type_python;
        default:
                /* Should not have an unknown domain */
-               assert(0);
+               abort();
                return NULL;
        }
 }
@@ -740,7 +739,7 @@ const char *mi_lttng_buffertype_string(enum lttng_buffer_type value)
                return config_buffer_type_global;
        default:
                /* Should not have an unknow buffer type */
-               assert(0);
+               abort();
                return NULL;
        }
 }
@@ -759,7 +758,7 @@ const char *mi_lttng_rotation_state_string(enum lttng_rotation_state value)
                return mi_lttng_rotation_state_str_error;
        default:
                /* Should not have an unknow rotation state. */
-               assert(0);
+               abort();
                return NULL;
        }
 }
@@ -773,7 +772,7 @@ const char *mi_lttng_trace_archive_location_relay_protocol_type_string(
                return mi_lttng_rotation_location_relay_protocol_str_tcp;
        default:
                /* Should not have an unknown relay protocol. */
-               assert(0);
+               abort();
                return NULL;
        }
 }
@@ -1047,7 +1046,7 @@ int mi_lttng_session(struct mi_writer *writer,
 {
        int ret;
 
-       assert(session);
+       LTTNG_ASSERT(session);
 
        /* Open sessions element */
        ret = mi_lttng_writer_open_element(writer,
@@ -1115,7 +1114,7 @@ int mi_lttng_domain(struct mi_writer *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);
@@ -1167,7 +1166,7 @@ int mi_lttng_channel(struct mi_writer *writer,
 {
        int ret = 0;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        /* Opening channel element */
        ret = mi_lttng_writer_open_element(writer, config_element_channel);
@@ -1216,7 +1215,7 @@ int mi_lttng_channel_attr(struct mi_writer *writer,
        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) {
index be09c1fcc66249e34f66d16ac3de7212de360f29..9c5bd6d18834465dbcf746cae11034e55dc2a50f 100644 (file)
@@ -13,7 +13,6 @@
 #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(
index ca7d1f043d21bdef1b9ad8dc716452ee49fe7858..dcb7ca8639fd67ddac916ea84816e24e0b2b2b5e 100644 (file)
@@ -9,7 +9,6 @@
 #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;                      \
        })
 
index 5567806d2df3647bcecf7396a5a33ae7dc55868e..1a02754bb097f4bab5d131fc69be6b1d942f7799 100644 (file)
@@ -21,7 +21,7 @@ void release_fd_handle_ref(void *ptr)
 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);
index 868c1f3de839dd71847604062ed063b0acb31b1d..e052e6fe09f951bcfd3f7c68090530cd1c39e02b 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -57,7 +56,7 @@ static int _pipe_read_close(struct lttng_pipe *pipe)
 {
        int ret, ret_val = 0;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        if (!lttng_pipe_is_read_open(pipe)) {
                goto end;
@@ -85,7 +84,7 @@ static int _pipe_write_close(struct lttng_pipe *pipe)
 {
        int ret, ret_val = 0;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        if (!lttng_pipe_is_write_open(pipe)) {
                goto end;
@@ -271,7 +270,7 @@ int lttng_pipe_read_close(struct lttng_pipe *pipe)
 {
        int ret;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        /* Handle read side first. */
        lock_read_side(pipe);
@@ -291,7 +290,7 @@ int lttng_pipe_write_close(struct lttng_pipe *pipe)
 {
        int ret;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        lock_write_side(pipe);
        ret = _pipe_write_close(pipe);
@@ -310,7 +309,7 @@ int lttng_pipe_close(struct lttng_pipe *pipe)
 {
        int ret, ret_val = 0;
 
-       assert(pipe);
+       LTTNG_ASSERT(pipe);
 
        ret = lttng_pipe_read_close(pipe);
        if (ret < 0) {
@@ -342,9 +341,9 @@ void lttng_pipe_destroy(struct lttng_pipe *pipe)
         * 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);
@@ -370,8 +369,8 @@ ssize_t lttng_pipe_read(struct lttng_pipe *pipe, void *buf, size_t count)
 {
        ssize_t ret;
 
-       assert(pipe);
-       assert(buf);
+       LTTNG_ASSERT(pipe);
+       LTTNG_ASSERT(buf);
 
        lock_read_side(pipe);
        if (!lttng_pipe_is_read_open(pipe)) {
@@ -397,8 +396,8 @@ ssize_t lttng_pipe_write(struct lttng_pipe *pipe, const void *buf,
 {
        ssize_t ret;
 
-       assert(pipe);
-       assert(buf);
+       LTTNG_ASSERT(pipe);
+       LTTNG_ASSERT(buf);
 
        lock_write_side(pipe);
        if (!lttng_pipe_is_write_open(pipe)) {
index 6019aa2dc3f6f0bb79c8f921bee0ee1219c60da9..be42b5326aeaa553c24ff09b6c62e52dde0f02b6 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <limits.h>
 #include <unistd.h>
 
@@ -28,7 +27,7 @@ ssize_t lttng_read(int fd, void *buf, size_t count)
        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.
@@ -48,7 +47,7 @@ ssize_t lttng_read(int fd, void *buf, size_t count)
                        }
                }
                i += ret;
-               assert(i <= count);
+               LTTNG_ASSERT(i <= count);
        } while (count - i > 0 && ret > 0);
        return i;
 
@@ -66,7 +65,7 @@ ssize_t lttng_write(int fd, const void *buf, size_t count)
        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.
@@ -86,7 +85,7 @@ ssize_t lttng_write(int fd, const void *buf, size_t count)
                        }
                }
                i += ret;
-               assert(i <= count);
+               LTTNG_ASSERT(i <= count);
        } while (count - i > 0 && ret > 0);
        return i;
 
index 22a1c44f800a4bb5302fe12d40c479a35e32e4c6..90312b5896f829c5d4c85be4fa7c1b4409d463d4 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -172,13 +171,13 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock,
                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;
@@ -323,8 +322,8 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock,
        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");
 
@@ -452,10 +451,10 @@ static int relayd_add_stream_2_11(struct lttcomm_relayd_sock *rsock,
                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)) {
@@ -501,11 +500,11 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
        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);
 
@@ -541,7 +540,7 @@ int relayd_add_stream(struct lttcomm_relayd_sock *rsock, const char *channel_nam
 
                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,
@@ -592,7 +591,7 @@ int relayd_streams_sent(struct lttcomm_relayd_sock *rsock)
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd sending streams sent.");
 
@@ -648,7 +647,7 @@ int relayd_version_check(struct lttcomm_relayd_sock *rsock)
        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);
@@ -716,7 +715,7 @@ int relayd_send_metadata(struct lttcomm_relayd_sock *rsock, size_t len)
        int ret;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd sending metadata of size %zu", len);
 
@@ -744,7 +743,7 @@ error:
 int relayd_connect(struct lttcomm_relayd_sock *rsock)
 {
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        if (!rsock->sock.ops) {
                /*
@@ -776,7 +775,7 @@ int relayd_close(struct lttcomm_relayd_sock *rsock)
        int ret;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        /* An invalid fd is fine, return success. */
        if (rsock->sock.fd < 0) {
@@ -810,8 +809,8 @@ int relayd_send_data_hdr(struct lttcomm_relayd_sock *rsock,
        int ret;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
-       assert(hdr);
+       LTTNG_ASSERT(rsock);
+       LTTNG_ASSERT(hdr);
 
        if (rsock->sock.fd < 0) {
                return -ECONNRESET;
@@ -851,7 +850,7 @@ int relayd_send_close_stream(struct lttcomm_relayd_sock *rsock, uint64_t stream_
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd closing stream id %" PRIu64, stream_id);
 
@@ -901,7 +900,7 @@ int relayd_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t 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);
 
@@ -950,7 +949,7 @@ int relayd_quiescent_control(struct lttcomm_relayd_sock *rsock,
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd checking quiescent control state");
 
@@ -995,7 +994,7 @@ int relayd_begin_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t id)
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd begin data pending");
 
@@ -1043,7 +1042,7 @@ int relayd_end_data_pending(struct lttcomm_relayd_sock *rsock, uint64_t id,
        struct lttcomm_relayd_generic_reply reply;
 
        /* Code flow error. Safety net. */
-       assert(rsock);
+       LTTNG_ASSERT(rsock);
 
        DBG("Relayd end data pending");
 
@@ -1090,7 +1089,7 @@ int relayd_send_index(struct lttcomm_relayd_sock *rsock,
        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");
@@ -1159,7 +1158,7 @@ int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock,
        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) {
@@ -1229,7 +1228,7 @@ int relayd_rotate_streams(struct lttcomm_relayd_sock *sock,
        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),
index ab5fb589117597162369044d6e549f43efde2194..4bb45b0453ceba40f6e219d84b14d5b01792479b 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <fcntl.h>
 #include <grp.h>
 #include <limits.h>
@@ -1448,7 +1447,7 @@ int run_as_create_worker_no_lock(const char *procname,
        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
@@ -1642,7 +1641,7 @@ int run_as(enum run_as_cmd cmd, struct run_as_data *data,
        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;
index 276c840a3f61f534765ffec5fec85bba6f0c918a..757a82a5d2414f45743127e379e0405ead17e9b7 100644 (file)
@@ -10,7 +10,6 @@
 #include <common/defaults.h>
 #include <common/error.h>
 #include <time.h>
-#include <assert.h>
 #include <stdio.h>
 
 struct lttng_session_descriptor_network_location {
@@ -1043,7 +1042,7 @@ enum lttng_error_code lttng_session_descriptor_set_default_output(
                                goto end;
                        }
                }
-               assert(descriptor->name);
+               LTTNG_ASSERT(descriptor->name);
                ret = snprintf(local_uri, sizeof(local_uri),
                                "file://%s/%s/%s%s",
                                absolute_home_path,
index 827b97598f0810a0a8ce229318be60be67c3e1e3..15608fd94c194157b72f6076c10e54bb9fbb65ed 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -371,7 +370,7 @@ ssize_t lttcomm_recvmsg_inet_sock(struct lttcomm_sock *sock, void *buf,
                        }
                        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));
 
index 40610ed5745bf54ddf7927c3fe98b3b5acec98fa..c9c9a5ae411e561099a682f310d74103368beb00 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -350,7 +349,7 @@ ssize_t lttcomm_recvmsg_inet6_sock(struct lttcomm_sock *sock, void *buf,
                        }
                        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) {
index 6c00a71bcddb8529a872bec96ec6895a3a055c1a..ed185b1ea8934dd39af312258e9c858b984d8b85 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -92,7 +91,7 @@ int lttcomm_create_sock(struct lttcomm_sock *sock)
 {
        int ret, _sock_type, _sock_proto, domain;
 
-       assert(sock);
+       LTTNG_ASSERT(sock);
 
        domain = sock->sockaddr.type;
        if (domain != LTTCOMM_INET && domain != LTTCOMM_INET6) {
@@ -158,7 +157,7 @@ struct lttcomm_sock *lttcomm_alloc_copy_sock(struct lttcomm_sock *src)
        struct lttcomm_sock *sock;
 
        /* Safety net */
-       assert(src);
+       LTTNG_ASSERT(src);
 
        sock = lttcomm_alloc_sock(src->proto);
        if (sock == NULL) {
@@ -181,8 +180,8 @@ LTTNG_HIDDEN
 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;
@@ -200,9 +199,9 @@ int lttcomm_init_inet_sockaddr(struct lttcomm_sockaddr *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));
 
@@ -231,9 +230,9 @@ int lttcomm_init_inet6_sockaddr(struct lttcomm_sockaddr *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));
 
@@ -262,7 +261,7 @@ struct lttcomm_sock *lttcomm_alloc_sock_from_uri(struct lttng_uri *uri)
        struct lttcomm_sock *sock = NULL;
 
        /* Safety net */
-       assert(uri);
+       LTTNG_ASSERT(uri);
 
        /* Check URI protocol */
        if (uri->proto == LTTNG_TCP) {
@@ -327,7 +326,7 @@ struct lttcomm_relayd_sock *lttcomm_alloc_relayd_sock(struct lttng_uri *uri,
        struct lttcomm_sock *tmp_sock = NULL;
        struct lttcomm_relayd_sock *rsock = NULL;
 
-       assert(uri);
+       LTTNG_ASSERT(uri);
 
        rsock = zmalloc(sizeof(*rsock));
        if (!rsock) {
@@ -407,11 +406,11 @@ int lttcomm_setsockopt_snd_timeout(int sock, unsigned int msec)
 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) {
@@ -431,10 +430,10 @@ int lttcomm_sock_get_port(const struct lttcomm_sock *sock, uint16_t *port)
 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) {
index 7ccc3c0bc4ebb19aaea4c5e86d756c741833052f..24a183db382999eda1c41f74cb1758341baabb89 100644 (file)
@@ -33,7 +33,7 @@ static int get_wait_shm(char *shm_path, size_t mmap_size, int global)
        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;
@@ -164,7 +164,7 @@ char *shm_ust_get_mmap(char *shm_path, int global)
        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) {
index ec10f8d636dbca1cd5ba457763fa09924800d248..51871f7855d2350fb01a38969773c58f903fdd6f 100644 (file)
@@ -13,7 +13,6 @@
 #include <lttng/snapshot-internal.h>
 #include <lttng/snapshot.h>
 
-#include <assert.h>
 #include <stdlib.h>
 
 LTTNG_HIDDEN
@@ -55,8 +54,8 @@ bool lttng_snapshot_output_is_equal(
 {
        bool equal = false;
 
-       assert(a);
-       assert(b);
+       LTTNG_ASSERT(a);
+       LTTNG_ASSERT(b);
 
        if (a->max_size != b->max_size) {
                goto end;
@@ -188,8 +187,8 @@ enum lttng_error_code lttng_snapshot_output_mi_serialize(
        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,
index 4ca0ce1a2f45a92c8e1772c906355ce05de558ce..52be70526e5309e6c1ee10acefef030bf9238c39 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdbool.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -249,7 +248,7 @@ retry_viewer:
         * 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;
index 669f7d05fd01c64513b68128a740c8940fdcaa9d..55399a1156b54d9a3b33113a73eabaec45e9bda0 100644 (file)
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdbool.h>
-#include <assert.h>
 
 #include "string-utils.h"
 #include "../macros.h"
@@ -31,7 +30,7 @@ void strutils_normalize_star_glob_pattern(char *pattern)
        char *np;
        bool got_star = false;
 
-       assert(pattern);
+       LTTNG_ASSERT(pattern);
 
        for (p = pattern, np = pattern; *p != '\0'; p++) {
                switch (*p) {
@@ -75,7 +74,7 @@ enum star_glob_pattern_type_flags strutils_test_glob_pattern(const char *pattern
                STAR_GLOB_PATTERN_TYPE_FLAG_NONE;
        const char *p;
 
-       assert(pattern);
+       LTTNG_ASSERT(pattern);
 
        for (p = pattern; *p != '\0'; p++) {
                switch (*p) {
@@ -137,7 +136,7 @@ char *strutils_unescape_string(const char *input, char only_char)
        char *o;
        const char *i;
 
-       assert(input);
+       LTTNG_ASSERT(input);
        output = zmalloc(strlen(input) + 1);
        if (!output) {
                goto end;
@@ -254,9 +253,9 @@ int strutils_split(const char *input,
        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. */
@@ -362,7 +361,7 @@ size_t strutils_array_of_strings_len(char * const *array)
        char * const *item;
        size_t count = 0;
 
-       assert(array);
+       LTTNG_ASSERT(array);
 
        for (item = array; *item; item++) {
                count++;
index 327612ce283b1db9e00de1ea6bf8ec2fb81fb77d..672ebded263975047ac653f0f5fc45de415228a3 100644 (file)
@@ -182,7 +182,7 @@ struct fs_handle *fs_handle_untracked_create(
        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;
@@ -203,7 +203,7 @@ struct fs_handle *fs_handle_untracked_create(
 
        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;
@@ -467,9 +467,9 @@ LTTNG_HIDDEN
 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;
 }
 
@@ -522,7 +522,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_copy(
                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;
        }
@@ -530,7 +530,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_copy(
                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;
@@ -880,7 +880,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_rename_path_no_lock(
                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. */
@@ -1080,14 +1080,14 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_as_owner(
                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:
@@ -1114,7 +1114,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_as_user(
                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:
@@ -1139,7 +1139,7 @@ lttng_trace_chunk_get_session_output_directory_handle(
                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:
@@ -1346,7 +1346,7 @@ void lttng_trace_chunk_remove_file(
        }
        ret = lttng_dynamic_pointer_array_remove_pointer(
                        &chunk->files, index);
-       assert(!ret);
+       LTTNG_ASSERT(!ret);
 }
 
 static
@@ -1383,7 +1383,7 @@ enum lttng_trace_chunk_status _lttng_trace_chunk_open_fs_handle_locked(
                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;
@@ -1452,7 +1452,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_open_file(
         * 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);
@@ -1571,9 +1571,9 @@ int lttng_trace_chunk_move_to_completed_post_release(
                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);
@@ -1695,8 +1695,8 @@ int lttng_trace_chunk_delete_post_release_owner(
 
        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(
@@ -1917,7 +1917,7 @@ void lttng_trace_chunk_put(struct lttng_trace_chunk *chunk)
        if (!chunk) {
                return;
        }
-       assert(chunk->ref.refcount);
+       LTTNG_ASSERT(chunk->ref.refcount);
        urcu_ref_put(&chunk->ref, lttng_trace_chunk_release);
 }
 
@@ -1952,7 +1952,7 @@ void lttng_trace_chunk_registry_destroy(
        }
        if (registry->ht) {
                int ret = cds_lfht_destroy(registry->ht, NULL);
-               assert(!ret);
+               LTTNG_ASSERT(!ret);
        }
        free(registry);
 }
index e708694b1c0969a7feb649691af0c9b411f05cac..0afea92fcc8f56280b1109cce2b6e13555878fdb 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/credentials.h>
 #include <common/dynamic-array.h>
 #include <common/error.h>
@@ -119,8 +118,8 @@ static void trigger_destroy_ref(struct urcu_ref *ref)
        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);
@@ -299,7 +298,7 @@ int lttng_trigger_serialize(const struct lttng_trigger *trigger,
        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);
 
@@ -386,7 +385,7 @@ bool lttng_trigger_is_hidden(const struct lttng_trigger *trigger)
 LTTNG_HIDDEN
 void lttng_trigger_set_hidden(struct lttng_trigger *trigger)
 {
-       assert(!trigger->is_hidden);
+       LTTNG_ASSERT(!trigger->is_hidden);
        trigger->is_hidden = true;
 }
 
@@ -458,14 +457,14 @@ LTTNG_HIDDEN
 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);
 }
@@ -536,7 +535,7 @@ struct lttng_trigger *lttng_triggers_borrow_mutable_at_index(
 {
        struct lttng_trigger *trigger = NULL;
 
-       assert(triggers);
+       LTTNG_ASSERT(triggers);
        if (index >= lttng_dynamic_pointer_array_get_count(&triggers->array)) {
                goto end;
        }
@@ -554,8 +553,8 @@ int lttng_triggers_add(
 {
        int ret;
 
-       assert(triggers);
-       assert(trigger);
+       LTTNG_ASSERT(triggers);
+       LTTNG_ASSERT(trigger);
 
        lttng_trigger_get(trigger);
 
@@ -574,10 +573,10 @@ int lttng_triggers_remove_hidden_triggers(struct lttng_triggers *triggers)
        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 =
@@ -663,7 +662,7 @@ int lttng_triggers_serialize(const struct lttng_triggers *triggers,
                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) {
@@ -756,7 +755,7 @@ LTTNG_HIDDEN
 void lttng_trigger_set_credentials(struct lttng_trigger *trigger,
                const struct lttng_credentials *creds)
 {
-       assert(creds);
+       LTTNG_ASSERT(creds);
        trigger->creds = *creds;
 }
 
@@ -819,8 +818,8 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
        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);
@@ -836,7 +835,7 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
                /* 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:
@@ -844,7 +843,7 @@ enum lttng_domain_type lttng_trigger_get_underlying_domain_type_restriction(
                /* 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();
@@ -879,7 +878,7 @@ enum lttng_error_code lttng_trigger_generate_bytecode(
                                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(
@@ -1087,8 +1086,8 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
        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);
 
@@ -1099,7 +1098,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
        }
 
        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(
@@ -1118,7 +1117,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
 
        /* 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) {
@@ -1127,7 +1126,7 @@ enum lttng_error_code lttng_trigger_mi_serialize(const struct lttng_trigger *tri
 
        /* 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) {
@@ -1178,10 +1177,10 @@ static int compare_triggers_by_name(const void *a, const void *b)
 
        /* 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);
 }
@@ -1198,8 +1197,8 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
        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
@@ -1208,7 +1207,7 @@ enum lttng_error_code lttng_triggers_mi_serialize(const struct lttng_triggers *t
        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;
index 4c5c7acc61a260b10162d83089b7373c8c18d297..933baa61c7195b645cb066152d58657180189654 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -181,9 +180,9 @@ ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
        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));
 
@@ -198,7 +197,7 @@ ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len)
                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) {
@@ -227,9 +226,9 @@ ssize_t lttcomm_recv_unix_sock_non_block(int sock, void *buf, size_t len)
        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));
 
@@ -279,9 +278,9 @@ ssize_t lttcomm_send_unix_sock(int sock, const void *buf, size_t len)
        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));
 
@@ -333,9 +332,9 @@ ssize_t lttcomm_send_unix_sock_non_block(int sock, const void *buf, size_t len)
        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));
 
@@ -411,9 +410,9 @@ ssize_t lttcomm_send_fds_unix_sock(int sock, const int *fds, size_t nb_fd)
        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));
@@ -545,9 +544,9 @@ ssize_t lttcomm_send_fds_unix_sock_non_block(int sock, const int *fds, size_t nb
        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));
@@ -638,9 +637,9 @@ ssize_t lttcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
        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));
 
@@ -758,7 +757,7 @@ enum lttng_error_code add_fds_to_payload(struct lttng_dynamic_array *raw_fds,
                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) {
@@ -791,9 +790,9 @@ ssize_t _lttcomm_recv_payload_fds_unix_sock(int sock, size_t nb_fd,
        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);
 
@@ -861,9 +860,9 @@ ssize_t lttcomm_recv_fds_unix_sock_non_block(int sock, int *fds, size_t nb_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 */
@@ -1003,9 +1002,9 @@ ssize_t lttcomm_send_creds_unix_sock(int sock, const void *buf, size_t len)
 
        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;
@@ -1065,10 +1064,10 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t 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));
 
@@ -1089,7 +1088,7 @@ ssize_t lttcomm_recv_creds_unix_sock(int sock, void *buf, size_t len,
                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) {
index a774cb3cb70567d5c96f57e1b6878fb6d4c0d7ec..da67fcd18d51e3735f2ba6276791536ef59d4c94 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <arpa/inet.h>
 #include <common/compat/netdb.h>
 #include <stdlib.h>
@@ -98,8 +97,8 @@ static int set_ip_address(const char *addr, int af, char *dst, size_t size)
        unsigned char buf[sizeof(struct in6_addr)];
        struct hostent *record;
 
-       assert(addr);
-       assert(dst);
+       LTTNG_ASSERT(addr);
+       LTTNG_ASSERT(dst);
 
        memset(dst, 0, size);
 
@@ -183,8 +182,8 @@ static int compare_destination(struct lttng_uri *ctrl, struct lttng_uri *data)
 {
        int ret;
 
-       assert(ctrl);
-       assert(data);
+       LTTNG_ASSERT(ctrl);
+       LTTNG_ASSERT(data);
 
        switch (ctrl->dtype) {
        case LTTNG_DST_IPV4:
@@ -211,8 +210,8 @@ int uri_to_str_url(struct lttng_uri *uri, char *dst, size_t size)
        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;
@@ -514,7 +513,7 @@ end:
        free(addr_f);
 
        *uris = tmp_uris;
-       assert(size == 1 || size == 2);
+       LTTNG_ASSERT(size == 1 || size == 2);
        return size;
 
 free_error:
@@ -579,7 +578,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                }
 
                /* 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);
@@ -620,7 +619,7 @@ ssize_t uri_parse_str_urls(const char *ctrl_url, const char *data_url,
                        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);
index 67b0ee69820c708e28bbd297674f8c3d055b7539..e5cba5ed27e4b55a6ca05d8926e5e658d3328a53 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include "lttng/lttng-error.h"
-#include <assert.h>
 #include <common/compat/string.h>
 #include <common/error.h>
 #include <common/hashtable/hashtable.h>
@@ -115,12 +114,12 @@ void lttng_userspace_probe_location_function_destroy(
 {
        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);
@@ -134,13 +133,13 @@ void lttng_userspace_probe_location_tracepoint_destroy(
 {
        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);
@@ -253,14 +252,14 @@ static bool lttng_userspace_probe_location_function_is_equal(
                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;
        }
@@ -375,20 +374,20 @@ static bool lttng_userspace_probe_location_tracepoint_is_equal(
        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;
        }
@@ -543,8 +542,8 @@ lttng_userspace_probe_location_lookup_method_function_elf_copy(
        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));
@@ -570,8 +569,8 @@ lttng_userspace_probe_location_lookup_method_tracepoint_sdt_copy(
        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));
@@ -602,8 +601,8 @@ lttng_userspace_probe_location_function_copy(
        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);
 
@@ -676,8 +675,8 @@ lttng_userspace_probe_location_tracepoint_copy(
        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);
 
@@ -967,7 +966,7 @@ lttng_userspace_probe_location_get_lookup_method(
 {
        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(
@@ -1017,8 +1016,8 @@ int lttng_userspace_probe_location_function_serialize(
        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,
@@ -1094,8 +1093,8 @@ int lttng_userspace_probe_location_tracepoint_serialize(
        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,
@@ -1248,7 +1247,7 @@ int lttng_userspace_probe_location_function_create_from_payload(
        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;
@@ -1331,7 +1330,7 @@ int lttng_userspace_probe_location_tracepoint_create_from_payload(
        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;
@@ -1429,8 +1428,8 @@ int lttng_userspace_probe_location_lookup_method_create_from_payload(
        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;
@@ -1484,8 +1483,8 @@ int lttng_userspace_probe_location_create_from_payload(
                        lttng_payload_view_from_view(
                                        view, 0, sizeof(*probe_location_comm));
 
-       assert(view);
-       assert(location);
+       LTTNG_ASSERT(view);
+       LTTNG_ASSERT(location);
 
        lookup_method = NULL;
 
@@ -1548,7 +1547,7 @@ int lttng_userspace_probe_location_create_from_payload(
                goto end;
        }
 
-       assert(lookup_method);
+       LTTNG_ASSERT(lookup_method);
        (*location)->lookup_method = lookup_method;
        lookup_method = NULL;
        ret += consumed;
@@ -1564,8 +1563,8 @@ int lttng_userspace_probe_location_function_set_binary_fd_handle(
        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);
@@ -1583,8 +1582,8 @@ int lttng_userspace_probe_location_tracepoint_set_binary_fd_handle(
        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);
@@ -1608,7 +1607,7 @@ int lttng_userspace_probe_location_function_flatten(
        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) {
@@ -1619,8 +1618,8 @@ int lttng_userspace_probe_location_function_flatten(
        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);
@@ -1732,7 +1731,7 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        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 !=
@@ -1743,9 +1742,9 @@ int lttng_userspace_probe_location_tracepoint_flatten(
        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);
@@ -1996,8 +1995,8 @@ enum lttng_error_code lttng_userspace_probe_location_mi_serialize(
        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:
@@ -2048,8 +2047,8 @@ enum lttng_error_code lttng_userspace_probe_location_lookup_method_mi_serialize(
        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:
@@ -2109,8 +2108,8 @@ static enum lttng_error_code lttng_userspace_probe_location_tracepoint_mi_serial
        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);
@@ -2188,8 +2187,8 @@ static enum lttng_error_code lttng_userspace_probe_location_function_mi_serializ
        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);
index 2948fda5043ad7b8aa4dd177e0beb04b25d38d48..31effcc234d9f2168cca2ba82ab1cbcd3f4dcc68 100644 (file)
@@ -8,7 +8,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <lttng/ust-ctl.h>
 #include <lttng/ust-sigbus.h>
 #include <poll.h>
@@ -59,7 +58,7 @@ static void destroy_channel(struct lttng_consumer_channel *channel)
 {
        struct lttng_consumer_stream *stream, *stmp;
 
-       assert(channel);
+       LTTNG_ASSERT(channel);
 
        DBG("UST consumer cleaning stream list");
 
@@ -100,8 +99,8 @@ static int add_channel(struct lttng_consumer_channel *channel,
 {
        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);
@@ -135,8 +134,8 @@ static struct lttng_consumer_stream *allocate_stream(int cpu, int key,
        int alloc_ret;
        struct lttng_consumer_stream *stream = NULL;
 
-       assert(channel);
-       assert(ctx);
+       LTTNG_ASSERT(channel);
+       LTTNG_ASSERT(ctx);
 
        stream = consumer_stream_create(
                        channel,
@@ -257,8 +256,8 @@ static int create_ust_streams(struct lttng_consumer_channel *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
@@ -392,10 +391,10 @@ static int create_ust_channel(struct lttng_consumer_channel *channel,
        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 ", "
@@ -482,8 +481,8 @@ static int send_sessiond_stream(int sock, struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       assert(stream);
-       assert(sock >= 0);
+       LTTNG_ASSERT(stream);
+       LTTNG_ASSERT(sock >= 0);
 
        DBG("UST consumer sending stream %" PRIu64 " to sessiond", stream->key);
 
@@ -510,9 +509,9 @@ static int send_channel_to_sessiond_and_relayd(int sock,
        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);
 
@@ -605,9 +604,9 @@ static int ask_channel(struct lttng_consumer_local_data *ctx,
 {
        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,
@@ -664,8 +663,8 @@ static int send_streams_to_thread(struct lttng_consumer_channel *channel,
        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,
@@ -936,7 +935,7 @@ static int setup_metadata(struct lttng_consumer_local_data *ctx, uint64_t key)
                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;
@@ -970,15 +969,15 @@ static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
        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();
 
@@ -1003,7 +1002,7 @@ static int snapshot_metadata(struct lttng_consumer_channel *metadata_channel,
        }
 
        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) {
@@ -1086,8 +1085,8 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
        unsigned long consumed_pos, produced_pos;
        struct lttng_consumer_stream *stream;
 
-       assert(path);
-       assert(ctx);
+       LTTNG_ASSERT(path);
+       LTTNG_ASSERT(ctx);
 
        rcu_read_lock();
 
@@ -1095,7 +1094,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
                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) {
@@ -1103,7 +1102,7 @@ static int snapshot_channel(struct lttng_consumer_channel *channel,
 
                /* 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
@@ -1113,7 +1112,7 @@ static int snapshot_channel(struct lttng_consumer_channel *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;
@@ -1408,7 +1407,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        health_code_update();
 
        /* deprecated */
-       assert(msg.cmd_type != LTTNG_CONSUMER_STOP);
+       LTTNG_ASSERT(msg.cmd_type != LTTNG_CONSUMER_STOP);
 
        health_code_update();
 
@@ -1562,7 +1561,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        attr.type = LTTNG_UST_ABI_CHAN_METADATA;
                        break;
                default:
-                       assert(0);
+                       abort();
                        goto error_fatal;
                };
 
@@ -1695,7 +1694,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        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:
@@ -2332,8 +2331,8 @@ end:
 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);
 }
@@ -2345,8 +2344,8 @@ int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream,
  */
 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);
 }
@@ -2359,8 +2358,8 @@ int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream)
 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);
 }
@@ -2373,9 +2372,9 @@ int lttng_ustconsumer_sample_snapshot_positions(
 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);
 }
@@ -2388,9 +2387,9 @@ int lttng_ustconsumer_get_produced_snapshot(
 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);
 }
@@ -2398,16 +2397,16 @@ int lttng_ustconsumer_get_consumed_snapshot(
 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);
 }
@@ -2415,9 +2414,9 @@ int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream)
 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);
 }
@@ -2425,9 +2424,9 @@ int lttng_ustconsumer_get_current_timestamp(
 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);
 }
@@ -2437,8 +2436,8 @@ int lttng_ustconsumer_get_sequence_number(
  */
 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) {
@@ -2456,9 +2455,9 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan)
 {
        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);
@@ -2491,9 +2490,9 @@ void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *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);
@@ -2511,8 +2510,8 @@ void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan)
 
 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);
@@ -2522,16 +2521,16 @@ void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream)
 
 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);
 }
@@ -2590,7 +2589,7 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
                        &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;
@@ -2598,7 +2597,7 @@ int commit_one_metadata_packet(struct lttng_consumer_stream *stream)
        }
        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;
 
@@ -2637,8 +2636,8 @@ enum sync_metadata_status lttng_ustconsumer_sync_metadata(
        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);
@@ -2702,8 +2701,8 @@ static int notify_if_more_data(struct lttng_consumer_stream *stream,
        int ret;
        struct lttng_ust_ctl_consumer_stream *ustream;
 
-       assert(stream);
-       assert(ctx);
+       LTTNG_ASSERT(stream);
+       LTTNG_ASSERT(ctx);
 
        ustream = stream->ustream;
 
@@ -2721,7 +2720,7 @@ static int notify_if_more_data(struct lttng_consumer_stream *stream,
        }
 
        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;
@@ -2907,7 +2906,7 @@ static int get_next_subbuffer_common(struct lttng_consumer_stream *stream,
 
        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;
 }
@@ -3053,7 +3052,7 @@ static int put_next_subbuffer(struct lttng_consumer_stream *stream,
 {
        const int ret = lttng_ust_ctl_put_next_subbuf(stream->ustream);
 
-       assert(ret == 0);
+       LTTNG_ASSERT(ret == 0);
        return ret;
 }
 
@@ -3111,7 +3110,7 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       assert(stream);
+       LTTNG_ASSERT(stream);
 
        /*
         * Don't create anything if this is set for streaming or if there is
@@ -3144,8 +3143,8 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
 {
        int ret;
 
-       assert(stream);
-       assert(stream->ustream);
+       LTTNG_ASSERT(stream);
+       LTTNG_ASSERT(stream->ustream);
        ASSERT_LOCKED(stream->lock);
 
        DBG("UST consumer checking data pending");
@@ -3176,7 +3175,7 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
                 */
                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 */
@@ -3190,7 +3189,7 @@ int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream)
                         * subbuffer.
                         */
                        ret = lttng_ust_ctl_put_subbuf(stream->ustream);
-                       assert(ret == 0);
+                       LTTNG_ASSERT(ret == 0);
                        ret = 1;        /* Data is pending */
                        goto end;
                }
@@ -3213,8 +3212,8 @@ void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata)
 {
        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);
 
@@ -3256,8 +3255,8 @@ void lttng_ustconsumer_close_all_metadata(struct lttng_ht *metadata_ht)
        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");
 
@@ -3304,8 +3303,8 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        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));
 
@@ -3383,7 +3382,7 @@ int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx,
        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);
        }
@@ -3427,8 +3426,8 @@ end:
 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);
 }
index 6bf0a10e163a3fb434b9b117b38e912884ddf546..c08e349e2c8d618933845ec5699ef35858d33e2b 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "common/macros.h"
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <limits.h>
@@ -598,7 +597,7 @@ int utils_create_pid_file(pid_t pid, const char *filepath)
        int ret;
        FILE *fp;
 
-       assert(filepath);
+       LTTNG_ASSERT(filepath);
 
        fp = fopen(filepath, "w");
        if (fp == NULL) {
@@ -633,7 +632,7 @@ int utils_create_lock_file(const char *filepath)
        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 |
@@ -751,7 +750,7 @@ int utils_stream_file_path(const char *path_name, const char *file_name,
        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",
@@ -1209,8 +1208,8 @@ size_t utils_get_current_time_str(const char *format, char *dst, size_t len)
        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);
@@ -1417,7 +1416,7 @@ int utils_show_help(int section, const char *page_name,
 
        /* Section integer -> section string */
        ret = sprintf(section_string, "%d", section);
-       assert(ret > 0 && ret < 8);
+       LTTNG_ASSERT(ret > 0 && ret < 8);
 
        /*
         * Execute man pager.
@@ -1512,7 +1511,7 @@ int utils_change_working_directory(const char *path)
 {
        int ret;
 
-       assert(path);
+       LTTNG_ASSERT(path);
 
        DBG("Changing working directory to \"%s\"", path);
        ret = chdir(path);
@@ -1677,8 +1676,8 @@ int utils_parse_unsigned_long_long(const char *str,
        int ret;
        char *endptr;
 
-       assert(str);
-       assert(value);
+       LTTNG_ASSERT(str);
+       LTTNG_ASSERT(value);
 
        errno = 0;
        *value = strtoull(str, &endptr, 10);
index 779754e1ba168cd2d3e115bfc39e82d81109728d..52a374f6dfeefbbbf61506b2e63e46651f907456 100644 (file)
@@ -9,7 +9,6 @@
 #include "waiter.h"
 #include <urcu/uatomic.h>
 #include <urcu/futex.h>
-#include <assert.h>
 #include "error.h"
 #include <poll.h>
 
@@ -85,7 +84,7 @@ skip_futex_wait:
        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");
 }
 
@@ -98,7 +97,7 @@ LTTNG_HIDDEN
 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,
index 868e8aa68b7eb85b1dd6f206d1fb38511cfd05e0..17f9537ba5645690fa2562e8bf5d28f9c9a9d643 100644 (file)
@@ -17,7 +17,6 @@
 #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>
 
@@ -92,7 +91,7 @@ enum lttng_notification_channel_message_type get_current_message_type(
 {
        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;
@@ -230,7 +229,7 @@ lttng_notification_channel_get_next_notification(
        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(
@@ -633,7 +632,7 @@ enum lttng_notification_channel_status send_condition_command(
                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);
index 060e2d0f2f986e68922a4c14a7a5f818d49204e5..3face64de83ed1f0f1902cacbc5f2a4991d0a8cb 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 
 #include <lttng/lttng-error.h>
@@ -97,7 +96,7 @@ int handle_state_transition(struct lttng_clear_handle *handle)
 {
        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:
@@ -121,7 +120,7 @@ int handle_state_transition(struct lttng_clear_handle *handle)
                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:
index 6d8a26b113481914ff01e8e691d23eec23699750..26ae7d3065f863840143020cffe61e7e982e101e 100644 (file)
@@ -101,7 +101,7 @@ int handle_state_transition(struct lttng_destruction_handle *handle)
 {
        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:
@@ -129,7 +129,7 @@ int handle_state_transition(struct lttng_destruction_handle *handle)
                                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:
index 1dd09046dcbc07cf15439391eec97925b52948e0..c153b9187397ccb930d36704570c9b3e80e639c7 100644 (file)
@@ -10,7 +10,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <stddef.h>
 
 #include <common/error.h>
@@ -187,7 +186,7 @@ int lttng_event_set_userspace_probe_location(struct lttng_event *event,
        }
 
        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);
index db9bfe0bf18bca0eaf3c6f2277bed6dda2f601d8..4af13267581b5a3652ca23fe7d49cfd7869b8ff7 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 #include <limits.h>
 
index 3de74fd11009bee33df7710f2a6d25fdeda1d05f..955b1fcd00cb5e617d0756c95db8267032b83897 100644 (file)
@@ -306,7 +306,7 @@ close_error:
                int closeret;
 
                closeret = close(sock);
-               assert(!closeret);
+               LTTNG_ASSERT(!closeret);
        }
 
 error:
index 7ad1fe13291b8f40599ad60ce197bbbfc5c6dae5..46d9cb1c3a805067ac3c37af45fd30ace416a63f 100644 (file)
@@ -11,7 +11,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <grp.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -198,7 +197,7 @@ static int recv_data_sessiond(void *buf, size_t len)
 {
        int ret;
 
-       assert(len > 0);
+       LTTNG_ASSERT(len > 0);
 
        if (!connected) {
                ret = -LTTNG_ERR_NO_SESSIOND;
@@ -614,8 +613,8 @@ int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
        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) {
@@ -1021,7 +1020,7 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev)
        int err;
        char *agent_filter = NULL;
 
-       assert(ev);
+       LTTNG_ASSERT(ev);
 
        /* Don't add filter for the '*' event. */
        if (strcmp(ev->name, "*") != 0) {
@@ -1134,7 +1133,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
        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);
@@ -1279,7 +1278,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
                        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);
@@ -2053,7 +2052,7 @@ int lttng_destroy_session(const char *session_name)
                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);
@@ -2883,7 +2882,7 @@ int lttng_session_daemon_alive(void)
                 * No socket path set. Weird error which means the constructor
                 * was not called.
                 */
-               assert(0);
+               abort();
        }
 
        ret = try_connect_sessiond(sessiond_sock_path);
index 17964fb1070784b9b65badf61eca9a94da9e819c..d131944043ec4bf2667999137acb997fc056037b 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 
 #include <lttng/lttng-error.h>
@@ -223,7 +222,7 @@ int lttng_rotate_session(const char *session_name,
        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) {
@@ -288,7 +287,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule(
        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) {
index 7afac450d2913d077c3ea23b43e8f712f1843f0e..c8d8ac9c24ed4e2118c4c036047888affd7a3bc1 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 
 #include <lttng/lttng-error.h>
index 93f393fc298bc7e9d40efebc8026913229a26ae0..e90062352e7aaa75dff6ec1b84a88022a1733f18 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <string.h>
 
 #include <common/sessiond-comm/sessiond-comm.h>
index 3814c05681265e6ab03d96845d9b92ac7e399976..b428f1add176567f5972126581b0dac3fb25c2df 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -78,7 +77,7 @@ ssize_t lttng_live_recv(int fd, void *buf, size_t len)
        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;
                }
@@ -252,7 +251,7 @@ int create_viewer_session(void)
                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) {
@@ -263,7 +262,7 @@ int create_viewer_session(void)
                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");
index 9b6d30b86731cb638d21f37c77d9932ce18a0b7d..b7e1a9f42f8eef81fa0be4ef55d924eec30c3034 100644 (file)
@@ -14,7 +14,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <inttypes.h>
-#include <assert.h>
 
 #include <lttng/action/action.h>
 #include <lttng/action/list.h>
index 0d1edc5f96a54ce0b12bbc483c8e8ac22d16e51e..c4fc0a0572f3d688b6b557118e30b25545a2d3ce 100644 (file)
@@ -14,7 +14,6 @@
 #include <lttng/constant.h>
 #include <fcntl.h>
 #include <dlfcn.h>
-#include <assert.h>
 #include <stdio.h>
 
 static char *pause_pipe_path;
@@ -67,9 +66,9 @@ int __testpoint_consumerd_thread_data(void)
         * 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:
index 556a0e0b1b8807618f2bd7bb02ac5a330d7f0772..a56b7945d2605db870ec788a4d98a01318e81465 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <math.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -24,6 +23,7 @@
 #include <poll.h>
 
 #include <common/compat/errno.h>
+#include <common/macros.h>
 #include <lttng/lttng.h>
 
 #include <tap/tap.h>
@@ -613,8 +613,8 @@ static int validator_notification_trigger_name(
        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) {
@@ -742,7 +742,7 @@ int suspend_application(void)
        /*
         * 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) {
@@ -774,7 +774,7 @@ int resume_application(void)
                goto error;
        }
 
-       assert(app_pid > 1);
+       LTTNG_ASSERT(app_pid > 1);
 
        ret = kill(app_pid, SIGUSR1);
        if (ret) {
@@ -908,7 +908,7 @@ void test_triggers_buffer_usage_condition(const char *session_name,
 
                /* 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",
@@ -981,7 +981,7 @@ void wait_data_pending(const char *session_name)
 
        do {
                ret = lttng_data_pending(session_name);
-               assert(ret >= 0);
+               LTTNG_ASSERT(ret >= 0);
        } while (ret != 0);
 }
 
@@ -1477,10 +1477,10 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
        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) {
@@ -1520,9 +1520,9 @@ static void create_tracepoint_event_rule_trigger(const char *event_pattern,
                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(
@@ -2408,7 +2408,7 @@ static int validator_notification_trigger_capture(
                                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;
@@ -2597,7 +2597,7 @@ int main(int argc, const char *argv[])
                 * 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);
@@ -2608,7 +2608,7 @@ int main(int argc, const char *argv[])
        {
                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);
@@ -2621,7 +2621,7 @@ int main(int argc, const char *argv[])
        {
                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);
@@ -2649,7 +2649,7 @@ int main(int argc, const char *argv[])
                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);
@@ -2669,7 +2669,7 @@ int main(int argc, const char *argv[])
                        plan_tests(215);
                        break;
                default:
-                       assert(0);
+                       abort();
                }
 
                diag("Test tracepoint event rule notification captures for domain %s",
index f32a0d7737efb95b3b778c3e14784ec19dc40395..55ee2e69e79b15c37d7464150b94b6ae87e2397d 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <stdio.h>
 #include <unistd.h>
-#include <assert.h>
 #include <tap/tap.h>
 #include <stdint.h>
 #include <string.h>
index c4100998d4d426b4733a638ccf2311d65b0d77d7..21f04cda75df6293b86677d1f25b5d8009f97105 100644 (file)
@@ -15,7 +15,6 @@
 #include <lttng/constant.h>
 #include <fcntl.h>
 #include <dlfcn.h>
-#include <assert.h>
 #include <stdio.h>
 
 static char *pause_pipe_path;
@@ -57,7 +56,7 @@ int __testpoint_sessiond_thread_notification(void)
        }
 
        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) {
index 3ff126562c526159185369690ced758063e3ab7b..5395dd22441cd94e744dcf935c5f5b5102baf6c8 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
index fe62b9011c8434b707e529e5f076fb2d4884ec1a..3bb3099ce860659749979250ed9184476fda678b 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <stdio.h>
 #include <unistd.h>
-#include <assert.h>
 #include <tap/tap.h>
 #include <stdint.h>
 #include <string.h>
@@ -99,7 +98,7 @@ int unregister_all_triggers(void)
                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) {
@@ -246,7 +245,7 @@ void register_anonymous_trigger(
                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,
@@ -323,7 +322,7 @@ void register_named_trigger(
                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,
@@ -404,7 +403,7 @@ void register_automatic_name_trigger(
                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,
index f4bba2df4488de26114dabe07eda609048debcee..54eb78303348cbe3b8675a3a45193904e2e8b376 100644 (file)
@@ -11,7 +11,6 @@
 #include <common/macros.h>
 #include <lttng/lttng.h>
 
-#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -24,7 +23,7 @@ static void register_trigger(const char *trigger_name,
 
        trigger = lttng_trigger_create(condition, action);
        ret = lttng_register_trigger_with_name(trigger, trigger_name);
-       assert(ret == LTTNG_OK);
+       LTTNG_ASSERT(ret == LTTNG_OK);
 }
 
 /*
@@ -42,7 +41,7 @@ static void register_trigger_action_list_notify(
        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);
 }
@@ -57,10 +56,10 @@ static struct lttng_condition *create_session_consumed_size_condition(
        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;
 }
@@ -82,13 +81,13 @@ static void fill_buffer_usage_condition(struct lttng_condition *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,
@@ -103,7 +102,7 @@ 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,
@@ -118,7 +117,7 @@ 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(
@@ -215,7 +214,7 @@ static void fill_session_rotation_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(
index 95df311d02e5894df8e990b1830c5afdb8b2cb66..ad323e9acc169592c68de995f4344fe6d6e0e997 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -52,7 +51,7 @@ static void test_action_notify(void)
        /* 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");
@@ -128,7 +127,7 @@ static void test_action_rotate_session(void)
        /* 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");
@@ -233,7 +232,7 @@ static void test_action_start_session(void)
        /* 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");
@@ -338,7 +337,7 @@ static void test_action_stop_session(void)
        /* 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");
@@ -442,7 +441,7 @@ static void test_action_snapshot_session(void)
        /* 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");
index 6183cd744e2d5bec0f7317f898920499b2d45227..1ed14fa6c3f502a02ba5e960cdbdbbc187ef0d8f 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -56,7 +55,7 @@ void test_condition_event_rule(void)
        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");
index 8bc59e08169809bfc5773f2b89211ee3015d2b44..ca116716595165b5ad8bfae4707341714c449fcf 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <fcntl.h>
 #include <stdbool.h>
 #include <stdio.h>
index f2514e158a5c956060e6663bc3558077aca3d69f..0fc9ec7702a44724339e5a530d19af5f71de52ae 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -128,7 +127,7 @@ void test_event_rule_user_tracepoint(void)
        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.");
@@ -268,7 +267,7 @@ void test_event_rule_jul_logging(void)
        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.");
@@ -333,7 +332,7 @@ void test_event_rule_log4j_logging(void)
        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.");
@@ -398,7 +397,7 @@ void test_event_rule_python_logging(void)
        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.");
@@ -581,8 +580,8 @@ static void test_event_rule_kernel_probe(void)
 
        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);
@@ -602,14 +601,14 @@ static void test_set_event_rule_log_level_rules(
 
        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);
@@ -636,7 +635,7 @@ static void test_event_rule_log_level_generic(enum lttng_event_rule_type event_r
        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];
index a1e4c017a710fe175f1df26e96b055ec3712d68b..345eaf25604352b11e442c200ed2a4cea0f24228 100644 (file)
@@ -8,7 +8,6 @@
 #include <stdlib.h>
 #include <inttypes.h>
 #include <stdbool.h>
-#include <assert.h>
 #include <string.h>
 #include <stdarg.h>
 #include <tap/tap.h>
@@ -72,15 +71,15 @@ void get_temporary_directories(char **_test_directory, char **_unlink_directory)
        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();
        }
 }
 
@@ -151,7 +150,7 @@ void track_std_fds(struct fd_tracker *tracker)
 
                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);
@@ -237,7 +236,7 @@ void test_unsuspendable_cb_return(void)
        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,
@@ -252,14 +251,14 @@ void test_unsuspendable_cb_return(void)
        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);
@@ -282,18 +281,18 @@ void test_unsuspendable_duplicate(void)
        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);
@@ -349,10 +348,10 @@ void test_unsuspendable_limit(void)
        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);
@@ -365,7 +364,7 @@ void test_unsuspendable_limit(void)
 
        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);
@@ -393,15 +392,15 @@ void test_unsuspendable_close_untracked(void)
        }
 
        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);
@@ -409,7 +408,7 @@ void test_unsuspendable_close_untracked(void)
 
        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);
@@ -435,7 +434,7 @@ static int open_files(struct fd_tracker *tracker,
                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,
@@ -523,7 +522,7 @@ void test_suspendable_limit(void)
        }
 
        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,
@@ -568,7 +567,7 @@ void test_mixed_limit(void)
        }
 
        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,
@@ -641,7 +640,7 @@ void test_suspendable_restore(void)
        }
 
        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,
@@ -701,9 +700,9 @@ skip_write:
 
                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,
@@ -767,10 +766,10 @@ void test_unlink(void)
        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) {
@@ -778,7 +777,7 @@ void test_unlink(void)
        }
 
        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,
@@ -838,7 +837,7 @@ void test_unlink(void)
        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
@@ -892,7 +891,7 @@ int main(int argc, char **argv)
        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();
index 21ec911f20c810d619fe261a58946b614fe28917..79489e3d3324651d0ac766d8ad86e611db215dcb 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -73,7 +72,7 @@ static void test_create_one_kernel_session(void)
 
 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");
index 33ac1daf49a4b1d0f9fba3e13a22c61612edab27..0f6f89ec950cb7a0c94c3fac91e670b2b51c3d76 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
index 7ee040cd952c339cc4a8c99189f72b509f955ecb..d2895c811bc5331e23d00bcea68805fe7d82827c 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -91,7 +90,7 @@ void test_log_level_rule_is_equal_exactly(void)
        /* 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");
@@ -120,7 +119,7 @@ void test_log_level_rule_is_equal_at_least_as_severe_as(void)
        /* 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");
index 6c57c21df1ea65de73d3641d7719167bb9f4a544..a44c8ef6718b9ba4808e1387565617eb060c48d6 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -25,6 +24,8 @@
 #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;
@@ -43,7 +44,7 @@ static void test_condition_buffer_usage(
        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);
index e232cde66cfaba6f07f5d0cab56e55181e6228ad..1c79b8931012b8135ee4d890bd0a9b66faf0a33d 100644 (file)
@@ -32,11 +32,11 @@ static void test_fd_push_pop_order(void)
                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);
@@ -80,10 +80,10 @@ static void test_fd_push_pop_imbalance(void)
                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);
@@ -126,9 +126,9 @@ static void test_fd_pop_fd_root_views(void)
        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);
 
@@ -178,8 +178,8 @@ static void test_fd_pop_fd_descendant_views(void)
        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);
index fcb27733c273020e2e010ba5a2b623d10edace62..acfe159039fdf79e748be3e53873b979fb27b071 100644 (file)
@@ -7,7 +7,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
index 0ebcf34ab87cf873bd1ad6df6c54807ba61c6a60..dee0fabd41df9028435da3750e7f705f4ceb60ae 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
index 675f710ae3eeba6204422790a21c9c5bff9086ef..4fc23791e0737f46b45878aa17e8471f2b0d80df 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -99,7 +98,7 @@ static void empty_session_list(void)
        session_unlock_list();
 
        /* Session list must be 0 */
-       assert(!session_list_count());
+       LTTNG_ASSERT(!session_list_count());
 }
 
 /*
@@ -309,7 +308,7 @@ static void test_large_session_number(void)
        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);
@@ -332,7 +331,7 @@ int main(int argc, char **argv)
 
        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");
index 1d61bc41fbfc8e4c3dae3a2d0c52dca054fe4560..d2b0d905d4598ac030da684411be82a57983f80b 100644 (file)
@@ -7,7 +7,6 @@
 
 #include <stdlib.h>
 #include <stdbool.h>
-#include <assert.h>
 #include <string.h>
 #include <stdarg.h>
 #include <common/string-utils/string-utils.h>
@@ -31,7 +30,7 @@ static void test_one_split(const char *input, char delim, int escape_delim,
        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);
@@ -134,7 +133,7 @@ static void test_one_normalize_star_glob_pattern(const char *pattern,
 {
        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`",
index 6ef0bf6e327ef809a3d51664e7507110b1a0a396..d2ad04b0ce7a98a4b734ac3d83380f70ca7ed60e 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <string.h>
 
 #include <tap/tap.h>
@@ -180,12 +179,12 @@ static void test_uri_parsing(void)
        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)
@@ -199,35 +198,35 @@ 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);
 
index 1fc74fc33289d2776c9b07982bf86f1851f286a4..95c6fe12da691ffd8fb153d644652511eaff92bc 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 0cb7b23872908e2b0305db0144a26d75f9159464..2581f57dda1480bb04bc16238049b9f2750c3dd4 100644 (file)
@@ -9,7 +9,6 @@
  *
  */
 
-#include <assert.h>
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
@@ -280,7 +279,7 @@ static void test_active_set_combinations(unsigned int fd_count)
        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);
index d7e7f2b054fb067570ca77543b94ed1405194b11..a55d7cf38dad8ab99a58ec47e1ddaa0e4ef30c87 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
index 4340a69ec639266d96d0bdf1655a9db077d903c5..04f2fffe1ea0cfad74def9db809eec1075e8c74f 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <string.h>
 #include <stdio.h>
 
index 6a1c3280bc4f48fa2ff9bd357db4396b34bfd222..95aac5561d13edca8091359357c723c24db6a9d7 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <string.h>
 #include <stdio.h>
 #include <inttypes.h>
index 57c33f59728125fef76b1e79a58d978ba479d5e5..cf8819977dc79d83596b1da1d31a746d6b271cb9 100644 (file)
@@ -7,7 +7,6 @@
 
 #define _LGPL_SOURCE
 #include <getopt.h>
-#include <assert.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <stdarg.h>
index 8f74a90daf45728d0bd2f24cb17a8e6ddcce5224..f0f6cc63c372465363bda2b453c466d810580f3f 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #define _LGPL_SOURCE
-#include <assert.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -18,6 +17,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <common/macros.h>
 #include <lttng/tracef.h>
 #include "signal-helper.h"
 
@@ -28,7 +28,7 @@ void create_file(const char *path)
 {
        int ret;
 
-       assert(path);
+       LTTNG_ASSERT(path);
 
        ret = creat(path, S_IRWXU);
        if (ret < 0) {
index d54c6cc99e668965d23349dc40ec11194cf41023..fee74e961245d02e0322f70c86c9e7d21e33cd43 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <assert.h>
 #include <common/compat/time.h>
 #include <common/time.h>
 #include <fcntl.h>
@@ -19,6 +18,7 @@
 #include <unistd.h>
 
 #include <common/compat/errno.h>
+#include <common/macros.h>
 
 #include "utils.h"
 
@@ -27,7 +27,7 @@ int64_t elapsed_time_ns(struct timespec *t1, struct timespec *t2)
 {
        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) +
index 32c57e60a93c3f462069623f994ae2056ecf8e14..011f38f4a65c17d36464ffc4697864c66410fc05 100644 (file)
@@ -24,7 +24,6 @@
  *     node;b;
  *     node;c;
  */
-#include <assert.h>
 #include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -59,11 +58,11 @@ static int print_xpath_nodes(xmlDocPtr doc, xmlNodeSetPtr nodes, FILE *output)
        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",
@@ -170,8 +169,8 @@ static int extract_xpath(const char *xml_path, const xmlChar *xpath)
        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);
index eafe8b779915ec5852fa00685104fbd757a04e1c..bb67e56e17edea75706b56c50ec072c49f2433be 100644 (file)
@@ -11,7 +11,6 @@
   * argv[2] Path to the XML to be validated
   */
 
-#include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -26,6 +25,7 @@
 #include <libxml/parser.h>
 
 #include <lttng/lttng-error.h>
+#include <common/macros.h>
 
 struct validation_ctx {
        xmlSchemaParserCtxtPtr parser_ctx;
@@ -124,8 +124,8 @@ static int validate_xml(const char *xml_file_path, struct validation_ctx *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);
This page took 0.398325 seconds and 4 git commands to generate.