---------------------------------- * Startup Process main entry point * ---------------------------------- */
| 217 | * ---------------------------------- |
| 218 | */ |
| 219 | void |
| 220 | StartupProcessMain(void) |
| 221 | { |
| 222 | am_startup = true; |
| 223 | /* Arrange to clean up at startup process exit */ |
| 224 | on_shmem_exit(StartupProcExit, 0); |
| 225 | /* |
| 226 | * Properly accept or ignore signals the postmaster might send us. |
| 227 | */ |
| 228 | pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */ |
| 229 | pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */ |
| 230 | pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */ |
| 231 | /* SIGQUIT handler was already set up by InitPostmasterChild */ |
| 232 | InitializeTimeouts(); /* establishes SIGALRM handler */ |
| 233 | pqsignal(SIGPIPE, SIG_IGN); |
| 234 | pqsignal(SIGUSR1, procsignal_sigusr1_handler); |
| 235 | pqsignal(SIGUSR2, StartupProcTriggerHandler); |
| 236 | |
| 237 | #ifdef SIGBUS |
| 238 | pqsignal(SIGBUS, HandleCrash); |
| 239 | #endif |
| 240 | #ifdef SIGILL |
| 241 | pqsignal(SIGILL, HandleCrash); |
| 242 | #endif |
| 243 | #ifdef SIGSEGV |
| 244 | pqsignal(SIGSEGV, HandleCrash); |
| 245 | #endif |
| 246 | |
| 247 | /* |
| 248 | * Reset some signals that are accepted by postmaster but not here |
| 249 | */ |
| 250 | pqsignal(SIGCHLD, SIG_DFL); |
| 251 | |
| 252 | /* |
| 253 | * Register timeouts needed for standby mode |
| 254 | */ |
| 255 | RegisterTimeout(STANDBY_DEADLOCK_TIMEOUT, StandbyDeadLockHandler); |
| 256 | RegisterTimeout(STANDBY_TIMEOUT, StandbyTimeoutHandler); |
| 257 | RegisterTimeout(STANDBY_LOCK_TIMEOUT, StandbyLockTimeoutHandler); |
| 258 | |
| 259 | /* |
| 260 | * Unblock signals (they were blocked when the postmaster forked us) |
| 261 | */ |
| 262 | PG_SETMASK(&UnBlockSig); |
| 263 | |
| 264 | /* |
| 265 | * Do what we came for. |
| 266 | */ |
| 267 | StartupXLOG(); |
| 268 | |
| 269 | /* |
| 270 | * Exit normally. Exit code 0 tells postmaster that we completed recovery |
| 271 | * successfully. |
| 272 | */ |
| 273 | proc_exit(0); |
| 274 | } |
| 275 | |
| 276 | void |
no test coverage detected