OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "util/posix/symbolic_constants_posix.h" | 15 #include "util/posix/symbolic_constants_posix.h" |
16 | 16 |
| 17 #include <signal.h> |
17 #include <string.h> | 18 #include <string.h> |
18 #include <sys/types.h> | 19 #include <sys/types.h> |
19 #include <sys/signal.h> | |
20 | 20 |
21 #include "base/macros.h" | 21 #include "base/macros.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "util/misc/implicit_cast.h" | 24 #include "util/misc/implicit_cast.h" |
25 #include "util/stdlib/string_number_conversion.h" | 25 #include "util/stdlib/string_number_conversion.h" |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 const char* kSignalNames[] = { | 29 const char* kSignalNames[] = { |
(...skipping 27 matching lines...) Expand all Loading... |
57 "TTOU", | 57 "TTOU", |
58 "IO", | 58 "IO", |
59 "XCPU", | 59 "XCPU", |
60 "XFSZ", | 60 "XFSZ", |
61 "VTALRM", | 61 "VTALRM", |
62 "PROF", | 62 "PROF", |
63 "WINCH", | 63 "WINCH", |
64 "INFO", | 64 "INFO", |
65 "USR1", | 65 "USR1", |
66 "USR2", | 66 "USR2", |
67 #elif defined(OS_LINUX) | 67 #elif defined(OS_LINUX) || defined(OS_ANDROID) |
68 // sed -Ene 's/^#define[[:space:]]SIG([[:alnum:]]+)[[:space:]]+[[:digit:]]{1
,2}([[:space:]]|$).*/ "\1",/p' | 68 // sed -Ene 's/^#define[[:space:]]SIG([[:alnum:]]+)[[:space:]]+[[:digit:]]{1
,2}([[:space:]]|$).*/ "\1",/p' |
69 // /usr/include/asm-generic/signal.h | 69 // /usr/include/asm-generic/signal.h |
70 // and fix up by removing SIGIOT, SIGLOST, SIGUNUSED, and SIGRTMIN. | 70 // and fix up by removing SIGIOT, SIGLOST, SIGUNUSED, and SIGRTMIN. |
71 "HUP", | 71 "HUP", |
72 "INT", | 72 "INT", |
73 "QUIT", | 73 "QUIT", |
74 "ILL", | 74 "ILL", |
75 "TRAP", | 75 "TRAP", |
76 "ABRT", | 76 "ABRT", |
77 "BUS", | 77 "BUS", |
(...skipping 16 matching lines...) Expand all Loading... |
94 "XCPU", | 94 "XCPU", |
95 "XFSZ", | 95 "XFSZ", |
96 "VTALRM", | 96 "VTALRM", |
97 "PROF", | 97 "PROF", |
98 "WINCH", | 98 "WINCH", |
99 "IO", | 99 "IO", |
100 "PWR", | 100 "PWR", |
101 "SYS", | 101 "SYS", |
102 #endif | 102 #endif |
103 }; | 103 }; |
104 #if defined(OS_LINUX) | 104 #if defined(OS_LINUX) || defined(OS_ANDROID) |
105 // NSIG is 64 to account for real-time signals. | 105 // NSIG is 64 to account for real-time signals. |
106 static_assert(arraysize(kSignalNames) == 32, "kSignalNames length"); | 106 static_assert(arraysize(kSignalNames) == 32, "kSignalNames length"); |
107 #else | 107 #else |
108 static_assert(arraysize(kSignalNames) == NSIG, "kSignalNames length"); | 108 static_assert(arraysize(kSignalNames) == NSIG, "kSignalNames length"); |
109 #endif | 109 #endif |
110 | 110 |
111 const char kSigPrefix[] = "SIG"; | 111 const char kSigPrefix[] = "SIG"; |
112 | 112 |
113 } // namespace | 113 } // namespace |
114 | 114 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 if (options & kAllowNumber) { | 163 if (options & kAllowNumber) { |
164 return StringToNumber(string, signal); | 164 return StringToNumber(string, signal); |
165 } | 165 } |
166 | 166 |
167 return false; | 167 return false; |
168 } | 168 } |
169 | 169 |
170 } // namespace crashpad | 170 } // namespace crashpad |
OLD | NEW |