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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2