tor  0.4.2.0-alpha-dev
torerr_sys.c
Go to the documentation of this file.
1 /* Copyright (c) 2018-2019, The Tor Project, Inc. */
2 /* See LICENSE for licensing information */
3 
9 #include "orconfig.h"
10 #include "lib/err/backtrace.h"
11 #include "lib/err/torerr.h"
12 #include "lib/err/torerr_sys.h"
13 #include "lib/subsys/subsys.h"
14 #include "lib/version/torversion.h"
15 
16 #include <stddef.h>
17 
18 static int
19 subsys_torerr_initialize(void)
20 {
21  if (configure_backtrace_handler(get_version()) < 0)
22  return -1;
24 
25  return 0;
26 }
27 static void
28 subsys_torerr_shutdown(void)
29 {
30  /* Stop handling signals with backtraces, then close the logs. */
32  /* We can't log any log messages after this point: we've closed all the log
33  * fds, including stdio. */
35 }
36 
37 const subsys_fns_t sys_torerr = {
38  .name = "err",
39  /* Low-level error handling is a diagnostic feature, we want it to init
40  * right after windows process security, and shutdown last.
41  * (Security never shuts down.) */
42  .level = -99,
43  .supported = true,
44  .initialize = subsys_torerr_initialize,
45  .shutdown = subsys_torerr_shutdown
46 };
Header for backtrace.c.
int configure_backtrace_handler(const char *tor_version)
Definition: backtrace.c:274
Declare subsystem object for torerr.c.
void tor_log_close_sigsafe_err_fds(void)
Definition: torerr.c:162
void clean_up_backtrace_handler(void)
Definition: backtrace.c:303
void tor_log_reset_sigsafe_err_fds(void)
Definition: torerr.c:147
Headers for torerr.c.
const char * name
Definition: subsys.h:28