2 * libdpkg - Debian packaging suite library routines
3 * ehandle.h - error handling
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2000,2001 Wichert Akkerman <wichert@debian.org>
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.
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.
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/>.
22 #ifndef LIBDPKG_EHANDLE_H
23 #define LIBDPKG_EHANDLE_H
29 #include <dpkg/macros.h>
34 * @defgroup ehandle Error context handling
35 * @ingroup dpkg-public
39 extern volatile int onerr_abort
;
42 ehflag_normaltidy
= DPKG_BIT(0),
43 ehflag_bombout
= DPKG_BIT(1),
44 ehflag_recursiveerror
= DPKG_BIT(2),
47 typedef void error_handler_func(void);
48 typedef void error_printer_func(const char *emsg
, const void *data
);
50 void print_fatal_error(const char *emsg
, const void *data
);
51 void catch_fatal_error(void);
53 void push_error_context_jump(jmp_buf *jumper
,
54 error_printer_func
*printer
,
55 const void *printer_data
);
56 void push_error_context_func(error_handler_func
*handler
,
57 error_printer_func
*printer
,
58 const void *printer_data
);
59 void push_error_context(void);
60 void pop_error_context(int flagset
);
62 void push_cleanup_fallback(void (*f1
)(int argc
, void **argv
), int flagmask1
,
63 void (*f2
)(int argc
, void **argv
), int flagmask2
,
65 void push_cleanup(void (*call
)(int argc
, void **argv
), int flagmask
,
67 void push_checkpoint(int mask
, int value
);
68 void pop_cleanup(int flagset
);
70 void ohshitv(const char *fmt
, va_list args
)
71 DPKG_ATTR_NORET
DPKG_ATTR_VPRINTF(1);
72 void ohshit(const char *fmt
, ...) DPKG_ATTR_NORET
DPKG_ATTR_PRINTF(1);
73 void ohshite(const char *fmt
, ...) DPKG_ATTR_NORET
DPKG_ATTR_PRINTF(1);
75 void do_internerr(const char *file
, int line
, const char *func
,
77 DPKG_ATTR_NORET
DPKG_ATTR_PRINTF(4);
78 #define internerr(...) do_internerr(__FILE__, __LINE__, __func__, __VA_ARGS__)
84 #endif /* LIBDPKG_EHANDLE_H */