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