version 1.5, 2002/06/01 00:56:38
|
version 1.12, 2003/04/25 01:02:47
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// 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) |
|
// : Yi Zhou, Hewlett-Packard Company (yi_zhou@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 |
|
# define PEGASUS_SIGUSR1 SIGUSR1 |
| |
typedef void (* signal_handler)(int,siginfo_t *,void *); |
#else // PEGASUS_HAS_SIGNALS |
| |
typedef struct { |
typedef void PEGASUS_SIGINFO_T; |
int active; |
# define PEGASUS_SIGHUP 1 |
signal_handler sh; |
# define PEGASUS_SIGABRT 11 |
struct sigaction oldsa; |
# define PEGASUS_SIGPIPE 13 |
} register_handler; |
# define PEGASUS_SIGUSR1 16 |
|
|
|
#endif // PEGASUS_HAS_SIGNALS |
| |
#include <Pegasus/Common/Thread.h> |
|
#include <Pegasus/Common/DQueue.h> |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
#include <Pegasus/Common/Exception.h> |
extern "C" { |
|
#endif |
// used locally as standard response to stop the failing thread normally |
|
void sig_act(int s_n, siginfo_t * s_info, void * sig); |
typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); |
// test routine, that just causes a segmentation fault |
|
void * segmentation_faulter(void * parm); |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
|
} |
|
#endif |
|
|
|
// Sample signal handler for SIGABRT that stops the failing thread normally |
|
void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig); |
| |
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 |
| |
}; | }; |
| |
SignalHandler * getSigHandle(); |
PEGASUS_COMMON_LINKAGE SignalHandler * getSigHandle(); |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif // Pegasus_SignalHandler_h |
#endif // Pegasus_Signal_h |