1 /*-------------------------------------------------------------------------
4 * Routines for interprocess signaling
7 * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/storage/procsignal.h
12 *-------------------------------------------------------------------------
17 #include "storage/procnumber.h"
21 * Reasons for signaling a Postgres child process (a backend or an auxiliary
22 * process, like checkpointer). We can cope with concurrent signals for different
23 * reasons. However, if the same reason is signaled multiple times in quick
24 * succession, the process is likely to observe only one notification of it.
25 * This is okay for the present uses.
27 * Also, because of race conditions, it's important that all the signals be
28 * defined so that no harm is done if a process mistakenly receives one.
32 PROCSIG_CATCHUP_INTERRUPT
, /* sinval catchup interrupt */
33 PROCSIG_NOTIFY_INTERRUPT
, /* listen/notify interrupt */
34 PROCSIG_PARALLEL_MESSAGE
, /* message from cooperating parallel backend */
35 PROCSIG_WALSND_INIT_STOPPING
, /* ask walsenders to prepare for shutdown */
36 PROCSIG_BARRIER
, /* global barrier interrupt */
37 PROCSIG_LOG_MEMORY_CONTEXT
, /* ask backend to log the memory contexts */
38 PROCSIG_PARALLEL_APPLY_MESSAGE
, /* Message from parallel apply workers */
40 /* Recovery conflict reasons */
41 PROCSIG_RECOVERY_CONFLICT_FIRST
,
42 PROCSIG_RECOVERY_CONFLICT_DATABASE
= PROCSIG_RECOVERY_CONFLICT_FIRST
,
43 PROCSIG_RECOVERY_CONFLICT_TABLESPACE
,
44 PROCSIG_RECOVERY_CONFLICT_LOCK
,
45 PROCSIG_RECOVERY_CONFLICT_SNAPSHOT
,
46 PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT
,
47 PROCSIG_RECOVERY_CONFLICT_BUFFERPIN
,
48 PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK
,
49 PROCSIG_RECOVERY_CONFLICT_LAST
= PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK
,
52 #define NUM_PROCSIGNALS (PROCSIG_RECOVERY_CONFLICT_LAST + 1)
56 PROCSIGNAL_BARRIER_SMGRRELEASE
, /* ask smgr to close files */
57 } ProcSignalBarrierType
;
60 * prototypes for functions in procsignal.c
62 extern Size
ProcSignalShmemSize(void);
63 extern void ProcSignalShmemInit(void);
65 extern void ProcSignalInit(bool cancel_key_valid
, int32 cancel_key
);
66 extern int SendProcSignal(pid_t pid
, ProcSignalReason reason
,
67 ProcNumber procNumber
);
68 extern void SendCancelRequest(int backendPID
, int32 cancelAuthCode
);
70 extern uint64
EmitProcSignalBarrier(ProcSignalBarrierType type
);
71 extern void WaitForProcSignalBarrier(uint64 generation
);
72 extern void ProcessProcSignalBarrier(void);
74 extern void procsignal_sigusr1_handler(SIGNAL_ARGS
);
76 /* ProcSignalHeader is an opaque struct, details known only within procsignal.c */
77 typedef struct ProcSignalHeader ProcSignalHeader
;
80 extern PGDLLIMPORT ProcSignalHeader
*ProcSignal
;
83 #endif /* PROCSIGNAL_H */