OW_PlatformSignal.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright (C) 2005 Vintela, Inc. All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *
00007  *  - Redistributions of source code must retain the above copyright notice,
00008  *    this list of conditions and the following disclaimer.
00009  *
00010  *  - Redistributions in binary form must reproduce the above copyright notice,
00011  *    this list of conditions and the following disclaimer in the documentation
00012  *    and/or other materials provided with the distribution.
00013  *
00014  *  - Neither the name of Vintela, Inc. nor the names of its
00015  *    contributors may be used to endorse or promote products derived from this
00016  *    software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
00022  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028  * POSSIBILITY OF SUCH DAMAGE.
00029  *******************************************************************************/
00030 
00035 #ifndef OW_PLATFORM_SIGNAL_HPP_INCLUDE_GUARD_
00036 #define OW_PLATFORM_SIGNAL_HPP_INCLUDE_GUARD_
00037 
00038 #include "OW_config.h"
00039 #include "OW_UnnamedPipe.hpp"
00040 
00041 #include <iosfwd>
00042 
00043 #include <signal.h>
00044 
00045 namespace OW_NAMESPACE
00046 {
00047    namespace Platform
00048    {
00049       namespace Signal
00050       {
00051 
00052          // Some platforms define a sigval_t struct, others define sigval.
00053          // Autoconf magic was done to define these macros.
00054 #if defined(OW_SIGVAL_TYPE)
00055          typedef OW_SIGVAL_TYPE sigval_type;
00056 #else
00057          // This won't be used, except as a placeholder, but a typedef here is
00058          // much better than a bunch of #ifdefs later.
00059          typedef int sigval_type;
00060 #endif
00061 
00070          struct OW_CIMOMSERVER_API SignalInformation
00071          {
00072             SignalInformation();    // This only zeroes out everything.
00073 
00074             int signalAction;       // Defined for use in the CIMOM server (SHUTDOWN or REINIT)
00075 
00076             int signalNumber;       // si_signo
00077             int errorNumber;        // si_errno -- useful if non-zero
00078             int signalCode;         // si_code
00079 
00080             pid_t originatingPID;   // si_pid -- useful iff signalCode is SI_USER
00081             uid_t originatingUID;   // si_uid -- useful iff signalCode is SI_USER
00082             sigval_type timerValue; // si_sigval -- useful iff signalCode is SI_TIMER
00083             void* faultAddress;     // si_addr -- useful if signalCode is >0 and signalNumber equal to one of { SIGILL, SIGFPE, SIGTRAP, SIGBUS, SIGSEGV }
00084             int fileDescriptor;     // si_fd -- useful if signalCode is SI_ASYNCIO or >0 and equal to SIGPOLL
00085             int band;               // si_band -- useful if signalCode is SI_ASYNCIO or >0 and equal to SIGPOLL
00086          };
00087 
00091          void OW_CIMOMSERVER_API extractSignalInformation(const siginfo_t& source, SignalInformation& dest);
00092 
00102          bool OW_CIMOMSERVER_API flattenSignalInformation(const SignalInformation& source, UnnamedPipeRef& destPipe);
00103          bool OW_CIMOMSERVER_API unflattenSignalInformation(SignalInformation& dest, UnnamedPipeRef& sourcePipe);
00104 
00115          OW_CIMOMSERVER_API std::ostream& operator<<(std::ostream& o, const SignalInformation& sig);
00116       }
00117    }
00118 }
00119 
00120 #endif /* !defined(OW_PLATFORM_SIGNAL_HPP_INCLUDE_GUARD_) */
00121 

Generated on Thu Feb 9 08:48:08 2006 for openwbem by  doxygen 1.4.6