diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 7a2c45af38289b363ad034554666d55a31465b3c..bb771a63f2d7c9c8b0c8d4e2282283df7bf8e63b 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -561,6 +561,36 @@ PostmasterMain(int argc, char *argv[]) /* Initialize paths to installation files */ getInstallationPaths(argv[0]); + /* + * Set up signal handlers for the postmaster process. + * + * CAUTION: when changing this list, check for side-effects on the signal + * handling setup of child processes. See tcop/postgres.c, + * bootstrap/bootstrap.c, postmaster/bgwriter.c, postmaster/walwriter.c, + * postmaster/autovacuum.c, postmaster/pgarch.c, postmaster/pgstat.c, + * postmaster/syslogger.c, postmaster/bgworker.c and + * postmaster/checkpointer.c. + */ + pqinitmask(); + PG_SETMASK(&BlockSig); + + pqsignal(SIGHUP, SIGHUP_handler); /* reread config file and have + * children do same */ + pqsignal(SIGINT, pmdie); /* send SIGTERM and shut down */ + pqsignal(SIGQUIT, pmdie); /* send SIGQUIT and die */ + pqsignal(SIGTERM, pmdie); /* wait for children and shut down */ + pqsignal(SIGALRM, SIG_IGN); /* ignored */ + pqsignal(SIGPIPE, SIG_IGN); /* ignored */ + pqsignal(SIGUSR1, sigusr1_handler); /* message from child process */ + pqsignal(SIGUSR2, dummy_handler); /* unused, reserve for children */ + pqsignal(SIGCHLD, reaper); /* handle child termination */ + pqsignal(SIGTTIN, SIG_IGN); /* ignored */ + pqsignal(SIGTTOU, SIG_IGN); /* ignored */ + /* ignore SIGXFSZ, so that ulimit violations work like disk full */ +#ifdef SIGXFSZ + pqsignal(SIGXFSZ, SIG_IGN); /* ignored */ +#endif + /* * Options setup */ @@ -1108,36 +1138,6 @@ PostmasterMain(int argc, char *argv[]) on_proc_exit(unlink_external_pid_file, 0); } - /* - * Set up signal handlers for the postmaster process. - * - * CAUTION: when changing this list, check for side-effects on the signal - * handling setup of child processes. See tcop/postgres.c, - * bootstrap/bootstrap.c, postmaster/bgwriter.c, postmaster/walwriter.c, - * postmaster/autovacuum.c, postmaster/pgarch.c, postmaster/pgstat.c, - * postmaster/syslogger.c, postmaster/bgworker.c and - * postmaster/checkpointer.c. - */ - pqinitmask(); - PG_SETMASK(&BlockSig); - - pqsignal(SIGHUP, SIGHUP_handler); /* reread config file and have - * children do same */ - pqsignal(SIGINT, pmdie); /* send SIGTERM and shut down */ - pqsignal(SIGQUIT, pmdie); /* send SIGQUIT and die */ - pqsignal(SIGTERM, pmdie); /* wait for children and shut down */ - pqsignal(SIGALRM, SIG_IGN); /* ignored */ - pqsignal(SIGPIPE, SIG_IGN); /* ignored */ - pqsignal(SIGUSR1, sigusr1_handler); /* message from child process */ - pqsignal(SIGUSR2, dummy_handler); /* unused, reserve for children */ - pqsignal(SIGCHLD, reaper); /* handle child termination */ - pqsignal(SIGTTIN, SIG_IGN); /* ignored */ - pqsignal(SIGTTOU, SIG_IGN); /* ignored */ - /* ignore SIGXFSZ, so that ulimit violations work like disk full */ -#ifdef SIGXFSZ - pqsignal(SIGXFSZ, SIG_IGN); /* ignored */ -#endif - /* * If enabled, start up syslogger collection subprocess */