version 1.12, 2003/04/25 01:02:47
|
version 1.24.18.2, 2008/03/18 15:56:18
|
|
|
//%///////////////////////////////////////////////////////////////////////////// |
//%2006//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM, |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// The Open Group, Tivoli Systems |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation, The Open Group. |
|
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
|
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; VERITAS Software Corporation; The Open Group. |
|
// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; |
|
// EMC Corporation; Symantec Corporation; The Open Group. |
// | // |
// Permission is hereby granted, free of charge, to any person obtaining a copy | // Permission is hereby granted, free of charge, to any person obtaining a copy |
// of this software and associated documentation files (the "Software"), to | // of this software and associated documentation files (the "Software"), to |
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Markus Mueller (markus_mueller@de.ibm.com) |
|
// |
|
// Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// : Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_Signal_h | #ifndef Pegasus_Signal_h |
#define Pegasus_Signal_h | #define Pegasus_Signal_h |
| |
#include <Pegasus/Common/Linkage.h> | #include <Pegasus/Common/Linkage.h> |
#include <Pegasus/Common/IPC.h> |
#include <Pegasus/Common/Mutex.h> |
| |
// // Ensure Unix 98 | // // Ensure Unix 98 |
// #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU | // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU |
|
|
# define PEGASUS_SIGHUP SIGHUP | # define PEGASUS_SIGHUP SIGHUP |
# define PEGASUS_SIGABRT SIGABRT | # define PEGASUS_SIGABRT SIGABRT |
# define PEGASUS_SIGPIPE SIGPIPE | # define PEGASUS_SIGPIPE SIGPIPE |
|
# define PEGASUS_SIGTERM SIGTERM |
# define PEGASUS_SIGUSR1 SIGUSR1 | # define PEGASUS_SIGUSR1 SIGUSR1 |
|
# define PEGASUS_SIGCHLD SIGCHLD |
|
# define PEGASUS_SIGDANGER SIGDANGER |
| |
#else // PEGASUS_HAS_SIGNALS | #else // PEGASUS_HAS_SIGNALS |
| |
|
|
# define PEGASUS_SIGHUP 1 | # define PEGASUS_SIGHUP 1 |
# define PEGASUS_SIGABRT 11 | # define PEGASUS_SIGABRT 11 |
# define PEGASUS_SIGPIPE 13 | # define PEGASUS_SIGPIPE 13 |
|
# define PEGASUS_SIGTERM 15 |
# define PEGASUS_SIGUSR1 16 | # define PEGASUS_SIGUSR1 16 |
|
# define PEGASUS_SIGCHLD 18 |
|
# define PEGASUS_SIGDANGER 33 |
| |
#endif // PEGASUS_HAS_SIGNALS | #endif // PEGASUS_HAS_SIGNALS |
| |
| |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS) |
extern "C" { | extern "C" { |
#endif | #endif |
| |
typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); | typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *); |
| |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) |
#if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS) |
} | } |
#endif | #endif |
| |
|
|
| |
// these functions should throw exceptions | // these functions should throw exceptions |
| |
void registerHandler(Uint32 signum, signal_handler _sighandler); |
void registerHandler(unsigned signum, signal_handler _sighandler); |
| |
void activate(Uint32 signum); |
void activate(unsigned signum); |
| |
//void activateAll(); | //void activateAll(); |
| |
void deactivate(Uint32 signum); |
void deactivate(unsigned signum); |
| |
void deactivateAll(); | void deactivateAll(); |
| |
static void ignore(Uint32 signum); |
static void ignore(unsigned signum); |
|
|
|
static void defaultAction(unsigned signum); |
| |
private: | private: |
| |
#ifdef PEGASUS_HAS_SIGNALS | #ifdef PEGASUS_HAS_SIGNALS |
|
enum |
|
{ |
|
PEGASUS_NSIG = 33 |
|
}; |
|
|
|
static void verifySignum(unsigned signum); |
|
|
typedef struct { | typedef struct { |
|
int signum; |
int active; | int active; |
signal_handler sh; | signal_handler sh; |
struct sigaction oldsa; | struct sigaction oldsa; |
} register_handler; | } register_handler; |
| |
register_handler reg_handler[32]; |
register_handler reg_handler[PEGASUS_NSIG + 1]; |
Mutex reg_mutex; | Mutex reg_mutex; |
| |
void deactivate_i(Uint32 signum); |
void deactivate_i(register_handler &rh); |
|
|
|
register_handler &getHandler(unsigned sigum); |
#endif | #endif |
| |
}; | }; |