summaryrefslogtreecommitdiff
path: root/abseil-cpp/absl/debugging/internal/stack_consumption.cc
diff options
context:
space:
mode:
Diffstat (limited to 'abseil-cpp/absl/debugging/internal/stack_consumption.cc')
-rw-r--r--abseil-cpp/absl/debugging/internal/stack_consumption.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/abseil-cpp/absl/debugging/internal/stack_consumption.cc b/abseil-cpp/absl/debugging/internal/stack_consumption.cc
index e3dd51c..3f40bea 100644
--- a/abseil-cpp/absl/debugging/internal/stack_consumption.cc
+++ b/abseil-cpp/absl/debugging/internal/stack_consumption.cc
@@ -18,14 +18,17 @@
#ifdef ABSL_INTERNAL_HAVE_DEBUGGING_STACK_CONSUMPTION
#include <signal.h>
+#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
-#include <string.h>
-
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
+#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace debugging_internal {
@@ -43,7 +46,7 @@ namespace {
// unspecified. Therefore, instead we hardcode the direction of the
// stack on platforms we know about.
#if defined(__i386__) || defined(__x86_64__) || defined(__ppc__) || \
- defined(__aarch64__)
+ defined(__aarch64__) || defined(__riscv)
constexpr bool kStackGrowsDown = true;
#else
#error Need to define kStackGrowsDown
@@ -162,7 +165,7 @@ int GetSignalHandlerStackConsumption(void (*signal_handler)(int)) {
// versions of musl have a bug that rejects ss_size==0. Work around this by
// setting ss_size to MINSIGSTKSZ, which should be ignored by the kernel
// when SS_DISABLE is set.
- old_sigstk.ss_size = MINSIGSTKSZ;
+ old_sigstk.ss_size = static_cast<size_t>(MINSIGSTKSZ);
}
ABSL_RAW_CHECK(sigaltstack(&old_sigstk, nullptr) == 0,
"sigaltstack() failed");