1 // Copyright 2018 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_
6 #define V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_
7 
8 #include <signal.h>
9 
10 #include "include/v8config.h"
11 
12 namespace v8 {
13 namespace internal {
14 namespace trap_handler {
15 
16 #if V8_OS_LINUX || V8_OS_FREEBSD
17 constexpr int kOobSignal = SIGSEGV;
18 #elif V8_OS_MACOSX
19 constexpr int kOobSignal = SIGBUS;
20 #else
21 #error Posix trap handlers are only supported on Linux, MacOSX and FreeBSD.
22 #endif
23 
24 void HandleSignal(int signum, siginfo_t* info, void* context);
25 
26 bool TryHandleSignal(int signum, siginfo_t* info, void* context);
27 
28 }  // namespace trap_handler
29 }  // namespace internal
30 }  // namespace v8
31 
32 #endif  // V8_TRAP_HANDLER_HANDLER_INSIDE_POSIX_H_
33