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-Url: http://git.lttng.org/?p=lttng-ust.git;a=commitdiff_plain;h=fb8c8e5f461451afac00246d01d4bccc1c9b968a Use XSI-compliant strerror_r by default on non-Linux commit 9fd26814e5df6e255491f6f05fec2faa84157571 upstream. Signed-off-by: Mathieu Desnoyers Signed-off-by: Christian Babeux --- 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; \