diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-07-31 20:26:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-07-31 20:26:23 +0000 |
commit | 2487d872e025312e7c16f0dd772190c6787efeea (patch) | |
tree | 32a3788fd497c755d9d8683c1ea5fa9f354f73f1 /src/backend/bootstrap/bootstrap.c | |
parent | a23c6415787bd1aa8f1c44446d689a874a78afea (diff) | |
download | postgresql-2487d872e025312e7c16f0dd772190c6787efeea.tar.gz postgresql-2487d872e025312e7c16f0dd772190c6787efeea.zip |
Create a multiplexing structure for signals to Postgres child processes.
This patch gets us out from under the Unix limitation of two user-defined
signal types. We already had done something similar for signals directed to
the postmaster process; this adds multiplexing for signals directed to
backends and auxiliary processes (so long as they're connected to shared
memory).
As proof of concept, replace the former usage of SIGUSR1 and SIGUSR2
for backends with use of the multiplexing mechanism. There are still some
hard-wired definitions of SIGUSR1 and SIGUSR2 for other process types,
but getting rid of those doesn't seem interesting at the moment.
Fujii Masao
Diffstat (limited to 'src/backend/bootstrap/bootstrap.c')
-rw-r--r-- | src/backend/bootstrap/bootstrap.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 5a0f852b6fe..ff31e5f040e 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.250 2009/02/18 15:58:41 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.251 2009/07/31 20:26:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,6 +35,7 @@ #include "storage/bufmgr.h" #include "storage/ipc.h" #include "storage/proc.h" +#include "storage/procsignal.h" #include "tcop/tcopprot.h" #include "utils/builtins.h" #include "utils/fmgroids.h" @@ -388,6 +389,19 @@ AuxiliaryProcessMain(int argc, char *argv[]) InitAuxiliaryProcess(); #endif + /* + * Assign the ProcSignalSlot for an auxiliary process. Since it + * doesn't have a BackendId, the slot is statically allocated based on + * the auxiliary process type (auxType). Backends use slots indexed + * in the range from 1 to MaxBackends (inclusive), so we use + * MaxBackends + AuxProcType + 1 as the index of the slot for an + * auxiliary process. + * + * This will need rethinking if we ever want more than one of a + * particular auxiliary process type. + */ + ProcSignalInit(MaxBackends + auxType + 1); + /* finish setting up bufmgr.c */ InitBufferPoolBackend(); |