Rename internal ust_err to lttng_ust_logging
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 6 Apr 2021 19:56:58 +0000 (15:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 13 Apr 2021 18:22:38 +0000 (14:22 -0400)
This is an internal rename to reduce confusion with the public
ust-error.h API and better describe the functionality.

Change-Id: Ifc692c724ebd7b7bd4ad234fa92b95f50d724f5a
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/logging.c
src/common/logging.h
src/lib/lttng-ust-ctl/ustctl.c
src/lib/lttng-ust-dl/lttng-ust-dl.c
src/lib/lttng-ust/lttng-ust-comm.c
src/lib/lttng-ust/tracepoint.c
src/lib/lttng-ust/ust-common.c

index 9841c68dbdc286be2d4c508b005eb4c4054fd477..eb610833676d46519cd7e7437e36d00df3f84654 100644 (file)
@@ -6,22 +6,22 @@
 
 #include "common/logging.h"
 
-volatile enum ust_err_loglevel ust_err_loglevel;
+volatile enum lttng_ust_log_level lttng_ust_log_level;
 
-void ust_err_init(void)
+void lttng_ust_logging_init(void)
 {
-       char *ust_debug;
+       char *lttng_ust_debug;
 
-       if (ust_err_loglevel == UST_ERR_LOGLEVEL_UNKNOWN) {
+       if (lttng_ust_log_level == LTTNG_UST_LOG_LEVEL_UNKNOWN) {
                /*
                 * This getenv is not part of lttng_ust_getenv() because it
                 * is required to print ERR() performed during getenv
                 * initialization.
                 */
-               ust_debug = getenv("LTTNG_UST_DEBUG");
-               if (ust_debug)
-                       ust_err_loglevel = UST_ERR_LOGLEVEL_DEBUG;
+               lttng_ust_debug = getenv("LTTNG_UST_DEBUG");
+               if (lttng_ust_debug)
+                       lttng_ust_log_level = LTTNG_UST_LOG_LEVEL_DEBUG;
                else
-                       ust_err_loglevel = UST_ERR_LOGLEVEL_NORMAL;
+                       lttng_ust_log_level = LTTNG_UST_LOG_LEVEL_NORMAL;
        }
 }
index 4001c8852b90aabde67035d942506697ed321336..ab125e7c3dfc139d987e8a2d4192e18fe5de05cd 100644 (file)
@@ -5,8 +5,8 @@
  * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  */
 
-#ifndef _USTERR_SIGNAL_SAFE_H
-#define _USTERR_SIGNAL_SAFE_H
+#ifndef _UST_COMMON_LOGGING_H
+#define _UST_COMMON_LOGGING_H
 
 #include <string.h>
 #include <sys/types.h>
 #include <stdarg.h>
 #include <stdbool.h>
 #include <stdio.h>
+
+#include <lttng/ust-utils.h>
+
 #include "common/patient.h"
 #include "common/compat/tid.h"
 #include "common/safe-snprintf.h"
 
-enum ust_err_loglevel {
-       UST_ERR_LOGLEVEL_UNKNOWN = 0,
-       UST_ERR_LOGLEVEL_NORMAL,
-       UST_ERR_LOGLEVEL_DEBUG,
+enum lttng_ust_log_level {
+       LTTNG_UST_LOG_LEVEL_UNKNOWN = 0,
+       LTTNG_UST_LOG_LEVEL_NORMAL,
+       LTTNG_UST_LOG_LEVEL_DEBUG,
 };
 
-extern volatile enum ust_err_loglevel ust_err_loglevel
+extern volatile enum lttng_ust_log_level lttng_ust_log_level
        __attribute__((visibility("hidden")));
 
-void ust_err_init(void)
+void lttng_ust_logging_init(void)
        __attribute__((visibility("hidden")));
 
 #ifdef LTTNG_UST_DEBUG
-static inline bool ust_err_debug_enabled(void)
+static inline bool lttng_ust_logging_debug_enabled(void)
 {
        return true;
 }
 #else /* #ifdef LTTNG_UST_DEBUG */
-static inline bool ust_err_debug_enabled(void)
+static inline bool lttng_ust_logging_debug_enabled(void)
 {
-       return ust_err_loglevel == UST_ERR_LOGLEVEL_DEBUG;
+       return lttng_ust_log_level == LTTNG_UST_LOG_LEVEL_DEBUG;
 }
 #endif /* #else #ifdef LTTNG_UST_DEBUG */
 
@@ -49,22 +52,18 @@ static inline bool ust_err_debug_enabled(void)
 #define UST_COMPONENT libust
 #endif
 
-/* To stringify the expansion of a define */
-#define UST_XSTR(d) UST_STR(d)
-#define UST_STR(s) #s
-
-#define UST_ERR_MAX_LEN        512
+#define LTTNG_UST_LOG_MAX_LEN  512
 
 /*
  * We sometimes print in the tracing path, and tracing can occur in
  * signal handlers, so we must use a print method which is signal safe.
  */
-/* Can't use dynamic allocation. Limit ourselves to UST_ERR_MAX_LEN chars. */
+/* Can't use dynamic allocation. Limit ourselves to LTTNG_UST_LOG_MAX_LEN chars. */
 /* Add end of string in case of buffer overflow. */
 #define sigsafe_print_err(fmt, args...)                                        \
 do {                                                                   \
-       if (ust_err_debug_enabled()) {                                  \
-               char ____buf[UST_ERR_MAX_LEN];                          \
+       if (lttng_ust_logging_debug_enabled()) {                        \
+               char ____buf[LTTNG_UST_LOG_MAX_LEN];                    \
                int ____saved_errno;                                    \
                                                                        \
                ____saved_errno = errno;        /* signal-safety */     \
@@ -76,11 +75,11 @@ do {                                                                        \
        }                                                               \
 } while (0)
 
-#define UST_STR_COMPONENT UST_XSTR(UST_COMPONENT)
+#define LTTNG_UST_STR_COMPONENT lttng_ust_stringify(UST_COMPONENT)
 
 #define ERRMSG(fmt, args...)                   \
        do {                                    \
-               sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" UST_XSTR(__LINE__) ")\n", \
+               sigsafe_print_err(LTTNG_UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" lttng_ust_stringify(__LINE__) ")\n", \
                (long) getpid(),                \
                (long) lttng_gettid(),          \
                ## args, __func__);             \
@@ -99,7 +98,7 @@ do {                                                                  \
  */
 #define PERROR(call, args...)                                          \
        do {                                                            \
-               if (ust_err_debug_enabled()) {                          \
+               if (lttng_ust_logging_debug_enabled()) {                \
                        char perror_buf[200] = "Error in strerror_r()"; \
                        strerror_r(errno, perror_buf,                   \
                                        sizeof(perror_buf));            \
@@ -113,7 +112,7 @@ do {                                                                        \
  */
 #define PERROR(call, args...)                                          \
        do {                                                            \
-               if (ust_err_debug_enabled()) {                          \
+               if (lttng_ust_logging_debug_enabled()) {                \
                        char *perror_buf;                               \
                        char perror_tmp[200];                           \
                        perror_buf = strerror_r(errno, perror_tmp,      \
@@ -136,4 +135,4 @@ do {                                                                        \
        } while(0)
 #define WARN_ON_ONCE(condition) WARN_ON(condition)
 
-#endif /* _USTERR_SIGNAL_SAFE_H */
+#endif /* _UST_COMMON_LOGGING_H */
index 725506532c599f574c2681421639fda8bfab892c..076c92f8ee065da1fb0bd3950522b6f81dbdaa85 100644 (file)
@@ -2906,8 +2906,8 @@ void ustctl_init(void)
 static
 void ustctl_init(void)
 {
-       ust_err_init();
-       lttng_ust_getenv_init();        /* Needs ust_err_init() to be completed. */
+       lttng_ust_logging_init();
+       lttng_ust_getenv_init();        /* Needs lttng_ust_logging_init() to be completed. */
        lttng_ust_clock_init();
        lttng_ust_ring_buffer_clients_init();
        lttng_ust_counter_clients_init();
index 82cb07f0101a6ca6c80cd0d9c1296526df95bf27..42e8ec3c02722a95ee142ee501579b9e25d20f15 100644 (file)
@@ -43,7 +43,7 @@ void _lttng_ust_dl_init(void)
 static
 void _lttng_ust_dl_init(void)
 {
-       ust_err_init();
+       lttng_ust_logging_init();
 }
 
 static
index 15cb555028d979ff656ddbcf9e3c66e98f190c10..995c78ff21b32c2c9043e8aa2a2c51cea72cb870 100644 (file)
@@ -1727,7 +1727,7 @@ void wait_for_sessiond(struct sock_info *sock_info)
 "Please upgrade your kernel "
 "(fix is commit 9ea71503a8ed9184d2d0b8ccc4d269d05f7940ae in Linux kernel "
 "mainline). LTTng-UST will use polling mode fallback.");
-                       if (ust_err_debug_enabled())
+                       if (lttng_ust_logging_debug_enabled())
                                PERROR("futex");
                        goto end_wait;
                }
@@ -2120,8 +2120,8 @@ void lttng_ust_init(void)
         * sessiond (otherwise leading to errors when trying to create
         * sessiond before the init functions are completed).
         */
-       ust_err_init();
-       lttng_ust_getenv_init();        /* Needs ust_err_init() to be completed. */
+       lttng_ust_logging_init();
+       lttng_ust_getenv_init();        /* Needs lttng_ust_logging_init() to be completed. */
        lttng_ust_tp_init();
        lttng_ust_init_fd_tracker();
        lttng_ust_clock_init();
index e5a970adc19207f1a81ea92c2d8d52fe5c56a2e4..7042339b0139b826b80f9d3e671f931b5b433d72 100644 (file)
@@ -894,7 +894,7 @@ lib_added:
 
        DBG("just registered a tracepoints section from %p and having %d tracepoints",
                tracepoints_start, tracepoints_count);
-       if (ust_err_debug_enabled()) {
+       if (lttng_ust_logging_debug_enabled()) {
                int i;
 
                for (i = 0; i < tracepoints_count; i++) {
@@ -958,7 +958,7 @@ void lttng_ust_tp_init(void)
 {
        if (uatomic_xchg(&initialized, 1) == 1)
                return;
-       ust_err_init();
+       lttng_ust_logging_init();
        check_weak_hidden();
 }
 
index ad52770af3ed82e50305f2ed338909c0e6e12b8e..036c1e288af9ee09ef6510bab12f6a86a145719f 100644 (file)
@@ -14,7 +14,7 @@ static
 void lttng_ust_common_init(void)
 {
        /* Initialize logging for liblttng-ust-common */
-       ust_err_init();
+       lttng_ust_logging_init();
 
        /*
         * Initialize the fd-tracker, other libraries using it should also call
This page took 0.030344 seconds and 4 git commands to generate.