summaryrefslogtreecommitdiff
path: root/src/backend/postmaster/pgstat.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-01-13 13:12:37 +0100
committerAndres Freund <andres@anarazel.de>2015-01-14 00:33:14 +0100
commit31c453165b5a656044ce1dbce89f5828c1c7e23c (patch)
treeccf0a682b390361d581a7116d6244d7feb80cd45 /src/backend/postmaster/pgstat.c
parent2be82dcf17a18511df5153bcafe67a9c1387be1e (diff)
Commonalize process startup code.
Move common code, that was duplicated in every postmaster child/every standalone process, into two functions in miscinit.c. Not only does that already result in a fair amount of net code reduction but it also makes it much easier to remove more duplication in the future. The prime motivation wasn't code deduplication though, but easier addition of new common code.
Diffstat (limited to 'src/backend/postmaster/pgstat.c')
-rw-r--r--src/backend/postmaster/pgstat.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index ea3bd4b3e88..fa87660baee 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -695,12 +695,11 @@ pgstat_start(void)
#ifndef EXEC_BACKEND
case 0:
/* in postmaster child ... */
+ InitPostmasterChild();
+
/* Close the postmaster's sockets */
ClosePostmasterPorts(false);
- /* Lose the postmaster's on-exit routines */
- on_exit_reset();
-
/* Drop our connection to postmaster's shared memory, as well */
dsm_detach_all();
PGSharedMemoryDetach();
@@ -3152,23 +3151,6 @@ PgstatCollectorMain(int argc, char *argv[])
PgStat_Msg msg;
int wr;
- IsUnderPostmaster = true; /* we are a postmaster subprocess now */
-
- MyProcPid = getpid(); /* reset MyProcPid */
-
- MyStartTime = time(NULL); /* record Start Time for logging */
-
- /*
- * If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (pgstat probably never has any
- * child processes, but for consistency we make all postmaster child
- * processes do this.)
- */
-#ifdef HAVE_SETSID
- if (setsid() < 0)
- elog(FATAL, "setsid() failed: %m");
-#endif
-
InitializeLatchSupport(); /* needed for latch waits */
/* Initialize private latch for use by signal handlers */