diff options
author | Thomas Munro <tmunro@postgresql.org> | 2018-07-11 12:40:58 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2018-07-11 12:47:06 +1200 |
commit | 9f09529952ac41a10e5874cba745c1c24e67ac79 (patch) | |
tree | 2648f22d9b6c1bd0767e73415688031ae16b5cf3 /src/backend/utils/init/miscinit.c | |
parent | 56a714721343e6f52c0b1b911c0f160592348e84 (diff) | |
download | postgresql-9f09529952ac41a10e5874cba745c1c24e67ac79.tar.gz postgresql-9f09529952ac41a10e5874cba745c1c24e67ac79.zip |
Use signals for postmaster death on Linux.
Linux provides a way to ask for a signal when your parent process dies.
Use that to make PostmasterIsAlive() very cheap.
Based on a suggestion from Andres Freund.
Author: Thomas Munro, Heikki Linnakangas
Reviewed-By: Michael Paquier
Discussion: https://postgr.es/m/7261eb39-0369-f2f4-1bb5-62f3b6083b5e%40iki.fi
Discussion: https://postgr.es/m/20180411002643.6buofht4ranhei7k%40alap3.anarazel.de
Diffstat (limited to 'src/backend/utils/init/miscinit.c')
-rw-r--r-- | src/backend/utils/init/miscinit.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index 03b28c3604a..4bb28938c27 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -43,6 +43,7 @@ #include "storage/ipc.h" #include "storage/latch.h" #include "storage/pg_shmem.h" +#include "storage/pmsignal.h" #include "storage/proc.h" #include "storage/procarray.h" #include "utils/builtins.h" @@ -304,6 +305,9 @@ InitPostmasterChild(void) if (setsid() < 0) elog(FATAL, "setsid() failed: %m"); #endif + + /* Request a signal if the postmaster dies, if possible. */ + PostmasterDeathSignalInit(); } /* |