Ifpack Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sig_dh.c
Go to the documentation of this file.
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack: Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2002) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #include "sig_dh.h"
44 #include "Parser_dh.h"
45 
46 
47 #undef __FUNC__
48 #define __FUNC__ "sigHandler_dh"
49 void
50 sigHandler_dh (int sig)
51 {
52  fprintf (stderr, "\n[%i] Euclid Signal Handler got: %s\n", myid_dh,
53  SIGNAME[sig]);
54  fprintf (stderr,
55  "[%i] ========================================================\n",
56  myid_dh);
57  fprintf (stderr,
58  "[%i] function calling sequence that led to the exception:\n",
59  myid_dh);
60  fprintf (stderr,
61  "[%i] ========================================================\n",
62  myid_dh);
63  printFunctionStack (stderr);
64  fprintf (stderr, "\n\n");
65 
66  if (logFile != NULL)
67  {
68  fprintf (logFile, "\n[%i] Euclid Signal Handler got: %s\n", myid_dh,
69  SIGNAME[sig]);
70  fprintf (logFile,
71  "[%i] ========================================================\n",
72  myid_dh);
73  fprintf (logFile,
74  "[%i] function calling sequence that led to the exception:\n",
75  myid_dh);
76  fprintf (logFile,
77  "[%i] ========================================================\n",
78  myid_dh);
80  fprintf (logFile, "\n\n");
81  }
82 
84 }
85 
86 #undef __FUNC__
87 #define __FUNC__ "sigRegister_dh"
88 void
90 {
91  if (Parser_dhHasSwitch (parser_dh, "-sig_dh"))
92  {
93  int i;
94  for (i = 0; i < euclid_signals_len; ++i)
95  {
96  signal (euclid_signals[i], sigHandler_dh);
97  }
98  }
99 }
void sigHandler_dh(int sig)
Definition: sig_dh.c:50
int euclid_signals_len
Definition: sig_dh.h:64
Parser_dh parser_dh
Definition: globalObjects.c:57
int euclid_signals[]
Definition: sig_dh.h:65
bool Parser_dhHasSwitch(Parser_dh p, char *s)
Definition: Parser_dh.c:213
void printFunctionStack(FILE *fp)
#define EUCLID_EXIT
Definition: euclid_config.h:69
static char * SIGNAME[]
Definition: sig_dh.h:71
FILE * logFile
Definition: globalObjects.c:72
int myid_dh
Definition: globalObjects.c:63
void sigRegister_dh()
Definition: sig_dh.c:89