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