failures.c revision 8cd74cad9a59837fe23ef7be7a3a9a783a20d05f
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen failures.c : Failure manager
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen Copyright (c) 2001-2002 Timo Sirainen
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen Permission is hereby granted, free of charge, to any person obtaining
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen a copy of this software and associated documentation files (the
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen "Software"), to deal in the Software without restriction, including
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen without limitation the rights to use, copy, modify, merge, publish,
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen distribute, sublicense, and/or sell copies of the Software, and to
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen permit persons to whom the Software is furnished to do so, subject to
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen the following conditions:
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen The above copyright notice and this permission notice shall be
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen included in all copies or substantial portions of the Software.
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic FailureFunc panic_handler __attr_noreturn__, fatal_handler __attr_noreturn__;
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic FailureFunc error_handler, warning_handler;
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_panic_handler(const char *format, va_list args)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_fatal_handler(const char *format, va_list args)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void write_prefix(void)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen if (strftime(str, sizeof(str), log_stamp_format, tm) > 0)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_panic_handler(const char *format, va_list args)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen vfprintf(log_fd, printf_string_fix_format(format), args);
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_fatal_handler(const char *format, va_list args)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen vfprintf(log_fd, printf_string_fix_format(format), args);
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_error_handler(const char *format, va_list args)
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainen vfprintf(log_fd, printf_string_fix_format(format), args);
6509aa7306649042e828fef9e2f280f4535ea137Timo Sirainenstatic void default_warning_handler(const char *format, va_list args)
ba1a5db879b08d2fefcb42160af67853cdfe7687Timo Sirainen vfprintf(log_fd, printf_string_fix_format(format), args);
abort();
void failures_init(void)
void failures_deinit(void)