[clang-format] Write in text mode with LF in dump_format_[help|style].py
[llvm-project.git] / compiler-rt / lib / scudo / standalone / report_linux.cpp
blob432f6a01696463d469555f43d4ace81127cbb8e2
1 //===-- report_linux.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 //===----------------------------------------------------------------------===//
9 #include "platform.h"
11 #if SCUDO_LINUX || SCUDO_TRUSTY
13 #include "common.h"
14 #include "internal_defs.h"
15 #include "report.h"
16 #include "report_linux.h"
17 #include "string_utils.h"
19 #include <errno.h>
20 #include <stdlib.h>
21 #include <string.h>
23 namespace scudo {
25 // Fatal internal map() error (potentially OOM related).
26 void NORETURN reportMapError(uptr SizeIfOOM) {
27 ScopedString Error;
28 Error.append("Scudo ERROR: internal map failure (error desc=%s)",
29 strerror(errno));
30 if (SizeIfOOM)
31 Error.append(" requesting %zuKB", SizeIfOOM >> 10);
32 Error.append("\n");
33 reportRawError(Error.data());
36 void NORETURN reportUnmapError(uptr Addr, uptr Size) {
37 ScopedString Error;
38 Error.append("Scudo ERROR: internal unmap failure (error desc=%s) Addr 0x%zx "
39 "Size %zu\n",
40 strerror(errno), Addr, Size);
41 reportRawError(Error.data());
44 void NORETURN reportProtectError(uptr Addr, uptr Size, int Prot) {
45 ScopedString Error;
46 Error.append(
47 "Scudo ERROR: internal protect failure (error desc=%s) Addr 0x%zx "
48 "Size %zu Prot %x\n",
49 strerror(errno), Addr, Size, Prot);
50 reportRawError(Error.data());
53 } // namespace scudo
55 #endif // SCUDO_LINUX || SCUDO_TRUSTY