X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=include%2Fusterr.h;h=dc151b0aae2002504422d705966416fe5868f619;hb=refs%2Fheads%2Fstable-2.2;hp=820d4f03d9bd062524a060556ce99398ff2da1cb;hpb=4318ae1be57eb7983ab4857a7a8eeb4a030a8216;p=lttng-ust.git diff --git a/include/usterr.h b/include/usterr.h index 820d4f03..dc151b0a 100644 --- a/include/usterr.h +++ b/include/usterr.h @@ -22,13 +22,12 @@ #include #include -#include #include #include #include -#include -#include "lttng/share.h" +#include "lttng/ust-tid.h" +#include "share.h" enum ust_loglevel { UST_LOGLEVEL_UNKNOWN = 0, @@ -58,12 +57,12 @@ static inline int ust_debug(void) do { \ fprintf(stderr, UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" XSTR(__LINE__) ")\n", \ (long) getpid(), \ - (long) syscall(SYS_gettid), \ + (long) gettid(), \ ## args, \ __func__); \ } while(0) -#ifdef UST_DEBUG +#ifdef LTTNG_UST_DEBUG # define DBG(fmt, args...) ERRMSG(fmt, ## args) # define DBG_raw(fmt, args...) \ do { \ @@ -87,7 +86,10 @@ static inline int ust_debug(void) #define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args) #define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args) -#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE) +#if !defined(__linux__) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)) +/* + * Version using XSI strerror_r. + */ #define PERROR(call, args...)\ do { \ char buf[200] = "Error in strerror_r()"; \ @@ -95,6 +97,9 @@ static inline int ust_debug(void) ERRMSG("Error: " call ": %s", ## args, buf); \ } while(0); #else +/* + * Version using GNU strerror_r, for linux with appropriate defines. + */ #define PERROR(call, args...)\ do { \ char *buf; \