6464#include <signal.h>
6565#include <sys/types.h>
6666#include <sys/time.h>
67- #include <time.h>
6867#include <unistd.h>
6968
7069#include "access/heapam.h"
@@ -383,12 +382,11 @@ StartAutoVacLauncher(void)
383382#ifndef EXEC_BACKEND
384383 case 0 :
385384 /* in postmaster child ... */
385+ InitPostmasterChild ();
386+
386387 /* Close the postmaster's sockets */
387388 ClosePostmasterPorts (false);
388389
389- /* Lose the postmaster's on-exit routines */
390- on_exit_reset ();
391-
392390 AutoVacLauncherMain (0 , NULL );
393391 break ;
394392#endif
@@ -408,16 +406,8 @@ AutoVacLauncherMain(int argc, char *argv[])
408406{
409407 sigjmp_buf local_sigjmp_buf ;
410408
411- /* we are a postmaster subprocess now */
412- IsUnderPostmaster = true;
413409 am_autovacuum_launcher = true;
414410
415- /* reset MyProcPid */
416- MyProcPid = getpid ();
417-
418- /* record Start Time for logging */
419- MyStartTime = time (NULL );
420-
421411 /* Identify myself via ps */
422412 init_ps_display ("autovacuum launcher process" , "" , "" , "" );
423413
@@ -429,17 +419,6 @@ AutoVacLauncherMain(int argc, char *argv[])
429419
430420 SetProcessingMode (InitProcessing );
431421
432- /*
433- * If possible, make this process a group leader, so that the postmaster
434- * can signal any child processes too. (autovacuum probably never has any
435- * child processes, but for consistency we make all postmaster child
436- * processes do this.)
437- */
438- #ifdef HAVE_SETSID
439- if (setsid () < 0 )
440- elog (FATAL , "setsid() failed: %m" );
441- #endif
442-
443422 /*
444423 * Set up signal handlers. We operate on databases much like a regular
445424 * backend, so we use the same signal handling. See equivalent code in
@@ -1455,12 +1434,11 @@ StartAutoVacWorker(void)
14551434#ifndef EXEC_BACKEND
14561435 case 0 :
14571436 /* in postmaster child ... */
1437+ InitPostmasterChild ();
1438+
14581439 /* Close the postmaster's sockets */
14591440 ClosePostmasterPorts (false);
14601441
1461- /* Lose the postmaster's on-exit routines */
1462- on_exit_reset ();
1463-
14641442 AutoVacWorkerMain (0 , NULL );
14651443 break ;
14661444#endif
@@ -1481,32 +1459,13 @@ AutoVacWorkerMain(int argc, char *argv[])
14811459 sigjmp_buf local_sigjmp_buf ;
14821460 Oid dbid ;
14831461
1484- /* we are a postmaster subprocess now */
1485- IsUnderPostmaster = true;
14861462 am_autovacuum_worker = true;
14871463
1488- /* reset MyProcPid */
1489- MyProcPid = getpid ();
1490-
1491- /* record Start Time for logging */
1492- MyStartTime = time (NULL );
1493-
14941464 /* Identify myself via ps */
14951465 init_ps_display ("autovacuum worker process" , "" , "" , "" );
14961466
14971467 SetProcessingMode (InitProcessing );
14981468
1499- /*
1500- * If possible, make this process a group leader, so that the postmaster
1501- * can signal any child processes too. (autovacuum probably never has any
1502- * child processes, but for consistency we make all postmaster child
1503- * processes do this.)
1504- */
1505- #ifdef HAVE_SETSID
1506- if (setsid () < 0 )
1507- elog (FATAL , "setsid() failed: %m" );
1508- #endif
1509-
15101469 /*
15111470 * Set up signal handlers. We operate on databases much like a regular
15121471 * backend, so we use the same signal handling. See equivalent code in
0 commit comments