@@ -243,6 +243,13 @@ bool enable_bonjour = false;
243
243
char * bonjour_name ;
244
244
bool restart_after_crash = true;
245
245
bool remove_temp_files_after_crash = true;
246
+
247
+ /*
248
+ * When terminating child processes after fatal errors, like a crash of a
249
+ * child process, we normally send SIGQUIT -- and most other comments in this
250
+ * file are written on the assumption that we do -- but developers might
251
+ * prefer to use SIGABRT to collect per-child core dumps.
252
+ */
246
253
bool send_abort_for_crash = false;
247
254
bool send_abort_for_kill = false;
248
255
@@ -424,7 +431,6 @@ static int BackendStartup(ClientSocket *client_sock);
424
431
static void report_fork_failure_to_client (ClientSocket * client_sock , int errnum );
425
432
static CAC_state canAcceptConnections (BackendType backend_type );
426
433
static void signal_child (PMChild * pmchild , int signal );
427
- static void sigquit_child (PMChild * pmchild );
428
434
static bool SignalChildren (int signal , BackendTypeMask targetMask );
429
435
static void TerminateChildren (int signal );
430
436
static int CountChildren (BackendTypeMask targetMask );
@@ -2701,32 +2707,12 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
2701
2707
/*
2702
2708
* Signal all other child processes to exit. The crashed process has
2703
2709
* already been removed from ActiveChildList.
2710
+ *
2711
+ * We could exclude dead-end children here, but at least when sending
2712
+ * SIGABRT it seems better to include them.
2704
2713
*/
2705
2714
if (take_action )
2706
- {
2707
- dlist_iter iter ;
2708
-
2709
- dlist_foreach (iter , & ActiveChildList )
2710
- {
2711
- PMChild * bp = dlist_container (PMChild , elem , iter .cur );
2712
-
2713
- /* We do NOT restart the syslogger */
2714
- if (bp == SysLoggerPMChild )
2715
- continue ;
2716
-
2717
- if (bp == StartupPMChild )
2718
- StartupStatus = STARTUP_SIGNALED ;
2719
-
2720
- /*
2721
- * This backend is still alive. Unless we did so already, tell it
2722
- * to commit hara-kiri.
2723
- *
2724
- * We could exclude dead-end children here, but at least when
2725
- * sending SIGABRT it seems better to include them.
2726
- */
2727
- sigquit_child (bp );
2728
- }
2729
- }
2715
+ TerminateChildren (send_abort_for_crash ? SIGABRT : SIGQUIT );
2730
2716
2731
2717
if (Shutdown != ImmediateShutdown )
2732
2718
FatalError = true;
@@ -3349,19 +3335,6 @@ signal_child(PMChild *pmchild, int signal)
3349
3335
#endif
3350
3336
}
3351
3337
3352
- /*
3353
- * Convenience function for killing a child process after a crash of some
3354
- * other child process. We apply send_abort_for_crash to decide which signal
3355
- * to send. Normally it's SIGQUIT -- and most other comments in this file are
3356
- * written on the assumption that it is -- but developers might prefer to use
3357
- * SIGABRT to collect per-child core dumps.
3358
- */
3359
- static void
3360
- sigquit_child (PMChild * pmchild )
3361
- {
3362
- signal_child (pmchild , (send_abort_for_crash ? SIGABRT : SIGQUIT ));
3363
- }
3364
-
3365
3338
/*
3366
3339
* Send a signal to the targeted children.
3367
3340
*/
0 commit comments