• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

Error.cc

Go to the documentation of this file.
00001 /** @file
00002 
00003   A brief file description
00004 
00005   @section license License
00006 
00007   Licensed to the Apache Software Foundation (ASF) under one
00008   or more contributor license agreements.  See the NOTICE file
00009   distributed with this work for additional information
00010   regarding copyright ownership.  The ASF licenses this file
00011   to you under the Apache License, Version 2.0 (the
00012   "License"); you may not use this file except in compliance
00013   with the License.  You may obtain a copy of the License at
00014 
00015       http://www.apache.org/licenses/LICENSE-2.0
00016 
00017   Unless required by applicable law or agreed to in writing, software
00018   distributed under the License is distributed on an "AS IS" BASIS,
00019   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00020   See the License for the specific language governing permissions and
00021   limitations under the License.
00022  */
00023 
00024 /****************************************************************************
00025 
00026   Error.cc
00027 
00028   This file contains code to manipulate Error
00029 
00030 
00031  ****************************************************************************/
00032 #include "proxy/Main.h"
00033 #include "Error.h"
00034 #include <time.h>
00035 #include "ink_platform.h"
00036 
00037 ErrorClass::~ErrorClass()
00038 {
00039 }
00040 
00041 void
00042 ErrorClass::operator() (const char *aformat_string, ...)
00043 {
00044   va_list aap;
00045   va_start(aap, aformat_string);
00046   format_string = aformat_string;
00047   raise(aap);
00048   va_end(aap);
00049   delete this;
00050 }
00051 
00052 void
00053 ErrorClass::raise(va_list ap, const char * /* prefix ATS_UNUSED */)
00054 {
00055   SrcLoc loc(filename, function_name, line_number);
00056   diags->print_va(NULL, DL_Fatal, &loc, format_string, ap);
00057 }
00058 
00059 // Request Fatal
00060 // Abort the current request, cleanup all related resources.
00061 //
00062 void
00063 RequestFatalClass::raise(va_list ap, const char *prefix)
00064 {
00065   ErrorClass::raise(ap, prefix ? prefix : "REQUEST FATAL");
00066   ink_assert(!"RequestFatal");
00067 }
00068 
00069 // Thread Fatal
00070 // Abort the current thread, restart within processor
00071 //
00072 void
00073 ThreadFatalClass::raise(va_list ap, const char *prefix)
00074 {
00075   ErrorClass::raise(ap, prefix ? prefix : "THREAD FATAL");
00076   ink_assert(!"ThreadFatal");
00077   ink_thread_exit(0);
00078 }
00079 
00080 // Processor Fatal
00081 // Kill and restart the processor
00082 //
00083 void
00084 ProcessorFatalClass::raise(va_list ap, const char *prefix)
00085 {
00086   ErrorClass::raise(ap, prefix ? prefix : "PROCESSOR FATAL");
00087   ink_assert(!"ProcessorFatal");
00088 }
00089 
00090 // Process Fatal
00091 // Kill and restart the process
00092 //
00093 void
00094 ProcessFatalClass::raise(va_list ap, const char *prefix)
00095 {
00096   ErrorClass::raise(ap, prefix ? prefix : "PROCESS FATAL");
00097   //exit(1);
00098   ink_assert(!"ProcessFatal");
00099 }
00100 
00101 // Machine Fatal
00102 // Kill and restart the set of processors on this machine
00103 //
00104 void
00105 MachineFatalClass::raise(va_list ap, const char *prefix)
00106 {
00107   ErrorClass::raise(ap, prefix ? prefix : "MACHINE FATAL");
00108   exit(2);
00109 }

Generated by  doxygen 1.7.1