From: Willy Tarreau Date: Mon, 20 May 2019 18:18:26 +0000 (+0200) Subject: MINOR: compat: make sure to always define clockid_t X-Git-Tag: v2.0-dev4~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b81939cef01f09061ab07fef08d2fef0f60b1584;p=thirdparty%2Fhaproxy.git MINOR: compat: make sure to always define clockid_t In order to ease the internal time API, we'll have the threads time always present even when threads are disabled. Let's make sure clockid_t, and the minimum clock times are defined even on older or non-compatible systems. --- diff --git a/include/common/compat.h b/include/common/compat.h index 34d1b35c59..d43b89dd61 100644 --- a/include/common/compat.h +++ b/include/common/compat.h @@ -23,6 +23,8 @@ #define _COMMON_COMPAT_H #include +#include +#include /* This is needed on Linux for Netfilter includes */ #include #include @@ -96,6 +98,17 @@ #define F_SETPIPE_SZ (1024 + 7) #endif +/* systems without such defines do not know clockid_t */ +#if !defined(_POSIX_TIMERS) || (_POSIX_C_SOURCE < 199309L) +#define clockid_t int +#undef CLOCK_REALTIME +#undef CLOCK_MONOTONIC +#undef CLOCK_THREAD_CPUTIME_ID +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 1 +#define CLOCK_THREAD_CPUTIME_ID 2 +#endif + #if defined(TPROXY) && defined(NETFILTER) #include #include