OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ |
6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ |
7 | 7 |
8 // NOTE: On some toolchains, signal related ABI is incompatible with Linux's | 8 // NOTE: On some toolchains, signal related ABI is incompatible with Linux's |
9 // (not undefined, but defined different values and in different memory | 9 // (not undefined, but defined different values and in different memory |
10 // layouts). So, fill the gap here. | 10 // layouts). So, fill the gap here. |
11 | 11 |
12 #if defined(__native_client_nonsfi__) | 12 #if defined(__native_client_nonsfi__) |
13 #if !defined(__i386__) && !defined(__arm__) | 13 #if !defined(__i386__) && !defined(__arm__) |
14 #error "Unsupported platform" | 14 #error "Unsupported platform" |
15 #endif | 15 #endif |
16 | 16 |
17 #include <signal.h> | 17 #include <signal.h> |
18 | 18 |
19 | |
20 #define LINUX_SIGHUP 1 // 1 in PNaCl toolchain. Defined for consistency. | |
rickyz (no longer on Chrome)
2015/06/16 20:57:07
I got these from native_client/toolchain/linux_x86
| |
21 #define LINUX_SIGINT 2 // 2 in PNaCl toolchain. Defined for consistency. | |
22 #define LINUX_SIGQUIT 3 // 3 in PNaCl toolchain. Defined for consistency. | |
23 #define LINUX_SIGABRT 6 // 6 in PNaCl toolchain. Defined for consistency. | |
19 #define LINUX_SIGBUS 7 // 10 in PNaCl toolchain. | 24 #define LINUX_SIGBUS 7 // 10 in PNaCl toolchain. |
25 #define LINUX_SIGUSR1 10 // 30 in PNaCl toolchain. | |
20 #define LINUX_SIGSEGV 11 // 11 in PNaCl toolchain. Defined for consistency. | 26 #define LINUX_SIGSEGV 11 // 11 in PNaCl toolchain. Defined for consistency. |
27 #define LINUX_SIGUSR2 12 // 31 in PNaCl toolchain. | |
28 #define LINUX_SIGPIPE 13 // 13 in PNaCl toolchain. Defined for consistency. | |
29 #define LINUX_SIGTERM 15 // 15 in PNaCl toolchain. Defined for consistency. | |
21 #define LINUX_SIGCHLD 17 // 20 in PNaCl toolchain. | 30 #define LINUX_SIGCHLD 17 // 20 in PNaCl toolchain. |
22 #define LINUX_SIGSYS 31 // 12 in PNaCl toolchain. | 31 #define LINUX_SIGSYS 31 // 12 in PNaCl toolchain. |
23 | 32 |
24 #define LINUX_SIG_BLOCK 0 // 1 in PNaCl toolchain. | 33 #define LINUX_SIG_BLOCK 0 // 1 in PNaCl toolchain. |
25 #define LINUX_SIG_UNBLOCK 1 // 2 in PNaCl toolchain. | 34 #define LINUX_SIG_UNBLOCK 1 // 2 in PNaCl toolchain. |
26 | 35 |
27 #define LINUX_SA_SIGINFO 4 // 2 in PNaCl toolchain. | 36 #define LINUX_SA_SIGINFO 4 // 2 in PNaCl toolchain. |
28 #define LINUX_SA_NODEFER 0x40000000 // Undefined in PNaCl toolchain. | 37 #define LINUX_SA_NODEFER 0x40000000 // Undefined in PNaCl toolchain. |
29 #define LINUX_SA_RESTART 0x10000000 // Undefined in PNaCl toolchain. | 38 #define LINUX_SA_RESTART 0x10000000 // Undefined in PNaCl toolchain. |
30 | 39 |
31 #define LINUX_SIG_DFL 0 // In PNaCl toolchain, unneeded cast is applied. | 40 #define LINUX_SIG_DFL 0 // In PNaCl toolchain, unneeded cast is applied. |
32 | 41 |
33 struct LinuxSigInfo { | 42 struct LinuxSigInfo { |
34 int si_signo; | 43 int si_signo; |
35 int si_errno; | 44 int si_errno; |
36 int si_code; | 45 int si_code; |
37 | 46 |
38 // Extra data is followed by the |si_code|. The length depends on the | 47 // Extra data is followed by the |si_code|. The length depends on the |
39 // signal number. | 48 // signal number. |
40 char _sifields[1]; | 49 char _sifields[1]; |
41 }; | 50 }; |
42 | 51 |
43 #include "sandbox/linux/system_headers/linux_ucontext.h" | 52 #include "sandbox/linux/system_headers/linux_ucontext.h" |
44 | 53 |
45 #else // !defined(__native_client_nonsfi__) | 54 #else // !defined(__native_client_nonsfi__) |
46 | 55 |
47 // Just alias the toolchain's value. | 56 // Just alias the toolchain's value. |
48 #include <signal.h> | 57 #include <signal.h> |
49 | 58 |
59 #define LINUX_SIGHUP SIGHUP | |
jln (very slow on Chromium)
2015/06/18 18:23:20
Wouldn't it be better to:
1. Always use the #defi
rickyz (no longer on Chrome)
2015/06/18 22:50:57
Done.
| |
60 #define LINUX_SIGINT SIGINT | |
61 #define LINUX_SIGQUIT SIGQUIT | |
62 #define LINUX_SIGABRT SIGABRT | |
50 #define LINUX_SIGBUS SIGBUS | 63 #define LINUX_SIGBUS SIGBUS |
64 #define LINUX_SIGUSR1 SIGUSR1 | |
51 #define LINUX_SIGSEGV SIGSEGV | 65 #define LINUX_SIGSEGV SIGSEGV |
66 #define LINUX_SIGUSR2 SIGUSR2 | |
67 #define LINUX_SIGPIPE SIGPIPE | |
68 #define LINUX_SIGTERM SIGTERM | |
52 #define LINUX_SIGCHLD SIGCHLD | 69 #define LINUX_SIGCHLD SIGCHLD |
53 #define LINUX_SIGSYS SIGSYS | 70 #define LINUX_SIGSYS SIGSYS |
54 | 71 |
55 #define LINUX_SIG_BLOCK SIG_BLOCK | 72 #define LINUX_SIG_BLOCK SIG_BLOCK |
56 #define LINUX_SIG_UNBLOCK SIG_UNBLOCK | 73 #define LINUX_SIG_UNBLOCK SIG_UNBLOCK |
57 | 74 |
58 #define LINUX_SA_SIGINFO SA_SIGINFO | 75 #define LINUX_SA_SIGINFO SA_SIGINFO |
59 #define LINUX_SA_NODEFER SA_NODEFER | 76 #define LINUX_SA_NODEFER SA_NODEFER |
60 #define LINUX_SA_RESTART SA_RESTART | 77 #define LINUX_SA_RESTART SA_RESTART |
61 | 78 |
62 #define LINUX_SIG_DFL SIG_DFL | 79 #define LINUX_SIG_DFL SIG_DFL |
63 | 80 |
64 typedef siginfo_t LinuxSigInfo; | 81 typedef siginfo_t LinuxSigInfo; |
65 | 82 |
66 #if defined(__ANDROID__) | 83 #if defined(__ANDROID__) |
67 // Android's signal.h doesn't define ucontext etc. | 84 // Android's signal.h doesn't define ucontext etc. |
68 #include "sandbox/linux/system_headers/linux_ucontext.h" | 85 #include "sandbox/linux/system_headers/linux_ucontext.h" |
69 #endif // defined(__ANDROID__) | 86 #endif // defined(__ANDROID__) |
70 | 87 |
71 #endif // !defined(__native_client_nonsfi__) | 88 #endif // !defined(__native_client_nonsfi__) |
72 | 89 |
73 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ | 90 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SIGNAL_H_ |
OLD | NEW |