X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Fhelper.h;h=9873feadd85b020556c1cd1e4f45925094b1fdd1;hb=6c737d0594cac0d969e1948ea1ed55c15be9cec8;hp=8aeb772875820e597c50281f90770a1753e936dd;hpb=35897f8b2d311b756b81657dad9c53ef1c0fad8a;p=lttng-ust.git diff --git a/include/helper.h b/include/helper.h index 8aeb7728..9873fead 100644 --- a/include/helper.h +++ b/include/helper.h @@ -21,7 +21,7 @@ #include -static inline +static inline __attribute__((always_inline)) void *zmalloc(size_t len) { return calloc(len, 1); @@ -41,4 +41,18 @@ void *zmalloc(size_t len) __min1 <= __min2 ? __min1: __min2; \ }) +#define LTTNG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +/* + * Use of __builtin_return_address(0) sometimes seems to cause stack + * corruption on 32-bit PowerPC. Disable this feature on that + * architecture for now by always using the NULL value for the ip + * context. + */ +#if defined(__PPC__) && !defined(__PPC64__) +#define LTTNG_UST_CALLER_IP() NULL +#else /* #if defined(__PPC__) && !defined(__PPC64__) */ +#define LTTNG_UST_CALLER_IP() __builtin_return_address(0) +#endif /* #else #if defined(__PPC__) && !defined(__PPC64__) */ + #endif /* _LTTNG_UST_HELPER_H */