PostgreSQL Source Code  git master
procsignal.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * procsignal.h
4  * Routines for interprocess signaling
5  *
6  *
7  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/storage/procsignal.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef PROCSIGNAL_H
15 #define PROCSIGNAL_H
16 
17 #include "storage/backendid.h"
18 
19 
20 /*
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.
26  *
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.
29  */
30 typedef enum
31 {
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 
39  /* Recovery conflict reasons */
46 
47  NUM_PROCSIGNALS /* Must be last! */
49 
50 typedef enum
51 {
52  /*
53  * XXX. PROCSIGNAL_BARRIER_PLACEHOLDER should be replaced when the first
54  * real user of the ProcSignalBarrier mechanism is added. It's just here
55  * for now because we can't have an empty enum.
56  */
59 
60 /*
61  * prototypes for functions in procsignal.c
62  */
63 extern Size ProcSignalShmemSize(void);
64 extern void ProcSignalShmemInit(void);
65 
66 extern void ProcSignalInit(int pss_idx);
67 extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
68  BackendId backendId);
69 
71 extern void WaitForProcSignalBarrier(uint64 generation);
72 extern void ProcessProcSignalBarrier(void);
73 
75 
76 #endif /* PROCSIGNAL_H */
void ProcSignalInit(int pss_idx)
Definition: procsignal.c:161
void ProcSignalShmemInit(void)
Definition: procsignal.c:125
void WaitForProcSignalBarrier(uint64 generation)
Definition: procsignal.c:392
Size ProcSignalShmemSize(void)
Definition: procsignal.c:111
void ProcessProcSignalBarrier(void)
Definition: procsignal.c:453
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
Definition: procsignal.c:332
int BackendId
Definition: backendid.h:21
void procsignal_sigusr1_handler(SIGNAL_ARGS)
Definition: procsignal.c:642
#define SIGNAL_ARGS
Definition: c.h:1333
size_t Size
Definition: c.h:540
ProcSignalBarrierType
Definition: procsignal.h:50
ProcSignalReason
Definition: procsignal.h:30
int SendProcSignal(pid_t pid, ProcSignalReason reason, BackendId backendId)
Definition: procsignal.c:261