00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef CEYLAN_SIGNAL_H_ 00028 #define CEYLAN_SIGNAL_H_ 00029 00030 00031 #include "CeylanTypes.h" // for Ceylan::Uint16 00032 #include "CeylanSystem.h" // for SystemException 00033 00034 00035 #include <string> 00036 00037 00038 00047 namespace Ceylan 00048 { 00049 00050 00051 00052 namespace System 00053 { 00054 00055 00056 00057 namespace Signal 00058 { 00059 00060 00062 class CEYLAN_DLL SignalException: public SystemException 00063 { 00064 public: 00065 00066 explicit SignalException( const std::string & reason ) ; 00067 00068 virtual ~SignalException() throw() ; 00069 00070 } ; 00071 00072 00073 00074 00076 typedef void (*SignalHandler)(int) ; 00077 00078 00079 00081 extern CEYLAN_DLL const SignalHandler IgnoringHandler ; 00082 00083 00084 00091 extern CEYLAN_DLL const SignalHandler DefaultHandler ; 00092 00093 00094 00095 00097 typedef Ceylan::Uint16 SignalNumber ; 00098 00099 00100 00108 extern CEYLAN_DLL const SignalNumber HangUp ; 00109 00110 00111 00118 extern CEYLAN_DLL const SignalNumber InterruptFromKeyboard ; 00119 00120 00121 00128 extern CEYLAN_DLL const SignalNumber QuitFromKeyboard ; 00129 00130 00131 00138 extern CEYLAN_DLL const SignalNumber IllegalInstruction ; 00139 00140 00141 00148 extern CEYLAN_DLL const SignalNumber Abort ; 00149 00150 00151 00158 extern CEYLAN_DLL const SignalNumber FloatingPointException ; 00159 00160 00161 00170 extern CEYLAN_DLL const SignalNumber Kill ; 00171 00172 00173 00180 extern CEYLAN_DLL const SignalNumber InvalidMemoryReference ; 00181 00182 00183 00190 extern CEYLAN_DLL const SignalNumber BrokenPipe ; 00191 00192 00193 00200 extern CEYLAN_DLL const SignalNumber TimerSignal ; 00201 00202 00203 00210 extern CEYLAN_DLL const SignalNumber Termination ; 00211 00212 00213 00220 extern CEYLAN_DLL const SignalNumber FirstUserDefined ; 00221 00222 00223 00230 extern CEYLAN_DLL const SignalNumber SecondUserDefined ; 00231 00232 00233 00240 extern CEYLAN_DLL const SignalNumber ChildEnded ; 00241 00242 00243 00250 extern CEYLAN_DLL const SignalNumber Continue ; 00251 00252 00253 00262 extern CEYLAN_DLL const SignalNumber Stop ; 00263 00264 00265 00272 extern CEYLAN_DLL const SignalNumber TtyStopped ; 00273 00274 00275 00282 extern CEYLAN_DLL const SignalNumber TtyInput ; 00283 00284 00285 00292 extern CEYLAN_DLL const SignalNumber TtyOutput ; 00293 00294 00295 00303 CEYLAN_DLL void setToDefaultHandler( SignalNumber signalNumber ) ; 00304 00305 00306 00314 CEYLAN_DLL void ignore( SignalNumber signalNumber ) ; 00315 00316 00317 00325 CEYLAN_DLL void setHandler( SignalNumber signalNumber, 00326 SignalHandler newHandler ) ; 00327 00328 00329 00338 CEYLAN_DLL void raise( SignalNumber signalNumber ) ; 00339 00340 00341 00348 CEYLAN_DLL const std::string toString( SignalNumber signalNumber ) ; 00349 00350 00351 00352 } 00353 00354 } 00355 00356 } 00357 00358 00359 00360 #endif // CEYLAN_SIGNAL_H_ 00361