(file) Return to Signal.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2