• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- common.cpp ----------------------------------------------*- 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 
getPageSizeSlow()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).
dieOnMapUnmapError(bool OutOfMemory)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
33