Module: check_mk
Branch: master
Commit: f2e47d7b9369aec61969a77d45c16fb0bc644ea7
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2e47d7b9369ae…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Sep 8 15:23:34 2017 +0200
Some localtime_s/localtime_r Kung Fu, level: Black belt :-P
Change-Id: Ib9735c0b466baa384e8f06285748d3cff4a2560e
---
configure.ac | 8 ++++++++
livestatus/src/ChronoUtils.h | 25 ++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index d00f144..44ef454 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,6 +164,14 @@ AC_DEFINE([_GLIBCXX_REGEX_STATE_LIMIT], [2500],
AC_DEFINE([BOOST_SYSTEM_NO_DEPRECATED], [1], [we do not want any old stuff])
+# GCC is a bit picky about redefinitions of built-in macros. Alas, "built-in"
+# simply means "starts with double underscore", so we have to hack around that
+# below. Note that clang is happy, even without the guard.
+AH_VERBATIM([__STDC_WANT_LIB_EXT1__], [/* we want C11 library extensions */
+#ifndef __STDC_WANT_LIB_EXT1__
+# define __STDC_WANT_LIB_EXT1__ 1
+#endif])
+
# HACKING ALERT: automake can't really handle optional subdirectories, so we
# have to do this in a slightly hacky way by using M4's silent includes.
m4_sinclude([livestatus/config_files.m4])
diff --git a/livestatus/src/ChronoUtils.h b/livestatus/src/ChronoUtils.h
index 5399b37..a55d22d 100644
--- a/livestatus/src/ChronoUtils.h
+++ b/livestatus/src/ChronoUtils.h
@@ -26,7 +26,7 @@
#define ChronoUtils_h
#include "config.h" // IWYU pragma: keep
-#include <sys/time.h>
+#include <time.h>
#include <chrono>
#include <cstdlib>
#include <ctime>
@@ -46,7 +46,30 @@ inline double elapsed_ms_since(std::chrono::steady_clock::time_point then) {
inline tm to_tm(std::chrono::system_clock::time_point tp) {
time_t t = std::chrono::system_clock::to_time_t(tp);
struct tm ret;
+ // NOTE: A brilliant example of how to make a simple API function a total
+ // chaos follows...
+#if defined(__STDC_LIB_EXT1__)
+ // C11 function, only guaranteed to be available when a
+ // #define __STDC_WANT_LIB_EXT1_ 1
+ // is done before including <time.h>. Signature:
+ // struct tm *localtime_s(const time_t *restrict timer,
+ // struct tm *restrict result)
+ localtime_s(&t, &ret);
+#elif defined(__WIN32)
+ // Win32 variant, it keeps us entertained with swapped parameters and a
+ // different return value, yay! Signature:
+ // errno_t localtime_s(struct tm* _tm, const time_t *time)
+ // We have to de-confuse cppcheck:
+ // cppcheck-suppress uninitvar
+ localtime_s(&ret, &t);
+#else
+ // POSIX.1-2008 variant, available under MinGW64 only under obscure
+ // circumstances, so better avoid it there. Signature:
+ // struct tm *localtime(const time_t *timer)
localtime_r(&t, &ret);
+#endif
+ // Reason: see Win32 section above
+ // cppcheck-suppress uninitvar
return ret;
}
Module: check_mk
Branch: master
Commit: ed834df0c78fa6e198594cee35566e6ebe76c6e9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ed834df0c78fa6…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 8 13:00:13 2017 +0200
5202 FIX Fixed timeouts when generating reports (regression in #4957)
When creating PDF reports that contain grouped view elements, these
reports were rendering too many data. In case of larger reports with
a lot of graphs, this could lead to timeouts resulting in "Proxy Errors"
messages in the GUI.
This issue was introduced with werk 4957 since Check_MK 1.4.0p9.
Change-Id: I0cb632c1c0cc273da8f2f61ff51300def1c5c797
---
.werks/5202 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/.werks/5202 b/.werks/5202
new file mode 100644
index 0000000..74e5d1c
--- /dev/null
+++ b/.werks/5202
@@ -0,0 +1,15 @@
+Title: Fixed timeouts when generating reports (regression in #4957)
+Level: 2
+Component: reporting
+Compatible: compat
+Edition: cee
+Version: 1.5.0i1
+Date: 1504868229
+Class: fix
+
+When creating PDF reports that contain grouped view elements, these
+reports were rendering too many data. In case of larger reports with
+a lot of graphs, this could lead to timeouts resulting in "Proxy Errors"
+messages in the GUI.
+
+This issue was introduced with werk 4957 since Check_MK 1.4.0p9.
Module: check_mk
Branch: master
Commit: 857018cac156862e9fcaa7310be2477754b05cc9
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=857018cac15686…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Sep 8 11:04:40 2017 +0200
More cross-compiler tweaks.
Change-Id: I303ba27a20723749d8f9eb6f9a11f57aa5947cb1
---
livestatus/src/ChronoUtils.h | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/livestatus/src/ChronoUtils.h b/livestatus/src/ChronoUtils.h
index da53b07..5399b37 100644
--- a/livestatus/src/ChronoUtils.h
+++ b/livestatus/src/ChronoUtils.h
@@ -58,6 +58,11 @@ template <typename Rep, typename Period>
inline timeval to_timeval(std::chrono::duration<Rep, Period> dur) {
using namespace std::chrono;
timeval tv;
+ // NOTE: The static_casts below are needed to avoid warning on e.g. some
+ // 32bit platforms, because the underlying types might be larger than the
+ // timeval fields. We can't use the correct POSIX types time_t and
+ // suseconds_t because of the broken MinGW cross compiler, so we revert to
+ // decltype.
tv.tv_sec =
static_cast<decltype(tv.tv_sec)>(duration_cast<seconds>(dur).count());
tv.tv_usec = static_cast<decltype(tv.tv_usec)>(
@@ -85,9 +90,9 @@ typename Dur::rep time_point_part(std::chrono::system_clock::time_point &tp) {
class FormattedTimePoint {
public:
FormattedTimePoint(std::chrono::system_clock::time_point tp,
- const std::string &format = "%F %T")
+ const std::string &format = default_format)
: _tp(tp), _format(format) {}
- FormattedTimePoint(time_t t, const std::string &format = "%F %T")
+ FormattedTimePoint(time_t t, const std::string &format = default_format)
: _tp(std::chrono::system_clock::from_time_t(t)), _format(format) {}
friend std::ostream &operator<<(std::ostream &os,
@@ -99,6 +104,13 @@ public:
private:
std::chrono::system_clock::time_point _tp;
std::string _format;
+
+ // NOTE: In a perfect world we would simply use "%F %T" below, but the "%F"
+ // format is a C99 addition, and the "%T" format is part of The Single Unix
+ // Specification. Both formats should be available in any C++11-compliant
+ // compiler, but the MinGW cross compiler doesn't get this right. So let's
+ // use their ancient expansions...
+ static constexpr auto default_format = "%Y-%m-%d %H:%M:%S";
};
#endif // ChronoUtils_h