mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Clean up a little more carefully around fork of pgstat subprocess.
Partial support for BEOS (not sure whether second fork of grandchild process needs these extra calls or not; someone who has BEOS will need to test it).
This commit is contained in:
parent
43cadb9231
commit
87fd2dbe7c
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 2001, PostgreSQL Global Development Group
|
* Copyright (c) 2001, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.8 2001/10/01 05:36:13 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/pgstat.c,v 1.9 2001/10/01 16:48:37 tgl Exp $
|
||||||
* ----------
|
* ----------
|
||||||
*/
|
*/
|
||||||
#include "postgres.h"
|
#include "postgres.h"
|
||||||
@ -273,9 +273,22 @@ pgstat_start(int real_argc, char *real_argv[])
|
|||||||
/*
|
/*
|
||||||
* Then fork off the collector. Remember its PID for pgstat_ispgstat.
|
* Then fork off the collector. Remember its PID for pgstat_ispgstat.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
#ifdef __BEOS__
|
||||||
|
/* Specific beos actions before backend startup */
|
||||||
|
beos_before_backend_startup();
|
||||||
|
#endif
|
||||||
|
|
||||||
switch ((pgStatPid = (int)fork()))
|
switch ((pgStatPid = (int)fork()))
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
|
#ifdef __BEOS__
|
||||||
|
/* Specific beos actions */
|
||||||
|
beos_backend_startup_failed();
|
||||||
|
#endif
|
||||||
perror("PGSTAT: fork(2)");
|
perror("PGSTAT: fork(2)");
|
||||||
pgStatRunning = 0;
|
pgStatRunning = 0;
|
||||||
return -1;
|
return -1;
|
||||||
@ -289,6 +302,18 @@ pgstat_start(int real_argc, char *real_argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* in postmaster child ... */
|
/* in postmaster child ... */
|
||||||
|
|
||||||
|
#ifdef __BEOS__
|
||||||
|
/* Specific beos actions after backend startup */
|
||||||
|
beos_backend_startup();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
IsUnderPostmaster = true; /* we are a postmaster subprocess now */
|
||||||
|
|
||||||
|
/* Lose the postmaster's on-exit routines */
|
||||||
|
on_exit_reset();
|
||||||
|
|
||||||
|
/* Close the postmaster's sockets, except for pgstat link */
|
||||||
ClosePostmasterPorts(false);
|
ClosePostmasterPorts(false);
|
||||||
|
|
||||||
pgstat_main(real_argc, real_argv);
|
pgstat_main(real_argc, real_argv);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user