nixpkgs/pkgs/servers/foundationdb/patches/include-fixes-6.0.patch
Masanori Ogino cd98de0816 foundationdb60: fix build
- Add missing #include, mainly <cmath>
- Add missing 'std::'
- Remove prototype conflicting with the libc's definition

Signed-off-by: Masanori Ogino <167209+omasanori@users.noreply.github.com>
2021-02-24 12:48:58 +09:00

137 lines
4.1 KiB
Diff

diff --git a/fdbrpc/ContinuousSample.h b/fdbrpc/ContinuousSample.h
index 54ff1b109..577c228ae 100644
--- a/fdbrpc/ContinuousSample.h
+++ b/fdbrpc/ContinuousSample.h
@@ -26,6 +26,7 @@
#include "flow/IRandom.h"
#include <vector>
#include <algorithm>
+#include <cmath>
template <class T>
class ContinuousSample {
diff --git a/fdbrpc/Smoother.h b/fdbrpc/Smoother.h
index 3ed8e6e98..f3e4504b6 100644
--- a/fdbrpc/Smoother.h
+++ b/fdbrpc/Smoother.h
@@ -23,6 +23,7 @@
#pragma once
#include "flow/flow.h"
+#include <cmath>
struct Smoother {
// Times (t) are expected to be nondecreasing
@@ -50,7 +51,7 @@ struct Smoother {
double elapsed = t - time;
if(elapsed) {
time = t;
- estimate += (total-estimate) * (1-exp( -elapsed/eFoldingTime ));
+ estimate += (total-estimate) * (1-std::exp( -elapsed/eFoldingTime ));
}
}
@@ -83,11 +84,11 @@ struct TimerSmoother {
void update(double t) {
double elapsed = t - time;
time = t;
- estimate += (total-estimate) * (1-exp( -elapsed/eFoldingTime ));
+ estimate += (total-estimate) * (1-std::exp( -elapsed/eFoldingTime ));
}
double eFoldingTime;
double time, total, estimate;
};
-#endif
\ No newline at end of file
+#endif
diff --git a/fdbserver/Knobs.cpp b/fdbserver/Knobs.cpp
index a924bc905..0dc70e7ac 100644
--- a/fdbserver/Knobs.cpp
+++ b/fdbserver/Knobs.cpp
@@ -20,6 +20,7 @@
#include "Knobs.h"
#include "fdbrpc/Locality.h"
+#include <cmath>
ServerKnobs const* SERVER_KNOBS = new ServerKnobs();
diff --git a/flow/Knobs.cpp b/flow/Knobs.cpp
index 2d706dddd..5dbe08861 100644
--- a/flow/Knobs.cpp
+++ b/flow/Knobs.cpp
@@ -20,6 +20,7 @@
#include "Knobs.h"
#include "flow/flow.h"
+#include <cmath>
FlowKnobs const* FLOW_KNOBS = new FlowKnobs();
@@ -128,7 +129,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
init( MAX_METRICS, 600 );
init( MAX_METRIC_SIZE, 2500 );
init( MAX_METRIC_LEVEL, 25 );
- init( METRIC_LEVEL_DIVISOR, log(4) );
+ init( METRIC_LEVEL_DIVISOR, std::log(4) );
init( METRIC_LIMIT_START_QUEUE_SIZE, 10 ); // The queue size at which to start restricting logging by disabling levels
init( METRIC_LIMIT_RESPONSE_FACTOR, 10 ); // The additional queue size at which to disable logging of another level (higher == less restrictive)
diff --git a/flow/Platform.cpp b/flow/Platform.cpp
index a754c8747..4d47fad32 100644
--- a/flow/Platform.cpp
+++ b/flow/Platform.cpp
@@ -98,6 +98,8 @@
#include <sys/resource.h>
/* Needed for crash handler */
#include <signal.h>
+/* Needed for major() and minor() with recent glibc */
+#include <sys/sysmacros.h>
#endif
#ifdef __APPLE__
diff --git a/flow/Profiler.actor.cpp b/flow/Profiler.actor.cpp
index 4603dcb77..78eda7278 100644
--- a/flow/Profiler.actor.cpp
+++ b/flow/Profiler.actor.cpp
@@ -35,8 +35,6 @@
extern volatile int profilingEnabled;
-static uint64_t gettid() { return syscall(__NR_gettid); }
-
struct SignalClosure {
void (* func)(int, siginfo_t*, void*, void*);
void *userdata;
diff --git a/flow/TDMetric.actor.h b/flow/TDMetric.actor.h
index 306352c39..fc63e12f9 100755
--- a/flow/TDMetric.actor.h
+++ b/flow/TDMetric.actor.h
@@ -35,6 +35,7 @@
#include "genericactors.actor.h"
#include "CompressedInt.h"
#include <algorithm>
+#include <cmath>
#include <functional>
struct MetricNameRef {
@@ -799,7 +800,7 @@ struct EventMetric : E, ReferenceCounted<EventMetric<E>>, MetricUtil<EventMetric
if (x == 0.0)
l = FLOW_KNOBS->MAX_METRIC_LEVEL-1;
else
- l = std::min(FLOW_KNOBS->MAX_METRIC_LEVEL-1, (int64_t)(::log(1.0/x) / FLOW_KNOBS->METRIC_LEVEL_DIVISOR));
+ l = std::min(FLOW_KNOBS->MAX_METRIC_LEVEL-1, (int64_t)(std::log(1.0/x) / FLOW_KNOBS->METRIC_LEVEL_DIVISOR));
if(!canLog(l))
return 0;
@@ -1274,7 +1275,7 @@ public:
l = std::min(
FLOW_KNOBS->MAX_METRIC_LEVEL-1,
(int64_t)(
- log((toggleTime - tv.time) / x) /
+ std::log((toggleTime - tv.time) / x) /
FLOW_KNOBS->METRIC_LEVEL_DIVISOR
)
);