diff options
author | Neil Conway <neilc@samurai.com> | 2005-03-10 07:14:03 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2005-03-10 07:14:03 +0000 |
commit | 164adc4d3924d5f0310dba24d4035313ca69245d (patch) | |
tree | 4a7dfc4714ac642f31b1a60d31ecdc4ba1d59065 /src/backend/postmaster/pgarch.c | |
parent | e829f822239186df59829afae5cc2769b783630b (diff) | |
download | postgresql-164adc4d3924d5f0310dba24d4035313ca69245d.tar.gz postgresql-164adc4d3924d5f0310dba24d4035313ca69245d.zip |
Refactor fork()-related code. We need to do various housekeeping tasks
before we can invoke fork() -- flush stdio buffers, save and restore the
profiling timer on Linux with LINUX_PROFILE, and handle BeOS stuff. This
patch moves that code into a single function, fork_process(), instead of
duplicating it at the various callsites of fork().
This patch doesn't address the EXEC_BACKEND case; there is room for
further cleanup there.
Diffstat (limited to 'src/backend/postmaster/pgarch.c')
-rw-r--r-- | src/backend/postmaster/pgarch.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 616e0a63272..fc2d9ce7299 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -19,7 +19,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.14 2004/12/31 22:00:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.15 2005/03/10 07:14:03 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -34,6 +34,7 @@ #include "access/xlog_internal.h" #include "libpq/pqsignal.h" #include "miscadmin.h" +#include "postmaster/fork_process.h" #include "postmaster/pgarch.h" #include "postmaster/postmaster.h" #include "storage/fd.h" @@ -141,25 +142,13 @@ pgarch_start(void) return 0; last_pgarch_start_time = curtime; - fflush(stdout); - fflush(stderr); - -#ifdef __BEOS__ - /* Specific beos actions before backend startup */ - beos_before_backend_startup(); -#endif - #ifdef EXEC_BACKEND switch ((pgArchPid = pgarch_forkexec())) #else - switch ((pgArchPid = fork())) + switch ((pgArchPid = fork_process())) #endif { case -1: -#ifdef __BEOS__ - /* Specific beos actions */ - beos_backend_startup_failed(); -#endif ereport(LOG, (errmsg("could not fork archiver: %m"))); return 0; @@ -167,10 +156,6 @@ pgarch_start(void) #ifndef EXEC_BACKEND case 0: /* in postmaster child ... */ -#ifdef __BEOS__ - /* Specific beos actions after backend startup */ - beos_backend_startup(); -#endif /* Close the postmaster's sockets */ ClosePostmasterPorts(false); |