1 //===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines some helpful functions for dealing with the possibility of
11 // unix signals occuring while your program is running.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SYSTEM_SIGNALS_H
16 #define LLVM_SYSTEM_SIGNALS_H
18 #include "llvm/System/Path.h"
19 #include "llvm/System/IncludeFile.h"
24 /// This function registers signal handlers to ensure that if a signal gets
25 /// delivered that the named file is removed.
26 /// @brief Remove a file if a fatal signal occurs.
27 void RemoveFileOnSignal(const Path &Filename);
29 /// This function registers a signal handler to ensure that if a fatal signal
30 /// gets delivered to the process that the named directory and all its
31 /// contents are removed.
32 /// @brief Remove a directory if a fatal signal occurs.
33 void RemoveDirectoryOnSignal(const Path& path);
35 /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
36 /// process, print a stack trace and then exit.
37 /// @brief Print a stack trace if a fatal signal occurs.
38 void PrintStackTraceOnErrorSignal();
40 /// This function registers a function to be called when the user "interrupts"
41 /// the program (typically by pressing ctrl-c). When the user interrupts the
42 /// program, the specified interrupt function is called instead of the program
43 /// being killed, and the interrupt function automatically disabled. Note
44 /// that interrupt functions are not allowed to call any non-reentrant
45 /// functions. An null interrupt function pointer disables the current
46 /// installed function. Note also that the handler may be executed on a
47 /// different thread on some platforms.
48 /// @brief Register a function to be called when ctrl-c is pressed.
49 void SetInterruptFunction(void (*IF)());
50 } // End sys namespace
51 } // End llvm namespace
53 FORCE_DEFINING_FILE_TO_BE_LINKED(SystemSignals)