]> git.proxmox.com Git - rustc.git/blob - src/compiler-rt/lib/sanitizer_common/sanitizer_mac.h
New upstream version 1.19.0+dfsg1
[rustc.git] / src / compiler-rt / lib / sanitizer_common / sanitizer_mac.h
1 //===-- sanitizer_mac.h -----------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is shared between various sanitizers' runtime libraries and
11 // provides definitions for OSX-specific functions.
12 //===----------------------------------------------------------------------===//
13 #ifndef SANITIZER_MAC_H
14 #define SANITIZER_MAC_H
15
16 #include "sanitizer_common.h"
17 #include "sanitizer_platform.h"
18 #if SANITIZER_MAC
19 #include "sanitizer_posix.h"
20
21 namespace __sanitizer {
22
23 enum MacosVersion {
24 MACOS_VERSION_UNINITIALIZED = 0,
25 MACOS_VERSION_UNKNOWN,
26 MACOS_VERSION_LEOPARD,
27 MACOS_VERSION_SNOW_LEOPARD,
28 MACOS_VERSION_LION,
29 MACOS_VERSION_MOUNTAIN_LION,
30 MACOS_VERSION_MAVERICKS,
31 MACOS_VERSION_YOSEMITE,
32 MACOS_VERSION_UNKNOWN_NEWER
33 };
34
35 MacosVersion GetMacosVersion();
36
37 char **GetEnviron();
38
39 } // namespace __sanitizer
40
41 extern "C" {
42 static char __crashreporter_info_buff__[__sanitizer::kErrorMessageBufferSize] =
43 {};
44 static const char *__crashreporter_info__ __attribute__((__used__)) =
45 &__crashreporter_info_buff__[0];
46 asm(".desc ___crashreporter_info__, 0x10");
47 } // extern "C"
48
49 namespace __sanitizer {
50 static BlockingMutex crashreporter_info_mutex(LINKER_INITIALIZED);
51
52 INLINE void CRAppendCrashLogMessage(const char *msg) {
53 BlockingMutexLock l(&crashreporter_info_mutex);
54 internal_strlcat(__crashreporter_info_buff__, msg,
55 sizeof(__crashreporter_info_buff__)); }
56 } // namespace __sanitizer
57
58 #endif // SANITIZER_MAC
59 #endif // SANITIZER_MAC_H