PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <signal.h>
#include <unistd.h>
#include <sys/stat.h>
#include "miscadmin.h"
#include "storage/dsm.h"
#include "storage/ipc.h"
#include "tcop/tcopprot.h"
Go to the source code of this file.
Data Structures | |
struct | ONEXIT |
Macros | |
#define | MAX_ON_EXITS 20 |
Functions | |
static void | proc_exit_prepare (int code) |
void | proc_exit (int code) |
void | shmem_exit (int code) |
static void | atexit_callback (void) |
void | on_proc_exit (pg_on_exit_callback function, Datum arg) |
void | before_shmem_exit (pg_on_exit_callback function, Datum arg) |
void | on_shmem_exit (pg_on_exit_callback function, Datum arg) |
void | cancel_before_shmem_exit (pg_on_exit_callback function, Datum arg) |
void | on_exit_reset (void) |
void | check_on_shmem_exit_lists_are_empty (void) |
Variables | |
bool | proc_exit_inprogress = false |
bool | shmem_exit_inprogress = false |
static bool | atexit_callback_setup = false |
static struct ONEXIT | on_proc_exit_list [MAX_ON_EXITS] |
static struct ONEXIT | on_shmem_exit_list [MAX_ON_EXITS] |
static struct ONEXIT | before_shmem_exit_list [MAX_ON_EXITS] |
static int | on_proc_exit_index |
static int | on_shmem_exit_index |
static int | before_shmem_exit_index |
|
static |
Definition at line 294 of file ipc.c.
References proc_exit_prepare().
Referenced by before_shmem_exit(), on_proc_exit(), and on_shmem_exit().
void before_shmem_exit | ( | pg_on_exit_callback | function, |
Datum | arg | ||
) |
Definition at line 337 of file ipc.c.
References ONEXIT::arg, arg, atexit_callback(), atexit_callback_setup, before_shmem_exit_index, before_shmem_exit_list, ereport, errcode(), errmsg_internal(), FATAL, ONEXIT::function, and MAX_ON_EXITS.
Referenced by ApplyLauncherMain(), AtEOXact_Namespace(), autoprewarm_main(), AuxiliaryProcessMainCommon(), CheckpointerMain(), Exec_ListenPreCommit(), InitPostgres(), InitTemporaryFileAccess(), injection_points_set_local(), LoadArchiveLibrary(), LockGXact(), logicalrep_worker_attach(), MarkAsPreparing(), ParallelApplyWorkerMain(), ParallelWorkerMain(), pgstat_initialize(), register_persistent_abort_backup_handler(), ReplicationSlotInitialize(), ReplSlotSyncWorkerMain(), and SetupApplyOrSyncWorker().
void cancel_before_shmem_exit | ( | pg_on_exit_callback | function, |
Datum | arg | ||
) |
Definition at line 394 of file ipc.c.
References arg, before_shmem_exit_index, before_shmem_exit_list, elog, and ERROR.
void check_on_shmem_exit_lists_are_empty | ( | void | ) |
Definition at line 432 of file ipc.c.
References before_shmem_exit_index, elog, FATAL, and on_shmem_exit_index.
Referenced by BackendInitialize().
void on_exit_reset | ( | void | ) |
Definition at line 416 of file ipc.c.
References before_shmem_exit_index, on_proc_exit_index, on_shmem_exit_index, and reset_on_dsm_detach().
Referenced by InitPostmasterChild().
void on_proc_exit | ( | pg_on_exit_callback | function, |
Datum | arg | ||
) |
Definition at line 309 of file ipc.c.
References ONEXIT::arg, arg, atexit_callback(), atexit_callback_setup, ereport, errcode(), errmsg_internal(), FATAL, ONEXIT::function, MAX_ON_EXITS, on_proc_exit_index, and on_proc_exit_list.
Referenced by CreateLockFile(), InitCatCache(), llvm_session_initialize(), PostgresMain(), PostmasterMain(), pq_init(), select_perl_context(), sepgsql_avc_init(), and smgrinit().
void on_shmem_exit | ( | pg_on_exit_callback | function, |
Datum | arg | ||
) |
Definition at line 365 of file ipc.c.
References ONEXIT::arg, arg, atexit_callback(), atexit_callback_setup, ereport, errcode(), errmsg_internal(), FATAL, ONEXIT::function, MAX_ON_EXITS, on_shmem_exit_index, and on_shmem_exit_list.
Referenced by AutoVacWorkerMain(), CreateAuxProcessResourceOwner(), dsm_postmaster_startup(), InitAuxiliaryProcess(), InitBufferManagerAccess(), InitProcess(), InitProcessPhase2(), InitWalSenderSlot(), InternalIpcMemoryCreate(), PgArchiverMain(), PGReserveSemaphores(), PGSharedMemoryCreate(), pgss_shmem_startup(), pgstat_beinit(), ProcSignalInit(), replorigin_session_setup(), SharedInvalBackendInit(), StartupProcessMain(), WalReceiverMain(), and WalSummarizerMain().
void proc_exit | ( | int | code | ) |
Definition at line 104 of file ipc.c.
References AmAutoVacuumWorkerProcess, DEBUG3, elog, exit(), mkdir, MyProcPid, PANIC, proc_exit_prepare(), S_IRWXG, S_IRWXO, S_IRWXU, and snprintf.
Referenced by apply_worker_exit(), ApplyWorkerMain(), auth_failed(), AutoVacWorkerMain(), BackendInitialize(), BackgroundWorkerMain(), BootstrapModeMain(), CheckerModeMain(), DisableSubscriptionAndExit(), errfinish(), ExitPostmaster(), HandleCheckpointerInterrupts(), HandleMainLoopInterrupts(), HandlePgArchInterrupts(), HandleStartupProcInterrupts(), HandleWalSummarizerInterrupts(), InitializeLogRepWorker(), maybe_reread_subscription(), PerformWalRecovery(), pg_attribute_noreturn(), PgArchiverMain(), PostgresMain(), PostgresSingleUserMain(), PreRestoreCommand(), process_syncing_tables_for_apply(), ProcessInterrupts(), ProcessParallelApplyInterrupts(), ProcessRepliesIfAny(), ProcessSlotSyncInterrupts(), ProcessStandbyMessage(), ReplSlotSyncWorkerMain(), RestoreArchivedFile(), slotsync_reread_config(), StartLogicalReplication(), StartReplication(), StartupProcessMain(), StartupProcShutdownHandler(), SysLoggerMain(), test_shm_mq_main(), WaitEventSetWaitBlock(), WalRcvWaitForStartPosition(), WalReceiverMain(), WalSndDone(), WalSndErrorCleanup(), WalSndWait(), and WalSummarizerMain().
|
static |
Definition at line 165 of file ipc.c.
References arg, CritSectionCount, DEBUG3, debug_query_string, elog, error_context_stack, ONEXIT::function, InterruptHoldoffCount, InterruptPending, on_proc_exit_index, on_proc_exit_list, proc_exit_inprogress, ProcDiePending, QueryCancelPending, and shmem_exit().
Referenced by atexit_callback(), and proc_exit().
void shmem_exit | ( | int | code | ) |
Definition at line 228 of file ipc.c.
References arg, before_shmem_exit_index, before_shmem_exit_list, DEBUG3, dsm_backend_shutdown(), elog, ONEXIT::function, on_shmem_exit_index, on_shmem_exit_list, and shmem_exit_inprogress.
Referenced by PostmasterStateMachine(), and proc_exit_prepare().
Definition at line 51 of file ipc.c.
Referenced by before_shmem_exit(), on_proc_exit(), and on_shmem_exit().
|
static |
Definition at line 85 of file ipc.c.
Referenced by before_shmem_exit(), cancel_before_shmem_exit(), check_on_shmem_exit_lists_are_empty(), on_exit_reset(), and shmem_exit().
|
static |
Definition at line 54 of file ipc.c.
Referenced by before_shmem_exit(), cancel_before_shmem_exit(), and shmem_exit().
|
static |
Definition at line 83 of file ipc.c.
Referenced by on_exit_reset(), on_proc_exit(), and proc_exit_prepare().
|
static |
Definition at line 54 of file ipc.c.
Referenced by on_proc_exit(), and proc_exit_prepare().
|
static |
Definition at line 84 of file ipc.c.
Referenced by check_on_shmem_exit_lists_are_empty(), on_exit_reset(), on_shmem_exit(), and shmem_exit().
|
static |
Definition at line 54 of file ipc.c.
Referenced by on_shmem_exit(), and shmem_exit().
Definition at line 40 of file ipc.c.
Referenced by die(), errstart(), llvm_release_context(), llvm_shutdown(), proc_exit_prepare(), ProcessRecoveryConflictInterrupts(), and StatementCancelHandler().
Definition at line 45 of file ipc.c.
Referenced by AtAbort_Portals(), and shmem_exit().