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.15 # define PEGASUS_SIGCHLD SIGCHLD
|
61 kumpf 1.9
62 #else // PEGASUS_HAS_SIGNALS
63
64 typedef void PEGASUS_SIGINFO_T;
65 # define PEGASUS_SIGHUP 1
66 # define PEGASUS_SIGABRT 11
67 # define PEGASUS_SIGPIPE 13
|
68 kumpf 1.13 # define PEGASUS_SIGTERM 15
|
69 kumpf 1.11 # define PEGASUS_SIGUSR1 16
|
70 kumpf 1.15 # define PEGASUS_SIGCHLD 18
|
71 kumpf 1.9
72 #endif // PEGASUS_HAS_SIGNALS
73
|
74 mike 1.2
|
75 david.dillard 1.16 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS)
|
76 sage 1.6 extern "C" {
77 #endif
78
|
79 kumpf 1.9 typedef void (* signal_handler)(int, PEGASUS_SIGINFO_T *, void *);
|
80 sage 1.6
|
81 david.dillard 1.16 #if defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) || (PEGASUS_OS_SOLARIS)
|
82 sage 1.6 }
83 #endif
|
84 mike 1.2
|
85 kumpf 1.9 // Sample signal handler for SIGABRT that stops the failing thread normally
86 void sig_act(int s_n, PEGASUS_SIGINFO_T * s_info, void * sig);
|
87 mike 1.2
88 PEGASUS_NAMESPACE_BEGIN
89
90 class PEGASUS_COMMON_LINKAGE SignalHandler
91 {
92 public:
93 SignalHandler();
94
95 ~SignalHandler(); // deactivate all registered handlers
96
97 // these functions should throw exceptions
98
99 void registerHandler(Uint32 signum, signal_handler _sighandler);
100
101 void activate(Uint32 signum);
102
103 //void activateAll();
104
105 void deactivate(Uint32 signum);
106
107 void deactivateAll();
108 mike 1.2
109 static void ignore(Uint32 signum);
110
111 private:
112
|
113 kumpf 1.9 #ifdef PEGASUS_HAS_SIGNALS
114 typedef struct {
115 int active;
116 signal_handler sh;
117 struct sigaction oldsa;
118 } register_handler;
119
|
120 mike 1.2 register_handler reg_handler[32];
121 Mutex reg_mutex;
122
123 void deactivate_i(Uint32 signum);
|
124 kumpf 1.9 #endif
|
125 mike 1.2
126 };
127
|
128 kumpf 1.12 PEGASUS_COMMON_LINKAGE SignalHandler * getSigHandle();
|
129 mike 1.2
130 PEGASUS_NAMESPACE_END
131
|
132 kumpf 1.9 #endif // Pegasus_Signal_h
|