Skip to content

Commit f53cd94

Browse files
author
Neil Conway
committed
Use fork_process() to avoid some fork()-related boilerplate code when
forking the stats collector child process.
1 parent 26f831a commit f53cd94

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2005, PostgreSQL Global Development Group
1515
*
16-
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.89 2005/03/31 23:20:49 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.90 2005/04/08 00:55:07 neilc Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -40,6 +40,7 @@
4040
#include "libpq/pqsignal.h"
4141
#include "mb/pg_wchar.h"
4242
#include "miscadmin.h"
43+
#include "postmaster/fork_process.h"
4344
#include "postmaster/postmaster.h"
4445
#include "storage/backendid.h"
4546
#include "storage/fd.h"
@@ -576,37 +577,20 @@ pgstat_start(void)
576577
/*
577578
* Okay, fork off the collector.
578579
*/
579-
580-
fflush(stdout);
581-
fflush(stderr);
582-
583-
#ifdef __BEOS__
584-
/* Specific beos actions before backend startup */
585-
beos_before_backend_startup();
586-
#endif
587-
588580
#ifdef EXEC_BACKEND
589581
switch ((pgStatPid = pgstat_forkexec(STAT_PROC_BUFFER)))
590582
#else
591-
switch ((pgStatPid = fork()))
583+
switch ((pgStatPid = fork_process()))
592584
#endif
593585
{
594586
case -1:
595-
#ifdef __BEOS__
596-
/* Specific beos actions */
597-
beos_backend_startup_failed();
598-
#endif
599587
ereport(LOG,
600588
(errmsg("could not fork statistics buffer: %m")));
601589
return 0;
602590

603591
#ifndef EXEC_BACKEND
604592
case 0:
605593
/* in postmaster child ... */
606-
#ifdef __BEOS__
607-
/* Specific beos actions after backend startup */
608-
beos_backend_startup();
609-
#endif
610594
/* Close the postmaster's sockets */
611595
ClosePostmasterPorts(false);
612596

0 commit comments

Comments
 (0)