OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 #include "base/debug_util.h" | 5 #include "base/debug_util.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 | 10 |
11 static void ExitSignalHandler(int sig) { | 11 static void ExitSignalHandler(int sig) { |
12 exit(128 + sig); | 12 exit(128 + sig); |
13 } | 13 } |
14 | 14 |
15 // static | 15 // static |
16 void DebugUtil::DisableOSCrashDumps() { | 16 void DebugUtil::DisableOSCrashDumps() { |
17 int signals_to_intercept[] ={SIGINT, | 17 int signals_to_intercept[] ={SIGINT, |
18 SIGHUP, | 18 SIGHUP, |
19 SIGTERM, | 19 SIGTERM, |
20 SIGABRT, | 20 SIGABRT, |
21 SIGILL, | 21 SIGILL, |
22 SIGTRAP, | 22 SIGTRAP, |
23 SIGEMT, | 23 SIGEMT, |
24 SIGFPE, | 24 SIGFPE, |
25 SIGBUS, | 25 SIGBUS, |
26 SIGSEGV, | 26 SIGSEGV, |
27 SIGSYS, | 27 SIGSYS, |
28 SIGPIPE, | |
29 SIGXCPU, | 28 SIGXCPU, |
30 SIGXFSZ}; | 29 SIGXFSZ}; |
31 // For all these signals, just wire thing sup so we exit immediately. | 30 // For all these signals, just wire things up so we exit immediately. |
32 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) { | 31 for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) { |
33 signal(signals_to_intercept[i], ExitSignalHandler); | 32 signal(signals_to_intercept[i], ExitSignalHandler); |
34 } | 33 } |
35 } | 34 } |
OLD | NEW |