PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
auxprocess.c File Reference
#include "postgres.h"
#include <unistd.h>
#include <signal.h>
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/auxprocess.h"
#include "storage/condition_variable.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/procsignal.h"
#include "utils/memutils.h"
#include "utils/ps_status.h"
Include dependency graph for auxprocess.c:

Go to the source code of this file.

Functions

static void ShutdownAuxiliaryProcess (int code, Datum arg)
 
void AuxiliaryProcessMainCommon (void)
 

Function Documentation

◆ AuxiliaryProcessMainCommon()

void AuxiliaryProcessMainCommon ( void  )

Definition at line 39 of file auxprocess.c.

40{
42
43 /* Release postmaster's working memory context */
45 {
47 PostmasterContext = NULL;
48 }
49
50 init_ps_display(NULL);
51
53
55
56 /*
57 * As an auxiliary process, we aren't going to do the full InitPostgres
58 * pushups, but there are a couple of things that need to get lit up even
59 * in an auxiliary process.
60 */
61
62 /*
63 * Create a PGPROC so we can use LWLocks and access shared memory.
64 */
66
67 BaseInit();
68
69 ProcSignalInit(false, 0);
70
71 /*
72 * Auxiliary processes don't run transactions, but they may need a
73 * resource owner anyway to manage buffer pins acquired outside
74 * transactions (and, perhaps, other things in future).
75 */
77
78
79 /* Initialize backend status information */
82
83 /* register a before-shutdown callback for LWLock cleanup */
85
87}
static void ShutdownAuxiliaryProcess(int code, Datum arg)
Definition: auxprocess.c:97
void pgstat_beinit(void)
void pgstat_bestart(void)
#define Assert(condition)
Definition: c.h:815
bool IsUnderPostmaster
Definition: globals.c:119
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:337
MemoryContext PostmasterContext
Definition: mcxt.c:151
void MemoryContextDelete(MemoryContext context)
Definition: mcxt.c:454
@ NormalProcessing
Definition: miscadmin.h:461
@ InitProcessing
Definition: miscadmin.h:460
#define GetProcessingMode()
Definition: miscadmin.h:470
#define SetProcessingMode(mode)
Definition: miscadmin.h:472
bool IgnoreSystemIndexes
Definition: miscinit.c:81
void BaseInit(void)
Definition: postinit.c:606
void ProcSignalInit(bool cancel_key_valid, int32 cancel_key)
Definition: procsignal.c:166
void init_ps_display(const char *fixed_part)
Definition: ps_status.c:269
void CreateAuxProcessResourceOwner(void)
Definition: resowner.c:982
void InitAuxiliaryProcess(void)
Definition: proc.c:566

References Assert, BaseInit(), before_shmem_exit(), CreateAuxProcessResourceOwner(), GetProcessingMode, IgnoreSystemIndexes, init_ps_display(), InitAuxiliaryProcess(), InitProcessing, IsUnderPostmaster, MemoryContextDelete(), NormalProcessing, pgstat_beinit(), pgstat_bestart(), PostmasterContext, ProcSignalInit(), SetProcessingMode, and ShutdownAuxiliaryProcess().

Referenced by BackgroundWriterMain(), CheckpointerMain(), PgArchiverMain(), StartupProcessMain(), WalReceiverMain(), WalSummarizerMain(), and WalWriterMain().

◆ ShutdownAuxiliaryProcess()

static void ShutdownAuxiliaryProcess ( int  code,
Datum  arg 
)
static

Definition at line 97 of file auxprocess.c.

98{
102}
bool ConditionVariableCancelSleep(void)
void LWLockReleaseAll(void)
Definition: lwlock.c:1876
static void pgstat_report_wait_end(void)
Definition: wait_event.h:101

References ConditionVariableCancelSleep(), LWLockReleaseAll(), and pgstat_report_wait_end().

Referenced by AuxiliaryProcessMainCommon().