]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/scudo/standalone/common.cc
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / scudo / standalone / common.cc
1 //===-- common.cc -----------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "common.h"
10 #include "atomic_helpers.h"
11
12 namespace scudo {
13
14 uptr PageSizeCached;
15 uptr getPageSize();
16
17 uptr getPageSizeSlow() {
18   PageSizeCached = getPageSize();
19   CHECK_NE(PageSizeCached, 0);
20   return PageSizeCached;
21 }
22
23 // Fatal internal map() or unmap() error (potentially OOM related).
24 void NORETURN dieOnMapUnmapError(bool OutOfMemory) {
25   outputRaw("Scudo ERROR: internal map or unmap failure");
26   if (OutOfMemory)
27     outputRaw(" (OOM)");
28   outputRaw("\n");
29   die();
30 }
31
32 } // namespace scudo