1 karl 1.17 //%2004////////////////////////////////////////////////////////////////////////
|
2 kumpf 1.5 //
|
3 karl 1.17 // 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 karl 1.14 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.17 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 mike 1.2 //
10 // Permission is hereby granted, free of charge, to any person obtaining a copy
11 // of this software and associated documentation files (the "Software"), to
12 // deal in the Software without restriction, including without limitation the
13 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14 // sell copies of the Software, and to permit persons to whom the Software is
15 // furnished to do so, subject to the following conditions:
|
16 kumpf 1.5 //
|
17 mike 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
18 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
19 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
20 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 //
26 //==============================================================================
27 //
|
28 kumpf 1.9 // Author: Markus Mueller (markus_mueller@de.ibm.com)
|
29 mike 1.2 //
|
30 kumpf 1.9 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
|
31 kumpf 1.10 // : Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)
|
32 mike 1.2 //
33 //%/////////////////////////////////////////////////////////////////////////////
34
|
35 kumpf 1.9 #ifndef Pegasus_Signal_h
36 #define Pegasus_Signal_h
|
37 mike 1.2
|
38 kumpf 1.9 #include <Pegasus/Common/Linkage.h>
39 #include <Pegasus/Common/IPC.h>
|
40 mike 1.3
|
41 mike 1.2 // // Ensure Unix 98
42 // #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU
43 // #ifndef _GNU_SOURCE
44 // #define _GNU_SOURCE
45 // #endif
46 // #else
47 // #ifdef _XOPEN_SOURCE
48 // #undef _XOPEN_SOURCE
49 // #endif
50 // #define _XOPEN_SOURCE 600
51 // #endif
52
|
53 kumpf 1.9 #ifdef PEGASUS_HAS_SIGNALS
54
55 # include <signal.h>
56 typedef siginfo_t PEGASUS_SIGINFO_T;
57 # define PEGASUS_SIGHUP SIGHUP
58 # define PEGASUS_SIGABRT SIGABRT
59 # define PEGASUS_SIGPIPE SIGPIPE
|
60 kumpf 1.13 # define PEGASUS_SIGTERM SIGTERM
|
61 kumpf 1.10 # define PEGASUS_SIGUSR1 SIGUSR1
|
62 kumpf 1.15 # define PEGASUS_SIGCHLD SIGCHLD
|
63 kumpf 1.9
64 #else // PEGASUS_HAS_SIGNALS
65
66 typedef void PEGASUS_SIGINFO_T;
67 # define PEGASUS_SIGHUP 1
68 # define PEGASUS_SIGABRT 11
69 # define PEGASUS_SIGPIPE 13
|
70 kumpf 1.13 # define PEGASUS_SIGTERM 15
|
71 kumpf 1.11 # define PEGASUS_SIGUSR1 16
|
72 kumpf 1.15 # define PEGASUS_SIGCHLD 18
|
73 kumpf 1.9
74 #endif // PEGASUS_HAS_SIGNALS
75
|
76 mike 1.2
|
77 david.dillard 1.16 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS)
|
78 sage 1.6 extern "C" {
79 #endif
80
|
81 kumpf 1.9 typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *);
|
82 sage 1.6
|
83 david.dillard 1.16 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS)
|
84 sage 1.6 }
85 #endif
|
86 mike 1.2
|
87 kumpf 1.9 // Sample signal handler for SIGABRT that stops the failing thread normally
88 void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig);
|
89 mike 1.2
90 PEGASUS_NAMESPACE_BEGIN
91
92 class PEGASUS_COMMON_LINKAGE SignalHandler
93 {
94 public:
95 SignalHandler();
96
97 ~SignalHandler(); // deactivate all registered handlers
98
99 // these functions should throw exceptions
100
101 void registerHandler(Uint32 signum, signal_handler _sighandler);
102
103 void activate(Uint32 signum);
104
105 //void activateAll();
106
107 void deactivate(Uint32 signum);
108
109 void deactivateAll();
110 mike 1.2
111 static void ignore(Uint32 signum);
112
113 private:
114
|
115 kumpf 1.9 #ifdef PEGASUS_HAS_SIGNALS
116 typedef struct {
117 int active;
118 signal_handler sh;
119 struct sigaction oldsa;
120 } register_handler;
121
|
122 mike 1.2 register_handler reg_handler[32];
123 Mutex reg_mutex;
124
125 void deactivate_i(Uint32 signum);
|
126 kumpf 1.9 #endif
|
127 mike 1.2
128 };
129
|
130 kumpf 1.12 PEGASUS_COMMON_LINKAGE SignalHandler * getSigHandle();
|
131 mike 1.2
132 PEGASUS_NAMESPACE_END
133
|
134 kumpf 1.9 #endif // Pegasus_Signal_h
|