Commit f53cd94a authored by Neil Conway's avatar Neil Conway

Use fork_process() to avoid some fork()-related boilerplate code when

forking the stats collector child process.
parent 26f831a9
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* Copyright (c) 2001-2005, PostgreSQL Global Development Group * Copyright (c) 2001-2005, PostgreSQL Global Development Group
* *
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.89 2005/03/31 23:20:49 tgl Exp $ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.90 2005/04/08 00:55:07 neilc Exp $
* ---------- * ----------
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "libpq/pqsignal.h" #include "libpq/pqsignal.h"
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "postmaster/fork_process.h"
#include "postmaster/postmaster.h" #include "postmaster/postmaster.h"
#include "storage/backendid.h" #include "storage/backendid.h"
#include "storage/fd.h" #include "storage/fd.h"
...@@ -576,26 +577,13 @@ pgstat_start(void) ...@@ -576,26 +577,13 @@ pgstat_start(void)
/* /*
* Okay, fork off the collector. * Okay, fork off the collector.
*/ */
fflush(stdout);
fflush(stderr);
#ifdef __BEOS__
/* Specific beos actions before backend startup */
beos_before_backend_startup();
#endif
#ifdef EXEC_BACKEND #ifdef EXEC_BACKEND
switch ((pgStatPid = pgstat_forkexec(STAT_PROC_BUFFER))) switch ((pgStatPid = pgstat_forkexec(STAT_PROC_BUFFER)))
#else #else
switch ((pgStatPid = fork())) switch ((pgStatPid = fork_process()))
#endif #endif
{ {
case -1: case -1:
#ifdef __BEOS__
/* Specific beos actions */
beos_backend_startup_failed();
#endif
ereport(LOG, ereport(LOG,
(errmsg("could not fork statistics buffer: %m"))); (errmsg("could not fork statistics buffer: %m")));
return 0; return 0;
...@@ -603,10 +591,6 @@ pgstat_start(void) ...@@ -603,10 +591,6 @@ pgstat_start(void)
#ifndef EXEC_BACKEND #ifndef EXEC_BACKEND
case 0: case 0:
/* in postmaster child ... */ /* in postmaster child ... */
#ifdef __BEOS__
/* Specific beos actions after backend startup */
beos_backend_startup();
#endif
/* Close the postmaster's sockets */ /* Close the postmaster's sockets */
ClosePostmasterPorts(false); ClosePostmasterPorts(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment