tor  0.4.2.0-alpha-dev
torerr.h
Go to the documentation of this file.
1 /* Copyright (c) 2001, Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
13 #ifndef TOR_TORERR_H
14 #define TOR_TORERR_H
15 
16 #include "lib/cc/compat_compiler.h"
17 
18 /* The raw_assert...() variants are for use within code that can't call
19  * tor_assertion_failed_() because of call circularity issues. */
20 #define raw_assert(expr) STMT_BEGIN \
21  if (!(expr)) { \
22  tor_raw_assertion_failed_msg_(__FILE__, __LINE__, #expr, NULL); \
23  abort(); \
24  } \
25  STMT_END
26 #define raw_assert_unreached(expr) raw_assert(0)
27 #define raw_assert_unreached_msg(msg) STMT_BEGIN \
28  tor_raw_assertion_failed_msg_(__FILE__, __LINE__, "0", (msg)); \
29  abort(); \
30  STMT_END
31 
32 void tor_raw_assertion_failed_msg_(const char *file, int line,
33  const char *expr,
34  const char *msg);
35 
37 #define TOR_SIGSAFE_LOG_MAX_FDS 8
38 
39 void tor_log_err_sigsafe(const char *m, ...);
40 int tor_log_get_sigsafe_err_fds(const int **out);
41 void tor_log_set_sigsafe_err_fds(const int *fds, int n);
44 
45 int format_hex_number_sigsafe(unsigned long x, char *buf, int max_len);
46 int format_dec_number_sigsafe(unsigned long x, char *buf, int max_len);
47 
48 #endif /* !defined(TOR_TORERR_H) */
void tor_log_sigsafe_err_set_granularity(int ms)
Definition: torerr.c:140
void tor_log_set_sigsafe_err_fds(const int *fds, int n)
Definition: torerr.c:115
void tor_log_reset_sigsafe_err_fds(void)
Definition: torerr.c:129
Utility macros to handle different features and behavior in different compilers.
int format_dec_number_sigsafe(unsigned long x, char *buf, int max_len)
Definition: torerr.c:245
void tor_log_err_sigsafe(const char *m,...)
Definition: torerr.c:70
int tor_log_get_sigsafe_err_fds(const int **out)
Definition: torerr.c:103
int format_hex_number_sigsafe(unsigned long x, char *buf, int max_len)
Definition: torerr.c:238
void tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, const char *msg)
Definition: torerr.c:152