2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 #ifndef _UST_COMMON_MACROS_H
8 #define _UST_COMMON_MACROS_H
14 #include <lttng/ust-arch.h>
17 * calloc() does not always populate the page table for the allocated
18 * memory. Optionally enforce page table populate.
21 void *zmalloc_populate(size_t len
, bool populate
)
22 __attribute__((always_inline
));
24 void *zmalloc_populate(size_t len
, bool populate
)
27 void *ret
= malloc(len
);
33 return calloc(len
, 1);
38 * Memory allocation zeroed
41 void *zmalloc(size_t len
)
42 __attribute__((always_inline
));
44 void *zmalloc(size_t len
)
46 return zmalloc_populate(len
, false);
49 #define max_t(type, x, y) \
53 __max1 > __max2 ? __max1: __max2; \
56 #define min_t(type, x, y) \
60 __min1 <= __min2 ? __min1: __min2; \
63 #define LTTNG_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
66 * Use of __builtin_return_address(0) sometimes seems to cause stack
67 * corruption on 32-bit PowerPC. Disable this feature on that
68 * architecture for now by always using the NULL value for the ip
71 #if defined(LTTNG_UST_ARCH_PPC) && !defined(LTTNG_UST_ARCH_PPC64)
72 #define LTTNG_UST_CALLER_IP() NULL
74 #define LTTNG_UST_CALLER_IP() __builtin_return_address(0)
77 #endif /* _UST_COMMON_MACROS_H */
This page took 0.033572 seconds and 4 git commands to generate.