dpkg 1.21.11
Macros | Typedefs | Enumerations | Functions | Variables
Error context handling
Collaboration diagram for Error context handling:

Macros

#define internerr(...)   do_internerr(__FILE__, __LINE__, __func__, __VA_ARGS__)
 

Typedefs

typedef void error_handler_func(void)
 
typedef void error_printer_func(const char *emsg, const void *data)
 

Enumerations

enum  { ehflag_normaltidy = DPKG_BIT(0) , ehflag_bombout = DPKG_BIT(1) , ehflag_recursiveerror = DPKG_BIT(2) }
 

Functions

void print_fatal_error (const char *emsg, const void *data)
 
void catch_fatal_error (void)
 Default fatal error handler. More...
 
void push_error_context_jump (jmp_buf *jumper, error_printer_func *printer, const void *printer_data)
 
void push_error_context_func (error_handler_func *handler, error_printer_func *printer, const void *printer_data)
 
void push_error_context (void)
 
void pop_error_context (int flagset)
 Unwind the current error context by running its registered cleanups. More...
 
void push_cleanup_fallback (void(*f1)(int argc, void **argv), int flagmask1, void(*f2)(int argc, void **argv), int flagmask2, unsigned int nargs,...)
 
void push_cleanup (void(*call)(int argc, void **argv), int flagmask, unsigned int nargs,...)
 
void push_checkpoint (int mask, int value)
 Push an error cleanup checkpoint. More...
 
void pop_cleanup (int flagset)
 
void ohshitv (const char *fmt, va_list args) DPKG_ATTR_NORET DPKG_ATTR_VPRINTF(1)
 
void ohshit (const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1)
 
void ohshite (const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1)
 
void do_internerr (const char *file, int line, const char *func, const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4)
 

Variables

volatile int onerr_abort
 

Detailed Description

Macro Definition Documentation

◆ internerr

#define internerr (   ...)    do_internerr(__FILE__, __LINE__, __func__, __VA_ARGS__)

Typedef Documentation

◆ error_handler_func

typedef void error_handler_func(void)

◆ error_printer_func

typedef void error_printer_func(const char *emsg, const void *data)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
ehflag_normaltidy 
ehflag_bombout 
ehflag_recursiveerror 

Function Documentation

◆ catch_fatal_error()

void catch_fatal_error ( void  )

Default fatal error handler.

This handler performs all error unwinding for the current context, and terminates the program with an error exit code.

References ehflag_bombout, and pop_error_context().

Referenced by push_error_context(), and subproc_fork().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ do_internerr()

void do_internerr ( const char *  file,
int  line,
const char *  func,
const char *  fmt,
  ... 
)

References args, color_get(), COLOR_PROG, dpkg_get_progname(), and error_context::func.

Here is the call graph for this function:

◆ ohshit()

void ohshit ( const char *  fmt,
  ... 
)

◆ ohshite()

void ohshite ( const char *  fmt,
  ... 
)

◆ ohshitv()

void ohshitv ( const char *  fmt,
va_list  args 
)

References args.

Referenced by forcibleerr().

Here is the caller graph for this function:

◆ pop_cleanup()

void pop_cleanup ( int  flagset)

Referenced by atomic_file_close(), md5hash(), modstatdb_unlock(), parsedb_close(), and subproc_signals_restore().

Here is the caller graph for this function:

◆ pop_error_context()

void pop_error_context ( int  flagset)

Unwind the current error context by running its registered cleanups.

Referenced by catch_fatal_error(), and dpkg_program_done().

Here is the caller graph for this function:

◆ print_fatal_error()

void print_fatal_error ( const char *  emsg,
const void *  data 
)

References color_get(), COLOR_PROG, and dpkg_get_progname().

Referenced by push_error_context().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_checkpoint()

void push_checkpoint ( int  mask,
int  value 
)

Push an error cleanup checkpoint.

This will arrange that when pop_error_context() is called, all previous cleanups will be executed with flagset = (original_flagset & mask) | value where original_flagset is the argument to pop_error_context() (as modified by any checkpoint which was pushed later).

References _, cleanup_entry::argc, cleanup_entry::argv, cleanup_entry::call, cleanup_entry::calls, cleanup_entry::cpmask, cleanup_entry::cpvalue, cleanup_entry::mask, NCALLS, cleanup_entry::next, ohshite(), and onerr_abort.

Here is the call graph for this function:

◆ push_cleanup()

void push_cleanup ( void(*)(int argc, void **argv)  call,
int  flagmask,
unsigned int  nargs,
  ... 
)

References args.

Referenced by atomic_file_open(), md5hash(), and parsedb_open().

Here is the caller graph for this function:

◆ push_cleanup_fallback()

void push_cleanup_fallback ( void(*)(int argc, void **argv)  f1,
int  flagmask1,
void(*)(int argc, void **argv)  f2,
int  flagmask2,
unsigned int  nargs,
  ... 
)

References args.

◆ push_error_context()

void push_error_context ( void  )

References catch_fatal_error(), print_fatal_error(), and push_error_context_func().

Referenced by commandfd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ push_error_context_func()

void push_error_context_func ( error_handler_func handler,
error_printer_func printer,
const void *  printer_data 
)

Referenced by push_error_context(), and subproc_fork().

Here is the caller graph for this function:

◆ push_error_context_jump()

void push_error_context_jump ( jmp_buf *  jumper,
error_printer_func printer,
const void *  printer_data 
)

Variable Documentation

◆ onerr_abort

volatile int onerr_abort
extern