dpkg 1.21.11
ehandle.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * ehandle.h - error handling
4 *
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2000,2001 Wichert Akkerman <wichert@debian.org>
7 *
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22#ifndef LIBDPKG_EHANDLE_H
23#define LIBDPKG_EHANDLE_H
24
25#include <setjmp.h>
26#include <stddef.h>
27#include <stdarg.h>
28
29#include <dpkg/macros.h>
30
32
39extern volatile int onerr_abort;
40
41enum {
45};
46
47typedef void error_handler_func(void);
48typedef void error_printer_func(const char *emsg, const void *data);
49
50void print_fatal_error(const char *emsg, const void *data);
51void catch_fatal_error(void);
52
53void push_error_context_jump(jmp_buf *jumper,
54 error_printer_func *printer,
55 const void *printer_data);
57 error_printer_func *printer,
58 const void *printer_data);
59void push_error_context(void);
60void pop_error_context(int flagset);
61
62void push_cleanup_fallback(void (*f1)(int argc, void **argv), int flagmask1,
63 void (*f2)(int argc, void **argv), int flagmask2,
64 unsigned int nargs, ...);
65void push_cleanup(void (*call)(int argc, void **argv), int flagmask,
66 unsigned int nargs, ...);
67void push_checkpoint(int mask, int value);
68void pop_cleanup(int flagset);
69
70void ohshitv(const char *fmt, va_list args)
72void ohshit(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
73void ohshite(const char *fmt, ...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1);
74
75void do_internerr(const char *file, int line, const char *func,
76 const char *fmt, ...)
78#define internerr(...) do_internerr(__FILE__, __LINE__, __func__, __VA_ARGS__)
79
83
84#endif /* LIBDPKG_EHANDLE_H */
void * args[20]
Definition: ehandle.c:89
void push_error_context_func(error_handler_func *handler, error_printer_func *printer, const void *printer_data)
Definition: ehandle.c:219
void push_error_context(void)
Definition: ehandle.c:245
void error_printer_func(const char *emsg, const void *data)
Definition: ehandle.h:48
void ohshite(const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1)
Definition: ehandle.c:469
void catch_fatal_error(void)
Default fatal error handler.
Definition: ehandle.c:111
void push_checkpoint(int mask, int value)
Push an error cleanup checkpoint.
Definition: ehandle.c:312
void push_cleanup_fallback(void(*f1)(int argc, void **argv), int flagmask1, void(*f2)(int argc, void **argv), int flagmask2, unsigned int nargs,...)
Definition: ehandle.c:379
void ohshit(const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(1)
Definition: ehandle.c:451
void push_error_context_jump(jmp_buf *jumper, error_printer_func *printer, const void *printer_data)
Definition: ehandle.c:232
void print_fatal_error(const char *emsg, const void *data)
Definition: ehandle.c:118
void pop_cleanup(int flagset)
Definition: ehandle.c:390
volatile int onerr_abort
Definition: ehandle.c:41
void ohshitv(const char *fmt, va_list args) DPKG_ATTR_NORET DPKG_ATTR_VPRINTF(1)
Definition: ehandle.c:462
void do_internerr(const char *file, int line, const char *func, const char *fmt,...) DPKG_ATTR_NORET DPKG_ATTR_PRINTF(4)
Definition: ehandle.c:495
void push_cleanup(void(*call)(int argc, void **argv), int flagmask, unsigned int nargs,...)
Definition: ehandle.c:368
void error_handler_func(void)
Definition: ehandle.h:47
void pop_error_context(int flagset)
Unwind the current error context by running its registered cleanups.
Definition: ehandle.c:407
@ ehflag_normaltidy
Definition: ehandle.h:42
@ ehflag_bombout
Definition: ehandle.h:43
@ ehflag_recursiveerror
Definition: ehandle.h:44
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_ATTR_VPRINTF(n)
Definition: macros.h:57
#define DPKG_ATTR_PRINTF(n)
Definition: macros.h:56
#define DPKG_END_DECLS
Definition: macros.h:87
#define DPKG_ATTR_NORET
Definition: macros.h:55
#define DPKG_BIT(n)
Return the integer value of bit n.
Definition: macros.h:125
Definition: main.c:133