1 //%2003////////////////////////////////////////////////////////////////////////
3 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Development
4 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to
10 // deal in the Software without restriction, including without limitation the
11 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12 // sell copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
15 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
16 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
17 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
18 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 //==============================================================================
26 // Author: Markus Mueller (markus_mueller@de.ibm.com)
28 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
29 // : Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
31 //%/////////////////////////////////////////////////////////////////////////////
33 #ifndef Pegasus_Signal_h
34 #define Pegasus_Signal_h
36 #include <Pegasus/Common/Linkage.h>
37 #include <Pegasus/Common/IPC.h>
40 // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU
41 // #ifndef _GNU_SOURCE
42 // #define _GNU_SOURCE
45 // #ifdef _XOPEN_SOURCE
46 // #undef _XOPEN_SOURCE
48 // #define _XOPEN_SOURCE 600
51 #ifdef PEGASUS_HAS_SIGNALS
54 typedef siginfo_t PEGASUS_SIGINFO_T;
55 # define PEGASUS_SIGHUP SIGHUP
56 # define PEGASUS_SIGABRT SIGABRT
57 # define PEGASUS_SIGPIPE SIGPIPE
58 # define PEGASUS_SIGTERM SIGTERM
59 # define PEGASUS_SIGUSR1 SIGUSR1
61 #else // PEGASUS_HAS_SIGNALS
63 typedef void PEGASUS_SIGINFO_T;
64 # define PEGASUS_SIGHUP 1
65 # define PEGASUS_SIGABRT 11
66 # define PEGASUS_SIGPIPE 13
67 # define PEGASUS_SIGTERM 15
68 # define PEGASUS_SIGUSR1 16
70 #endif // PEGASUS_HAS_SIGNALS
73 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
77 typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *);
79 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
83 // Sample signal handler for SIGABRT that stops the failing thread normally
84 void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig);
86 PEGASUS_NAMESPACE_BEGIN
88 class PEGASUS_COMMON_LINKAGE SignalHandler
93 ~SignalHandler(); // deactivate all registered handlers
95 // these functions should throw exceptions
97 void registerHandler(Uint32 signum, signal_handler _sighandler);
99 void activate(Uint32 signum);
101 //void activateAll();
103 void deactivate(Uint32 signum);
105 void deactivateAll();
107 static void ignore(Uint32 signum);
111 #ifdef PEGASUS_HAS_SIGNALS
115 struct sigaction oldsa;
118 register_handler reg_handler[32];
121 void deactivate_i(Uint32 signum);
126 PEGASUS_COMMON_LINKAGE SignalHandler * getSigHandle();
128 PEGASUS_NAMESPACE_END
130 #endif // Pegasus_Signal_h