19#include "icalerror_p.h"
25#if defined(HAVE_BACKTRACE)
29static ICAL_GLOBAL_VAR
bool icalerror_errors_are_fatal =
false;
33 icalerror_errors_are_fatal = fatal;
38 return icalerror_errors_are_fatal;
41#if ICAL_SYNC_MODE == ICAL_SYNC_MODE_PTHREAD
44static pthread_key_t icalerrno_key;
45static pthread_once_t icalerrno_key_once = PTHREAD_ONCE_INIT;
47static void icalerrno_destroy(
void *buf)
50 pthread_setspecific(icalerrno_key, NULL);
53static void icalerrno_key_alloc(
void)
55 pthread_key_create(&icalerrno_key, icalerrno_destroy);
62 pthread_once(&icalerrno_key_once, icalerrno_key_alloc);
69 pthread_setspecific(icalerrno_key, _errno);
80 return &icalerrno_storage;
103#if defined(HAVE_BACKTRACE)
104 void *stack_frames[50];
109 size =
sizeof(stack_frames) /
sizeof(stack_frames[0]);
110 num = backtrace(stack_frames, (
int)size);
111 strings = backtrace_symbols(stack_frames, num);
112 for (i = 0; i < num; i++) {
113 if (strings != NULL) {
114 icalerrprintf(
"%s\n", strings[i]);
116 icalerrprintf(
"%p\n", stack_frames[i]);
119 free((
void *)strings);
void icalerror_set_errors_are_fatal(bool fatal)
Change if errors are fatal.
icalerrorenum * icalerror_icalerrno(void)
Returns the current icalerrno value.
bool icalerror_get_errors_are_fatal(void)
Determine if errors are fatal.
void icalerror_backtrace(void)
Prints backtrace.
void icalerror_set_errno(icalerrorenum x)
Sets the icalerrno to a given error.
void icalerror_clear_errno(void)
Resets icalerrno to ICAL_NO_ERROR.
Error handling for libical.
icalerrorstate icalerror_get_error_state(icalerrorenum error)
Gets the error state (severity) for a given error.
icalerrorenum
Represents the different types of errors that can be triggered in libical.
const char * icalerror_strerror(icalerrorenum e)
Finds the description string for error.
#define icalerrno
Access the current icalerrno value.
void icalmemory_free_buffer(void *buf)
Releases a buffer.
void * icalmemory_new_buffer(size_t size)
Creates new buffer with the specified size.
Common memory management routines.