Browse code

Merge 466615c7e9f414c824ebc2a2fbe0613add4bafa2 into e676498f4d0a46ae81e4e07e56ff64c97a075faf

Guillem Jover authored on 20/10/2020 11:52:19 • GitHub committed on 20/10/2020 11:52:19
Showing 5 changed files
... ...
@@ -681,9 +681,9 @@ data_target = $(prefix)/$(data_dir)
681 681
 # -DPROFILING
682 682
 #		if enabled profiling will be enabled for child processes
683 683
 #		Don't forget to set PROFILE (see below)
684
-# -DNO_SIG_DEBUG
685
-#        turns off debugging messages in signal handlers (which might be
686
-#         unsafe)
684
+# -DUSE_UNSAFE_SIG_DEBUG
685
+#		turns on debugging messages in signal handlers (which are
686
+#		unsafe, but might be acceptable for occasional debugging)
687 687
 # -DUSE_NAPTR
688 688
 #		 turns on naptr support (but must be also enabled from the config)
689 689
 # -DDNS_WATCHDOG_SUPPORT
... ...
@@ -741,7 +741,7 @@ C_DEFS+= -DSHM_MMAP \
741 741
 	 #-DNOSMP \
742 742
 	 #-DNO_LOG \
743 743
 	 #-DPROFILING \
744
-	 #-DNO_SIG_DEBUG
744
+	 #-DUSE_UNSAFE_SIG_DEBUG
745 745
 
746 746
 #PROFILE=  -pg	# set this if you want profiling
747 747
 				# you may also want to set -DPROFILING
... ...
@@ -51,7 +51,7 @@ void km_log_func_set(km_log_f f)
51 51
 	_km_log_func = f;
52 52
 }
53 53
 
54
-#ifndef NO_SIG_DEBUG
54
+#ifndef USE_UNSAFE_SIG_DEBUG
55 55
 /* signal protection: !=0 when LOG/DBG/... are printing */
56 56
 volatile int dprint_crit = 0;
57 57
 #endif
... ...
@@ -173,7 +173,7 @@ void set_module_debug_facility_cb(get_module_debug_facility_f f);
173 173
 extern struct log_level_info log_level_info[];
174 174
 extern char *log_name;
175 175
 
176
-#ifndef NO_SIG_DEBUG
176
+#ifndef USE_UNSAFE_SIG_DEBUG
177 177
 /** @brief protection against "simultaneous" printing from signal handlers */
178 178
 extern volatile int dprint_crit;
179 179
 #endif
... ...
@@ -228,7 +228,7 @@ void log_prefix_init(void);
228 228
 
229 229
 #else
230 230
 
231
-#	ifdef NO_SIG_DEBUG
231
+#	ifdef USE_UNSAFE_SIG_DEBUG
232 232
 #		define DPRINT_NON_CRIT		(1)
233 233
 #		define DPRINT_CRIT_ENTER
234 234
 #		define DPRINT_CRIT_EXIT
... ...
@@ -276,10 +276,10 @@
276 276
 #define USE_DST_BLACKLIST_STR ""
277 277
 #endif
278 278
 
279
-#ifdef NO_SIG_DEBUG
280
-#define NO_SIG_DEBUG_STR ", NO_SIG_DEBUG"
279
+#ifdef USE_UNSAFE_SIG_DEBUG
280
+#define USE_UNSAFE_SIG_DEBUG_STR ", USE_UNSAFE_SIG_DEBUG"
281 281
 #else
282
-#define NO_SIG_DEBUG_STR ""
282
+#define USE_UNSAFE_SIG_DEBUG_STR ""
283 283
 #endif
284 284
 
285 285
 #ifdef HAVE_RESOLV_RES 
... ...
@@ -328,7 +328,7 @@
328 328
 	EXTRA_DEBUG_STR USE_TCP_STR USE_TLS_STR \
329 329
 	USE_SCTP_STR CORE_TLS_STR TLS_HOOKS_STR USE_RAW_SOCKS_STR \
330 330
 	DISABLE_NAGLE_STR USE_MCAST_STR NO_DEBUG_STR NO_LOG_STR \
331
-	NO_SIG_DEBUG_STR DNS_IP_HACK_STR \
331
+	USE_UNSAFE_SIG_DEBUG_STR DNS_IP_HACK_STR \
332 332
 	SHM_MMAP_STR PKG_MALLOC_STR \
333 333
 	Q_MALLOC_STR F_MALLOC_STR DL_MALLOC_STR SF_MALLOC_STR LL_MALLOC_STR TLSF_MALLOC_STR \
334 334
 	DBG_SR_MEMORY_STR DBG_QM_MALLOC_STR DBG_F_MALLOC_STR \
... ...
@@ -148,11 +148,11 @@
148 148
 #endif
149 149
 #include "core/ver.h"
150 150
 
151
-/* define SIG_DEBUG by default */
152
-#ifdef NO_SIG_DEBUG
153
-#undef SIG_DEBUG
154
-#else
151
+/* Do not define SIG_DEBUG by default */
152
+#ifdef USE_UNSAFE_SIG_DEBUG
155 153
 #define SIG_DEBUG
154
+#else
155
+#undef SIG_DEBUG
156 156
 #endif
157 157
 
158 158
 
... ...
@@ -831,8 +831,10 @@ void handle_sigs(void)
831 831
 void sig_usr(int signo)
832 832
 {
833 833
 
834
+#ifdef SIG_DEBUG /* signal unsafe stuff follows */
834 835
 #ifdef PKG_MALLOC
835 836
 	int memlog;
837
+#endif
836 838
 #endif
837 839
 
838 840
 	if (is_main){
... ...
@@ -879,6 +881,7 @@ void sig_usr(int signo)
879 881
 					_exit(0);
880 882
 					break;
881 883
 			case SIGUSR1:
884
+#ifdef SIG_DEBUG /* signal unsafe stuff follows */
882 885
 #ifdef PKG_MALLOC
883 886
 					cfg_update_no_cbs();
884 887
 					memlog=cfg_get(core, core_cfg, memlog);
... ...
@@ -892,6 +895,7 @@ void sig_usr(int signo)
892 895
 							pkg_sums();
893 896
 						}
894 897
 					}
898
+#endif
895 899
 #endif
896 900
 					break;
897 901
 				/* ignored*/