version 1.8, 2002/08/17 00:59:36
|
version 1.9, 2003/03/21 23:37:35
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Markus Mueller (markus_mueller@de.ibm.com |
// Author: Markus Mueller (markus_mueller@de.ibm.com) |
// | // |
// Modified By: |
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
// | // |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
|
#ifndef Pegasus_Signal_h |
|
#define Pegasus_Signal_h |
| |
#ifndef Pegasus_SignalHandler_h |
#include <Pegasus/Common/Linkage.h> |
#define Pegasus_SignalHandler_h |
#include <Pegasus/Common/IPC.h> |
|
|
// REVIEW: Where is this signal handling code used? |
|
|
|
// REVIEW: Is there an equivalent implementation for Windows? |
|
|
|
| |
// // Ensure Unix 98 | // // Ensure Unix 98 |
// #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU | // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU |
|
|
// #define _XOPEN_SOURCE 600 | // #define _XOPEN_SOURCE 600 |
// #endif | // #endif |
| |
|
#ifdef PEGASUS_HAS_SIGNALS |
|
|
#include <signal.h> | #include <signal.h> |
|
typedef siginfo_t PEGASUS_SIGINFO_T; |
|
# define PEGASUS_SIGHUP SIGHUP |
|
# define PEGASUS_SIGABRT SIGABRT |
|
# define PEGASUS_SIGPIPE SIGPIPE |
|
|
|
#else // PEGASUS_HAS_SIGNALS |
|
|
|
typedef void PEGASUS_SIGINFO_T; |
|
# define PEGASUS_SIGHUP 1 |
|
# define PEGASUS_SIGABRT 11 |
|
# define PEGASUS_SIGPIPE 13 |
|
|
|
#endif // PEGASUS_HAS_SIGNALS |
|
|
| |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) | #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
extern "C" { | extern "C" { |
#endif | #endif |
| |
typedef void (* signal_handler)(int,siginfo_t *,void *); |
typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); |
|
|
typedef struct { |
|
int active; |
|
signal_handler sh; |
|
struct sigaction oldsa; |
|
} register_handler; |
|
| |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) | #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
} | } |
#endif | #endif |
| |
#include <Pegasus/Common/Thread.h> |
// Sample signal handler for SIGABRT that stops the failing thread normally |
#include <Pegasus/Common/DQueue.h> |
void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig); |
#include <Pegasus/Common/InternalException.h> |
|
#include <Pegasus/Common/Linkage.h> |
|
|
|
// used locally as standard response to stop the failing thread normally |
|
void sig_act(int s_n, siginfo_t * s_info, void * sig); |
|
// test routine, that just causes a segmentation fault |
|
void * segmentation_faulter(void * parm); |
|
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
|
| |
private: | private: |
| |
|
#ifdef PEGASUS_HAS_SIGNALS |
|
typedef struct { |
|
int active; |
|
signal_handler sh; |
|
struct sigaction oldsa; |
|
} register_handler; |
|
|
register_handler reg_handler[32]; | register_handler reg_handler[32]; |
Mutex reg_mutex; | Mutex reg_mutex; |
| |
void deactivate_i(Uint32 signum); | void deactivate_i(Uint32 signum); |
|
#endif |
| |
}; | }; |
| |
|
|
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif // Pegasus_SignalHandler_h |
#endif // Pegasus_Signal_h |