1- From 44e4d28abd0a63a6e1c4a75c55ad27fb827dbfa4 Mon Sep 17 00:00:00 2001
2- From: Alexey Kondratov <
[email protected] >
3- Date: Fri, 18 Oct 2019 19:44:01 +0300
4- Subject: [PATCH] [custom_signals] Allow extensions to set custom signal
5- handlers
6-
7- ---
8- src/backend/storage/ipc/procsignal.c | 94 ++++++++++++++++++++++++++++
9- src/backend/tcop/postgres.c | 2 +
10- src/include/storage/procsignal.h | 19 ++++++
11- 3 files changed, 115 insertions(+)
12-
131diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c
14- index 7605b2c3674..0802ed1119b 100644
2+ index 7605b2c367..6a4327fe76 100644
153--- a/src/backend/storage/ipc/procsignal.c
164+++ b/src/backend/storage/ipc/procsignal.c
175@@ -60,12 +60,20 @@ typedef struct
@@ -72,7 +60,7 @@ index 7605b2c3674..0802ed1119b 100644
7260 /*
7361 * SendProcSignal
7462 * Send a signal to a Postgres process
75- @@ -292,9 +330,65 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
63+ @@ -292,9 +330,63 @@ procsignal_sigusr1_handler(SIGNAL_ARGS)
7664 if (CheckProcSignal(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN))
7765 RecoveryConflictInterrupt(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
7866
@@ -127,19 +115,17 @@ index 7605b2c3674..0802ed1119b 100644
127115+ if (CustomSignalPendings[i])
128116+ {
129117+ ProcSignalHandler_type handler;
130- + ProcSignalReason reason;
131118+
132119+ CustomSignalPendings[i] = false;
133120+ handler = CustomInterruptHandlers[i];
134- + reason = PROCSIG_CUSTOM_1 + i;
135121+ if (handler != NULL)
136- + handler(reason );
122+ + handler();
137123+ }
138124+
139125+ RESUME_INTERRUPTS();
140126+ }
141127diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
142- index c28cc370129..f5a48b98e86 100644
128+ index c28cc37012..f5a48b98e8 100644
143129--- a/src/backend/tcop/postgres.c
144130+++ b/src/backend/tcop/postgres.c
145131@@ -3139,6 +3139,8 @@ ProcessInterrupts(void)
@@ -152,7 +138,7 @@ index c28cc370129..f5a48b98e86 100644
152138
153139
154140diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h
155- index 05b186a05c2..84290d60975 100644
141+ index 05b186a05c..d961790b7e 100644
156142--- a/src/include/storage/procsignal.h
157143+++ b/src/include/storage/procsignal.h
158144@@ -17,6 +17,8 @@
@@ -189,7 +175,7 @@ index 05b186a05c2..84290d60975 100644
189175 } ProcSignalReason;
190176
191177+ /* Handler of custom process signal */
192- + typedef void (*ProcSignalHandler_type) (ProcSignalReason reason );
178+ + typedef void (*ProcSignalHandler_type) (void );
193179+
194180 /*
195181 * prototypes for functions in procsignal.c
@@ -208,6 +194,3 @@ index 05b186a05c2..84290d60975 100644
208194 extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
209195
210196 #endif /* PROCSIGNAL_H */
211- - -
212- 2.17.1
213-
0 commit comments