| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | |
| 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | |
| 7 | |
| 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. | |
| 11 | |
| 12 #if defined(__native_client_nonsfi__) | |
| 13 #if !defined(__i386__) && !defined(__arm__) | |
| 14 #error "Unsupported platform" | |
| 15 #endif | |
| 16 | |
| 17 #include <signal.h> | |
| 18 | |
| 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. | |
| 23 | |
| 24 #define LINUX_SIG_BLOCK 0 // 1 in PNaCl toolchain. | |
| 25 #define LINUX_SIG_UNBLOCK 1 // 2 in PNaCl toolchain. | |
| 26 | |
| 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. | |
| 30 | |
| 31 #define LINUX_SIG_DFL 0 // In PNaCl toolchain, unneeded cast is applied. | |
| 32 | |
| 33 struct LinuxSigInfo { | |
| 34 int si_signo; | |
| 35 int si_errno; | |
| 36 int si_code; | |
| 37 | |
| 38 // Extra data is followed by the |si_code|. The length depends on the | |
| 39 // signal number. | |
| 40 char _sifields[1]; | |
| 41 }; | |
| 42 | |
| 43 #include "sandbox/linux/system_headers/linux_ucontext.h" | |
| 44 | |
| 45 #else // !defined(__native_client_nonsfi__) | |
| 46 | |
| 47 // Just alias the toolchain's value. | |
| 48 #include <signal.h> | |
| 49 | |
| 50 #define LINUX_SIGBUS SIGBUS | |
| 51 #define LINUX_SIGSEGV SIGSEGV | |
| 52 #define LINUX_SIGCHLD SIGCHLD | |
| 53 #define LINUX_SIGSYS SIGSYS | |
| 54 | |
| 55 #define LINUX_SIG_BLOCK SIG_BLOCK | |
| 56 #define LINUX_SIG_UNBLOCK SIG_UNBLOCK | |
| 57 | |
| 58 #define LINUX_SA_SIGINFO SA_SIGINFO | |
| 59 #define LINUX_SA_NODEFER SA_NODEFER | |
| 60 #define LINUX_SA_RESTART SA_RESTART | |
| 61 | |
| 62 #define LINUX_SIG_DFL SIG_DFL | |
| 63 | |
| 64 typedef siginfo_t LinuxSigInfo; | |
| 65 | |
| 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__) | |
| 70 | |
| 71 #endif // !defined(__native_client_nonsfi__) | |
| 72 | |
| 73 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | |
| OLD | NEW |