#ifndef _ERROR_H
#define _ERROR_H
-#include <errno.h>
+#include <common/compat/errno.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <lttng/lttng-error.h>
#include <common/compat/tid.h>
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
/* Avoid conflict with Solaris <sys/regset.h> */
#if defined(ERR) && defined(__sun__)
#undef ERR
/* Format: 00:00:00.000000000 plus NULL byte. */
char str[19];
};
-extern DECLARE_URCU_TLS(struct log_time, error_log_time);
+extern LTTNG_EXPORT DECLARE_URCU_TLS(struct log_time, error_log_time);
extern DECLARE_URCU_TLS(const char *, logger_thread_name);
extern int lttng_opt_quiet;
DBG3(fmt, ## args); \
break; \
default: \
- assert(0); \
+ abort(); \
} \
} while(0);
/*
* Version using XSI strerror_r.
*/
-#define PERROR(call, args...) \
- do { \
- char buf[200]; \
- strerror_r(errno, buf, sizeof(buf)); \
- _PERROR(call ": %s", ## args, buf); \
- } while(0);
+#define PERROR(call, args...) \
+ do { \
+ char _perror_buf[200]; \
+ strerror_r(errno, _perror_buf, sizeof(_perror_buf)); \
+ _PERROR(call ": %s", ##args, _perror_buf); \
+ } while (0);
#else
/*
* Version using GNU strerror_r, for linux with appropriate defines.
*/
-#define PERROR(call, args...) \
- do { \
- char *buf; \
- char tmp[200]; \
- buf = strerror_r(errno, tmp, sizeof(tmp)); \
- _PERROR(call ": %s", ## args, buf); \
- } while(0);
+#define PERROR(call, args...) \
+ do { \
+ char *_perror_buf; \
+ char _perror_tmp[200]; \
+ _perror_buf = strerror_r( \
+ errno, _perror_tmp, sizeof(_perror_tmp)); \
+ _PERROR(call ": %s", ##args, _perror_buf); \
+ } while (0);
#endif
const char *error_get_str(int32_t code);
const char *log_add_time(void);
/* Name must be a statically-allocated string. */
-LTTNG_HIDDEN
void logger_set_thread_name(const char *name, bool set_pthread_name);
+#if defined(__cplusplus)
+}
+#endif
+
#endif /* _ERROR_H */