1 /********************* -*- C++ -*- */
3 ** Original author: mdeters
4 ** Major contributors: none
5 ** Minor contributors (to current version): none
6 ** This file is part of the CVC4 prototype.
7 ** Copyright (c) 2009 The Analysis of Computer Systems Group (ACSys)
8 ** Courant Institute of Mathematical Sciences
10 ** See the file COPYING in the top-level source directory for licensing
13 ** [[ Add file-specific comments here ]]
22 #include "util/exception.h"
25 using CVC4::Exception
;
31 // FIXME add comments to functions
33 void sigint_handler(int sig
, siginfo_t
* info
, void*) {
34 fprintf(stderr
, "CVC4 interrupted by user.\n");
38 void segv_handler(int sig
, siginfo_t
* info
, void*) {
39 fprintf(stderr
, "CVC4 suffered a segfault.\n");
43 void cvc4_init() throw() {
44 struct sigaction act1
;
45 act1
.sa_sigaction
= sigint_handler
;
46 act1
.sa_flags
= SA_SIGINFO
;
47 sigemptyset(&act1
.sa_mask
);
48 if(sigaction(SIGINT
, &act1
, NULL
))
49 throw Exception(string("sigaction(SIGINT) failure: ") + strerror(errno
));
51 struct sigaction act2
;
52 act2
.sa_sigaction
= segv_handler
;
53 act2
.sa_flags
= SA_SIGINFO
;
54 sigemptyset(&act2
.sa_mask
);
55 if(sigaction(SIGSEGV
, &act2
, NULL
))
56 throw Exception(string("sigaction(SIGSEGV) failure: ") + strerror(errno
));
59 }/* CVC4::main namespace */