1 karl 1.14 //%2003////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.5 //
|
3 karl 1.14 // 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.
|
7 mike 1.2 //
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:
|
14 kumpf 1.5 //
|
15 mike 1.2 // 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.
23 //
24 //==============================================================================
25 //
|
26 kumpf 1.9 // Author: Markus Mueller (markus_mueller@de.ibm.com)
|
27 mike 1.2 //
|
28 kumpf 1.9 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
29 kumpf 1.10 // : Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
|
30 mike 1.2 //
31 //%/////////////////////////////////////////////////////////////////////////////
32
|
33 kumpf 1.9 #ifndef Pegasus_Signal_h
34 #define Pegasus_Signal_h
|
35 mike 1.2
|
36 kumpf 1.9 #include <Pegasus/Common/Linkage.h>
37 #include <Pegasus/Common/IPC.h>
|
38 mike 1.3
|
39 mike 1.2 // // Ensure Unix 98
40 // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU
41 // #ifndef _GNU_SOURCE
42 // #define _GNU_SOURCE
43 // #endif
44 // #else
45 // #ifdef _XOPEN_SOURCE
46 // #undef _XOPEN_SOURCE
47 // #endif
48 // #define _XOPEN_SOURCE 600
49 // #endif
50
|
51 kumpf 1.9 #ifdef PEGASUS_HAS_SIGNALS
52
53 # include <signal.h>
54 typedef siginfo_t PEGASUS_SIGINFO_T;
55 # define PEGASUS_SIGHUP SIGHUP
56 # define PEGASUS_SIGABRT SIGABRT
57 # define PEGASUS_SIGPIPE SIGPIPE
|
58 kumpf 1.13 # define PEGASUS_SIGTERM SIGTERM
|
59 kumpf 1.10 # define PEGASUS_SIGUSR1 SIGUSR1
|
60 kumpf 1.9
61 #else // PEGASUS_HAS_SIGNALS
62
63 typedef void PEGASUS_SIGINFO_T;
64 # define PEGASUS_SIGHUP 1
65 # define PEGASUS_SIGABRT 11
66 # define PEGASUS_SIGPIPE 13
|
67 kumpf 1.13 # define PEGASUS_SIGTERM 15
|
68 kumpf 1.11 # define PEGASUS_SIGUSR1 16
|
69 kumpf 1.9
70 #endif // PEGASUS_HAS_SIGNALS
71
|
72 mike 1.2
|
73 sage 1.6 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
74 extern "C" {
75 #endif
76
|
77 kumpf 1.9 typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *);
|
78 sage 1.6
79 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM)
80 }
81 #endif
|
82 mike 1.2
|
83 kumpf 1.9 // 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);
|
85 mike 1.2
86 PEGASUS_NAMESPACE_BEGIN
87
88 class PEGASUS_COMMON_LINKAGE SignalHandler
89 {
90 public:
91 SignalHandler();
92
93 ~SignalHandler(); // deactivate all registered handlers
94
95 // these functions should throw exceptions
96
97 void registerHandler(Uint32 signum, signal_handler _sighandler);
98
99 void activate(Uint32 signum);
100
101 //void activateAll();
102
103 void deactivate(Uint32 signum);
104
105 void deactivateAll();
106 mike 1.2
107 static void ignore(Uint32 signum);
108
109 private:
110
|
111 kumpf 1.9 #ifdef PEGASUS_HAS_SIGNALS
112 typedef struct {
113 int active;
114 signal_handler sh;
115 struct sigaction oldsa;
116 } register_handler;
117
|
118 mike 1.2 register_handler reg_handler[32];
119 Mutex reg_mutex;
120
121 void deactivate_i(Uint32 signum);
|
122 kumpf 1.9 #endif
|
123 mike 1.2
124 };
125
|
126 kumpf 1.12 PEGASUS_COMMON_LINKAGE SignalHandler * getSigHandle();
|
127 mike 1.2
128 PEGASUS_NAMESPACE_END
129
|
130 kumpf 1.9 #endif // Pegasus_Signal_h
|