File error_manager.c
FileList > base > error_manager.c
Go to the source code of this file
#include "error_manager.h"
#include "chartype.h"
#include "error_context.hpp"
#include "environment_variable.h"
#include "log_impl.h"
#include "memory_alloc.h"
#include "message_catalog.h"
#include "object_representation.h"
#include "release_string.h"
#include "system_parameter.h"
#include "stack_dump.h"
#include "boot_sr.h"
#include <cassert>
#include <cstddef>
#include <cstring>
#include <errno.h>
#include <pthread.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
#include <mutex>
#include "memory_wrapper.hpp"
Namespaces
Classes
Public Types
Public Attributes
Public Static Attributes
Public Functions
| Type |
Name |
| void |
_er_log_debug (const char * file_name, const int line_no, const char * fmt, ...)
|
| void |
er_all (int * err_id, int * severity, int * n_levels, int * line_no, const char ** file_name, const char ** error_msg)
|
| void |
er_clear (void)
|
| void |
er_clearid (void)
|
| int |
er_errid (void)
|
| int |
er_errid_if_has_error (void)
|
| void |
er_file_create_link_to_current_log_file (const char * log_file_path, const char * suffix)
|
| void |
er_final (ER_FINAL_CODE do_global_final)
|
| char * |
er_get_area_error (char * buffer, int * length)
|
| char * |
er_get_ermsg_from_area_error (char * buffer)
|
| const char * |
er_get_msglog_filename (void)
|
| int |
er_get_severity (void)
|
| bool |
er_has_error (void)
|
| int |
er_init (const char * msglog_filename, int exit_ask)
|
| bool |
er_is_initialized (void)
|
| const char * |
er_msg (void)
|
| void |
er_print_callstack (const char * file_name, const int line_no, const char * fmt, ...)
|
| void |
er_print_crash_callstack (int sig)
|
| er_log_handler_t |
er_register_log_handler (er_log_handler_t handler)
|
| void |
er_restore_last_error (void)
|
| void |
er_set (int severity, const char * file_name, const int line_no, int err_id, int num_args, ...)
|
| int |
er_set_area_error (char * server_area)
|
| void |
er_set_ignore_uninit (bool ignore)
|
| void |
er_set_print_property (int print_console)
|
| void |
er_set_with_file (int severity, const char * file_name, const int line_no, int err_id, FILE * fp, int num_args, ...)
|
| void |
er_set_with_oserror (int severity, const char * file_name, const int line_no, int err_id, int num_args, ...)
|
| void |
er_setid (int err_id)
|
| void |
er_stack_clearall (void)
|
| void |
er_stack_pop (void)
|
| void |
er_stack_pop_and_keep_error (void)
|
| void |
er_stack_push (void)
|
| void |
er_stack_push_if_exists (void)
|
Public Static Functions
| Type |
Name |
| void |
_er_log_debug_internal (const char * file_name, const int line_no, const char * fmt, va_list * ap)
|
| void |
er_call_stack_dump_on_error (int severity, int err_id)
|
| void |
er_call_stack_final (void)
|
| int |
er_call_stack_init (void)
|
| void |
er_clear_fmt (ER_FMT * fmt)
|
| ER_FMT * |
er_create_fmt_msg (ER_FMT * fmt, int err_id, const char * msg)
|
| void |
er_emergency (const char * file, int line, const char * fmt, ...)
|
| size_t |
er_estimate_size (ER_FMT * fmt, va_list * ap)
|
| void |
er_event (void)
|
| void |
er_event_final (void)
|
| int |
er_event_init (void)
|
| void |
er_event_sigpipe_handler (int sig)
|
| FILE * |
er_file_backup (FILE * fp, const char * path)
|
| bool |
er_file_isa_null_device (const char * path)
|
| FILE * |
er_file_open (const char * path)
|
| ER_FMT * |
er_find_fmt (int err_id, int num_args)
|
| int |
er_fname_free (const void * key, void * data, void * args)
|
| void |
er_init_fmt (ER_FMT * fmt)
|
| void |
er_internal_msg (ER_FMT * fmt, int code, int msg_num)
|
| bool |
er_is_error_severity (er_severity severity)
|
| void |
er_log (int err_id)
|
| void * |
er_malloc_helper (std::size_t size, const char * file, int line)
|
| void |
er_notify_event_on_error (int err_id)
|
| void |
er_set_access_log_filename (void)
|
| int |
er_set_internal (int severity, const char * file_name, const int line_no, int err_id, int num_args, bool include_os_error, FILE * fp, va_list * ap_ptr)
|
| void |
er_stop_on_error (void)
|
| void |
er_study_fmt (ER_FMT * fmt)
|
| int |
er_study_spec (const char * conversion_spec, char * simple_spec, int * position, int * width, int * va_class)
|
| int |
er_vsprintf (er_message * er_entry_p, ER_FMT * fmt, va_list * ap)
|
Macros
Public Types Documentation
typedef ER_COPY_AREA
typedef struct er_copy_area ER_COPY_AREA;
typedef ER_FMT
typedef struct er_fmt ER_FMT;
typedef ER_SPEC
typedef struct er_spec ER_SPEC;
enum er_msg_no
enum er_msg_no {
ER_ER_HEADER = 1,
ER_ER_MISSING_MSG,
ER_ER_OUT_OF_MEMORY,
ER_ER_NO_CATALOG,
ER_ER_LOG_MISSING_MSG,
ER_ER_EXIT,
ER_ER_ASK,
ER_ER_UNKNOWN_FILE,
ER_ER_SUBSTITUTE_MSG,
ER_LOG_ASK_VALUE,
ER_LOG_MSGLOG_WARNING,
ER_LOG_SUSPECT_FMT,
ER_LOG_UNKNOWN_CODE,
ER_LOG_WRAPAROUND,
ER_LOG_MSG_WRAPPER,
ER_LOG_SYSLOG_WRAPPER,
ER_LOG_MSG_WRAPPER_D,
ER_LOG_SYSLOG_WRAPPER_D,
ER_LOG_LAST_MSG,
ER_LOG_DEBUG_NOTIFY,
ER_STOP_MAIL_SUBJECT,
ER_STOP_MAIL_BODY,
ER_STOP_SYSLOG,
ER_EVENT_HANDLER
};
Public Attributes Documentation
variable er_Log_file_mutex
std::mutex er_Log_file_mutex;
variable er_Message_cache_mutex
std::mutex er_Message_cache_mutex;
Public Static Attributes Documentation
variable er_Accesslog_fh
variable er_Accesslog_filename
const char* er_Accesslog_filename;
variable er_Accesslog_filename_buff
char er_Accesslog_filename_buff[PATH_MAX];
variable er_Builtin_msg
const char* er_Builtin_msg[];
variable er_Cached_msg
char* er_Cached_msg[sizeof(er_Builtin_msg)/sizeof(const char *)];
variable er_Eid
variable er_Errid_not_initialized
int er_Errid_not_initialized;
variable er_Event_jmp_buf
jmp_buf er_Event_jmp_buf;
variable er_Event_pipe
variable er_Event_started
variable er_Exit_ask
variable er_Fmt_list
ER_FMT er_Fmt_list[(- -1371)+1];
variable er_Fmt_msg_fail_count
int er_Fmt_msg_fail_count;
variable er_Fnlog
const PTR_FNERLOG er_Fnlog[ER_MAX_SEVERITY+1];
variable er_Has_sticky_init
variable er_Hasalready_initiated
bool er_Hasalready_initiated;
variable er_Ignore_uninit
variable er_Is_cached_msg
variable er_Isa_null_device
variable er_Logfile_opened
variable er_Msglog_fh
variable er_Msglog_filename
const char* er_Msglog_filename;
variable er_Msglog_filename_buff
char er_Msglog_filename_buff[PATH_MAX];
variable er_Print_to_console
variable er_severity_string
const char* er_severity_string[];
variable er_unknown_severity
const char* er_unknown_severity;
variable saved_Sig_handler
SIGNAL_HANDLER_FUNCTION saved_Sig_handler;
Public Functions Documentation
function _er_log_debug
void _er_log_debug (
const char * file_name,
const int line_no,
const char * fmt,
...
)
function er_all
void er_all (
int * err_id,
int * severity,
int * n_levels,
int * line_no,
const char ** file_name,
const char ** error_msg
)
function er_clear
function er_clearid
function er_errid
function er_errid_if_has_error
int er_errid_if_has_error (
void
)
function er_file_create_link_to_current_log_file
void er_file_create_link_to_current_log_file (
const char * log_file_path,
const char * suffix
)
function er_final
void er_final (
ER_FINAL_CODE do_global_final
)
function er_get_area_error
char * er_get_area_error (
char * buffer,
int * length
)
function er_get_ermsg_from_area_error
char * er_get_ermsg_from_area_error (
char * buffer
)
function er_get_msglog_filename
const char * er_get_msglog_filename (
void
)
function er_get_severity
int er_get_severity (
void
)
function er_has_error
bool er_has_error (
void
)
function er_init
int er_init (
const char * msglog_filename,
int exit_ask
)
function er_is_initialized
bool er_is_initialized (
void
)
function er_msg
const char * er_msg (
void
)
function er_print_callstack
void er_print_callstack (
const char * file_name,
const int line_no,
const char * fmt,
...
)
function er_print_crash_callstack
void er_print_crash_callstack (
int sig
)
function er_register_log_handler
er_log_handler_t er_register_log_handler (
er_log_handler_t handler
)
function er_restore_last_error
void er_restore_last_error (
void
)
function er_set
void er_set (
int severity,
const char * file_name,
const int line_no,
int err_id,
int num_args,
...
)
function er_set_area_error
int er_set_area_error (
char * server_area
)
function er_set_ignore_uninit
void er_set_ignore_uninit (
bool ignore
)
function er_set_print_property
void er_set_print_property (
int print_console
)
function er_set_with_file
void er_set_with_file (
int severity,
const char * file_name,
const int line_no,
int err_id,
FILE * fp,
int num_args,
...
)
function er_set_with_oserror
void er_set_with_oserror (
int severity,
const char * file_name,
const int line_no,
int err_id,
int num_args,
...
)
function er_setid
void er_setid (
int err_id
)
function er_stack_clearall
void er_stack_clearall (
void
)
function er_stack_pop
void er_stack_pop (
void
)
function er_stack_pop_and_keep_error
void er_stack_pop_and_keep_error (
void
)
function er_stack_push
void er_stack_push (
void
)
function er_stack_push_if_exists
void er_stack_push_if_exists (
void
)
Public Static Functions Documentation
function _er_log_debug_internal
static void _er_log_debug_internal (
const char * file_name,
const int line_no,
const char * fmt,
va_list * ap
)
function er_call_stack_dump_on_error
static void er_call_stack_dump_on_error (
int severity,
int err_id
)
function er_call_stack_final
static void er_call_stack_final (
void
)
function er_call_stack_init
static int er_call_stack_init (
void
)
function er_clear_fmt
static void er_clear_fmt (
ER_FMT * fmt
)
function er_create_fmt_msg
static ER_FMT * er_create_fmt_msg (
ER_FMT * fmt,
int err_id,
const char * msg
)
function er_emergency
static void er_emergency (
const char * file,
int line,
const char * fmt,
...
)
function er_estimate_size
static size_t er_estimate_size (
ER_FMT * fmt,
va_list * ap
)
function er_event
static void er_event (
void
)
function er_event_final
static void er_event_final (
void
)
function er_event_init
static int er_event_init (
void
)
function er_event_sigpipe_handler
static void er_event_sigpipe_handler (
int sig
)
function er_file_backup
static FILE * er_file_backup (
FILE * fp,
const char * path
)
function er_file_isa_null_device
static bool er_file_isa_null_device (
const char * path
)
function er_file_open
static FILE * er_file_open (
const char * path
)
function er_find_fmt
static ER_FMT * er_find_fmt (
int err_id,
int num_args
)
function er_fname_free
static int er_fname_free (
const void * key,
void * data,
void * args
)
function er_init_fmt
static void er_init_fmt (
ER_FMT * fmt
)
function er_internal_msg
static void er_internal_msg (
ER_FMT * fmt,
int code,
int msg_num
)
function er_is_error_severity
static bool er_is_error_severity (
er_severity severity
)
function er_log
static void er_log (
int err_id
)
function er_malloc_helper
static void * er_malloc_helper (
std::size_t size,
const char * file,
int line
)
function er_notify_event_on_error
static void er_notify_event_on_error (
int err_id
)
function er_set_access_log_filename
static void er_set_access_log_filename (
void
)
function er_set_internal
static int er_set_internal (
int severity,
const char * file_name,
const int line_no,
int err_id,
int num_args,
bool include_os_error,
FILE * fp,
va_list * ap_ptr
)
function er_stop_on_error
static void er_stop_on_error (
void
)
function er_study_fmt
static void er_study_fmt (
ER_FMT * fmt
)
function er_study_spec
static int er_study_spec (
const char * conversion_spec,
char * simple_spec,
int * position,
int * width,
int * va_class
)
function er_vsprintf
static int er_vsprintf (
er_message * er_entry_p,
ER_FMT * fmt,
va_list * ap
)
Macro Definition Documentation
define ER_ACCESS_LOG_FILE_SUFFIX
#define ER_ACCESS_LOG_FILE_SUFFIX `".access"`
define ER_ERROR_WARNING_STRING
#define ER_ERROR_WARNING_STRING (
severity
) `/* multi line expression */`
define ER_INTERNAL_MSG_SET
#define ER_INTERNAL_MSG_SET `2`
define ER_MALLOC
#define ER_MALLOC (
size
) `er_malloc_helper ((size), __FILE__ , __LINE__ )`
define ER_MSG_LOG_FILE_SUFFIX
#define ER_MSG_LOG_FILE_SUFFIX `".err"`
define ER_MSG_SET
define ER_SEVERITY_STRING
#define ER_SEVERITY_STRING (
severity
) `/* multi line expression */`
define MAX_DOUBLE_WIDTH
#define MAX_DOUBLE_WIDTH `32`
define MAX_INT_WIDTH
#define MAX_INT_WIDTH `20`
define MAX_LINE
define PRM_ER_MSGLEVEL
#define PRM_ER_MSGLEVEL `0`
define SPEC_CODE_LONGLONG
#define SPEC_CODE_LONGLONG `(( char )0x88)`
define SPEC_CODE_SIZE_T
#define SPEC_CODE_SIZE_T `(( char )0x89)`
The documentation for this class was generated from the following file cubrid/src/base/error_manager.c