ENVIRONMENT VARIABLES
---------------------
+`LTTNG_ABORT_ON_ERROR`::
+ Set to 1 to abort the process after the first error is encountered.
+
`LTTNG_HOME`::
Overrides the `$HOME` environment variable. Useful when the user
running the commands has a non-writable home directory.
ENVIRONMENT VARIABLES
---------------------
+`LTTNG_ABORT_ON_ERROR`::
+ Set to 1 to abort the process after the first error is encountered.
+
`LTTNG_NETWORK_SOCKET_TIMEOUT`::
Socket connection, receive and send timeout (milliseconds). A value
of 0 or -1 uses the timeout of the operating system (default).
Note that command-line options override their equivalent environment
variable.
+`LTTNG_ABORT_ON_ERROR`::
+ Set to 1 to abort the process after the first error is encountered.
+
`LTTNG_APP_SOCKET_TIMEOUT`::
Application socket's timeout (seconds) when sending/receiving
commands. After this period of time, the application is unregistered
#define _LGPL_SOURCE
#include <assert.h>
#include <inttypes.h>
+#include <stdlib.h>
+#include <string.h>
#include <lttng/lttng-error.h>
#include <common/common.h>
+#include <common/compat/getenv.h>
#include "error.h"
#define ERROR_INDEX(code) (code - LTTNG_OK)
+/*
+ * lttng_opt_abort_on_error: unset: -1, disabled: 0, enabled: 1.
+ * Controlled by the LTTNG_ABORT_ON_ERROR environment variable.
+ */
+static int lttng_opt_abort_on_error = -1;
+
/* TLS variable that contains the time of one single log entry. */
DEFINE_URCU_TLS(struct log_time, error_log_time);
return error_string_array[ERROR_INDEX(code)];
}
+
+LTTNG_HIDDEN
+void lttng_abort_on_error(void)
+{
+ if (lttng_opt_abort_on_error < 0) {
+ /* Use lttng_secure_getenv() to query its state. */
+ const char *value;
+
+ value = lttng_secure_getenv("LTTNG_ABORT_ON_ERROR");
+ if (value && !strcmp(value, "1")) {
+ lttng_opt_abort_on_error = 1;
+ } else {
+ lttng_opt_abort_on_error = 0;
+ }
+ }
+ if (lttng_opt_abort_on_error > 0) {
+ abort();
+ }
+}
((type) & (PRINT_WARN | PRINT_ERR | PRINT_BUG))) { \
fprintf(stderr, fmt, ## args); \
} \
+ if ((type) & (PRINT_ERR | PRINT_BUG)) { \
+ lttng_abort_on_error(); \
+ } \
} while (0);
/* Three level of debug. Use -v, -vv or -vvv for the levels */
*/
const char *log_add_time();
+void lttng_abort_on_error(void);
+
#endif /* _ERROR_H */