diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-11-21 20:59:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-11-21 20:59:53 +0000 |
commit | 3ad0728c817bf8abd2c76bd11d856967509b307c (patch) | |
tree | ffaf56c059f678d2b41390027b8b9b973660cb7c /src/backend/tcop/postgres.c | |
parent | de597154a8acae01be28ba32b5b6e0ec4915ef3f (diff) | |
download | postgresql-3ad0728c817bf8abd2c76bd11d856967509b307c.tar.gz postgresql-3ad0728c817bf8abd2c76bd11d856967509b307c.zip |
On systems that have setsid(2) (which should be just about everything except
Windows), arrange for each postmaster child process to be its own process
group leader, and deliver signals SIGINT, SIGTERM, SIGQUIT to the whole
process group not only the direct child process. This provides saner behavior
for archive and recovery scripts; in particular, it's possible to shut down a
warm-standby recovery server using "pg_ctl stop -m immediate", since delivery
of SIGQUIT to the startup subprocess will result in killing the waiting
recovery_command. Also, this makes Query Cancel and statement_timeout apply
to scripts being run from backends via system(). (There is no support in the
core backend for that, but it's widely done using untrusted PLs.) Per gripe
from Stephen Harris and subsequent discussion.
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r-- | src/backend/tcop/postgres.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 8b014c887f5..03a3eca6abd 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.517 2006/11/21 00:49:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.518 2006/11/21 20:59:52 tgl Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2990,6 +2990,11 @@ PostgresMain(int argc, char *argv[], const char *username) pg_usleep(PostAuthDelay * 1000000L); /* + * You might expect to see a setsid() call here, but it's not needed, + * because if we are under a postmaster then BackendInitialize() did it. + */ + + /* * Set up signal handlers and masks. * * Note that postmaster blocked all signals before forking child process, |