2004-05-27 05:30:18 +00:00
|
|
|
//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
|
2005-04-21 20:48:15 +00:00
|
|
|
//
|
2003-10-20 19:46:57 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-21 20:48:15 +00:00
|
|
|
//
|
2003-10-20 19:46:57 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2002-04-18 19:53:34 +00:00
|
|
|
//
|
|
|
|
// This file defines some helpful functions for dealing with the possibility of
|
|
|
|
// unix signals occuring while your program is running.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-05-27 05:30:18 +00:00
|
|
|
#ifndef LLVM_SYSTEM_SIGNALS_H
|
|
|
|
#define LLVM_SYSTEM_SIGNALS_H
|
2002-04-18 19:53:34 +00:00
|
|
|
|
2004-08-29 05:27:15 +00:00
|
|
|
#include "llvm/System/Path.h"
|
2002-04-18 19:53:34 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
2004-08-29 19:19:07 +00:00
|
|
|
namespace sys {
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2005-04-21 20:48:15 +00:00
|
|
|
/// This function registers signal handlers to ensure that if a signal gets
|
2004-08-29 05:27:15 +00:00
|
|
|
/// delivered that the named file is removed.
|
|
|
|
/// @brief Remove a file if a fatal signal occurs.
|
2004-11-14 21:53:09 +00:00
|
|
|
void RemoveFileOnSignal(const Path &Filename);
|
2002-04-18 19:53:34 +00:00
|
|
|
|
2004-08-29 05:27:15 +00:00
|
|
|
/// This function registers a signal handler to ensure that if a fatal signal
|
|
|
|
/// gets delivered to the process that the named directory and all its
|
|
|
|
/// contents are removed.
|
|
|
|
/// @brief Remove a directory if a fatal signal occurs.
|
2004-11-14 21:53:09 +00:00
|
|
|
void RemoveDirectoryOnSignal(const Path& path);
|
2004-08-29 05:27:15 +00:00
|
|
|
|
2005-04-21 20:48:15 +00:00
|
|
|
/// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
|
2004-08-29 05:27:15 +00:00
|
|
|
/// process, print a stack trace and then exit.
|
|
|
|
/// @brief Print a stack trace if a fatal signal occurs.
|
2004-02-19 20:03:08 +00:00
|
|
|
void PrintStackTraceOnErrorSignal();
|
2004-08-29 05:27:15 +00:00
|
|
|
|
2005-08-02 02:13:42 +00:00
|
|
|
/// This function registers a function to be called when the user "interrupts"
|
|
|
|
/// the program (typically by pressing ctrl-c). When the user interrupts the
|
|
|
|
/// program, the specified interrupt function is called instead of the program
|
|
|
|
/// being killed, and the interrupt function automatically disabled. Note
|
|
|
|
/// that interrupt functions are not allowed to call any non-reentrant
|
|
|
|
/// functions. An null interrupt function pointer disables the current
|
2005-08-02 03:04:47 +00:00
|
|
|
/// installed function. Note also that the handler may be executed on a
|
|
|
|
/// different thread on some platforms.
|
2005-08-02 02:13:42 +00:00
|
|
|
/// @brief Register a function to be called when ctrl-c is pressed.
|
|
|
|
void SetInterruptFunction(void (*IF)());
|
2004-08-29 19:19:07 +00:00
|
|
|
} // End sys namespace
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
2002-12-12 03:43:30 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
#endif
|