From: Mathieu Desnoyers Date: Wed, 25 Nov 2020 20:50:16 +0000 (-0500) Subject: Introduce limits wrapper X-Git-Tag: v2.13.0-rc1~82 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=236233f79b01cd3d9f7717650a46bda8c0d7ab85;p=lttng-modules.git Introduce limits wrapper Older kernels (v3.13.11 and older on the CI) miss the U32_MAX macro. Implement them in a wrapper. Signed-off-by: Mathieu Desnoyers --- diff --git a/include/counter/counter-api.h b/include/counter/counter-api.h index f2829fc5..827fb6f8 100644 --- a/include/counter/counter-api.h +++ b/include/counter/counter-api.h @@ -15,6 +15,7 @@ #include #include #include +#include /* * Using unsigned arithmetic because overflow is defined. diff --git a/include/wrapper/limits.h b/include/wrapper/limits.h new file mode 100644 index 00000000..832c2f7f --- /dev/null +++ b/include/wrapper/limits.h @@ -0,0 +1,60 @@ +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * + * wrapper/limits.h + * + * Copyright (C) 2020 Mathieu Desnoyers + */ + +#ifndef _LTTNG_WRAPPER_LIMITS_H +#define _LTTNG_WRAPPER_LIMITS_H + +#include + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif +#ifndef PHYS_ADDR_MAX +#define PHYS_ADDR_MAX (~(phys_addr_t)0) +#endif + +#ifndef U8_MAX +#define U8_MAX ((u8)~0U) +#endif +#ifndef S8_MAX +#define S8_MAX ((s8)(U8_MAX >> 1)) +#endif +#ifndef S8_MIN +#define S8_MIN ((s8)(-S8_MAX - 1)) +#endif +#ifndef U16_MAX +#define U16_MAX ((u16)~0U) +#endif +#ifndef S16_MAX +#define S16_MAX ((s16)(U16_MAX >> 1)) +#endif +#ifndef S16_MIN +#define S16_MIN ((s16)(-S16_MAX - 1)) +#endif +#ifndef U32_MAX +#define U32_MAX ((u32)~0U) +#endif +#ifndef U32_MIN +#define U32_MIN ((u32)0) +#endif +#ifndef S32_MAX +#define S32_MAX ((s32)(U32_MAX >> 1)) +#endif +#ifndef S32_MIN +#define S32_MIN ((s32)(-S32_MAX - 1)) +#endif +#ifndef U64_MAX +#define U64_MAX ((u64)~0ULL) +#endif +#ifndef S64_MAX +#define S64_MAX ((s64)(U64_MAX >> 1)) +#endif +#ifndef S64_MIN +#define S64_MIN ((s64)(-S64_MAX - 1)) +#endif + +#endif /* _LTTNG_WRAPPER_COMPILER_H */ diff --git a/src/lttng-ring-buffer-event-notifier-client.h b/src/lttng-ring-buffer-event-notifier-client.h index a857c8f7..b5e91c55 100644 --- a/src/lttng-ring-buffer-event-notifier-client.h +++ b/src/lttng-ring-buffer-event-notifier-client.h @@ -14,6 +14,7 @@ #include #include #include +#include static struct lttng_transport lttng_relay_transport;