X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=include%2Fust%2Fcore.h;h=8c1c490eedde18b0615741ee1ec1a9773c0589ab;hb=14641debd03ba299bd06040cb62e0dbdef7fac81;hp=eee405dd4c27a46d743eecb625daaed5c144f065;hpb=4b4de73e56cad17f87de69bd9386389ed69c0a12;p=lttng-ust.git diff --git a/include/ust/core.h b/include/ust/core.h index eee405dd..8c1c490e 100644 --- a/include/ust/core.h +++ b/include/ust/core.h @@ -82,7 +82,25 @@ static inline long IS_ERR(const void *ptr) /* MALLOCATION */ -#define zmalloc(s) calloc(1, s) +#include + +static inline +void *zmalloc(size_t len) +{ + return calloc(1, len); +} + +static inline +void *malloc_align(size_t len) +{ + return malloc(ALIGN(len, CAA_CACHE_LINE_SIZE)); +} + +static inline +void *zmalloc_align(size_t len) +{ + return calloc(1, ALIGN(len, CAA_CACHE_LINE_SIZE)); +} /* MATH */ @@ -110,4 +128,12 @@ static __inline__ int get_count_order(unsigned int count) const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) +#ifndef inline_memcpy +#define inline_memcpy memcpy +#endif + +#ifndef __same_type +#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +#endif + #endif /* UST_CORE_H */