1 // Copyright 2015 The Chromium 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.
5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_
6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_
8 // NOTE: On some toolchains, signal related ABI is incompatible with Linux's
9 // (not undefined, but defined different values and in different memory
10 // layouts). So, fill the gap here.
12 #if defined(__native_client_nonsfi__)
13 #if !defined(__i386__) && !defined(__arm__)
14 #error "Unsupported platform"
19 #define LINUX_SIGBUS 7 // 10 in PNaCl toolchain.
20 #define LINUX_SIGSEGV 11 // 11 in PNaCl toolchain. Defined for consistency.
21 #define LINUX_SIGCHLD 17 // 20 in PNaCl toolchain.
22 #define LINUX_SIGSYS 31 // 12 in PNaCl toolchain.
24 #define LINUX_SIG_BLOCK 0 // 1 in PNaCl toolchain.
25 #define LINUX_SIG_UNBLOCK 1 // 2 in PNaCl toolchain.
27 #define LINUX_SA_SIGINFO 4 // 2 in PNaCl toolchain.
28 #define LINUX_SA_NODEFER 0x40000000 // Undefined in PNaCl toolchain.
29 #define LINUX_SA_RESTART 0x10000000 // Undefined in PNaCl toolchain.
31 #define LINUX_SIG_DFL 0 // In PNaCl toolchain, unneeded cast is applied.
38 // Extra data is followed by the |si_code|. The length depends on the
43 #include "sandbox/linux/system_headers/linux_ucontext.h"
45 #else // !defined(__native_client_nonsfi__)
47 // Just alias the toolchain's value.
50 #define LINUX_SIGBUS SIGBUS
51 #define LINUX_SIGSEGV SIGSEGV
52 #define LINUX_SIGCHLD SIGCHLD
53 #define LINUX_SIGSYS SIGSYS
55 #define LINUX_SIG_BLOCK SIG_BLOCK
56 #define LINUX_SIG_UNBLOCK SIG_UNBLOCK
58 #define LINUX_SA_SIGINFO SA_SIGINFO
59 #define LINUX_SA_NODEFER SA_NODEFER
60 #define LINUX_SA_RESTART SA_RESTART
62 #define LINUX_SIG_DFL SIG_DFL
64 typedef siginfo_t LinuxSigInfo
;
66 #if defined(__ANDROID__)
67 // Android's signal.h doesn't define ucontext etc.
68 #include "sandbox/linux/system_headers/linux_ucontext.h"
69 #endif // defined(__ANDROID__)
71 #endif // !defined(__native_client_nonsfi__)
73 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_