X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Fusterr-signal-safe.h;h=474bc3c77116dab1c4419adb5b240a3fcfe6211c;hb=167ff4df850ed5c954ee374db66a04b1c9a4ef34;hp=375eff7c569b63d5794a6cc7932de4da81548499;hpb=aab17bfec51be0eb306ff1197a38d8acc5e877a3;p=lttng-ust.git diff --git a/include/usterr-signal-safe.h b/include/usterr-signal-safe.h index 375eff7c..474bc3c7 100644 --- a/include/usterr-signal-safe.h +++ b/include/usterr-signal-safe.h @@ -22,12 +22,11 @@ #include #include -#include #include #include #include - #include +#include "lttng/ust-tid.h" enum ust_loglevel { UST_LOGLEVEL_UNKNOWN = 0, @@ -85,7 +84,7 @@ do { \ do { \ sigsafe_print_err(UST_STR_COMPONENT "[%ld/%ld]: " fmt " (in %s() at " __FILE__ ":" UST_XSTR(__LINE__) ")\n", \ (long) getpid(), \ - (long) syscall(SYS_gettid), \ + (long) gettid(), \ ## args, __func__); \ fflush(stderr); \ } while(0) @@ -115,7 +114,10 @@ do { \ #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()"; \ @@ -123,6 +125,9 @@ do { \ 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; \