From: Mathieu Desnoyers Date: Tue, 21 Feb 2012 02:54:04 +0000 (-0500) Subject: Use XSI-compliant strerror_r by default on non-Linux X-Git-Tag: v2.1.0-rc1~97^2~29 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9fd26814e5df6e255491f6f05fec2faa84157571;p=lttng-ust.git Use XSI-compliant strerror_r by default on non-Linux Signed-off-by: Mathieu Desnoyers --- diff --git a/include/usterr-signal-safe.h b/include/usterr-signal-safe.h index d46b0f6a..8e2c1cd2 100644 --- a/include/usterr-signal-safe.h +++ b/include/usterr-signal-safe.h @@ -115,7 +115,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 +126,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; \ diff --git a/include/usterr.h b/include/usterr.h index 86c9bf86..c25348d7 100644 --- a/include/usterr.h +++ b/include/usterr.h @@ -87,7 +87,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 +98,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; \