aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/port.h5
-rw-r--r--src/interfaces/libpq/legacy-pqsignal.c12
-rw-r--r--src/port/pqsignal.c4
3 files changed, 17 insertions, 4 deletions
diff --git a/src/include/port.h b/src/include/port.h
index 1110e5ce0f5..4f9c0cfd0d7 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -564,7 +564,10 @@ extern int pg_check_dir(const char *dir);
/* port/pgmkdirp.c */
extern int pg_mkdir_p(char *path, int omode);
-/* port/pqsignal.c */
+/* port/pqsignal.c (see also interfaces/libpq/legacy-pqsignal.c) */
+#ifdef FRONTEND
+#define pqsignal pqsignal_fe
+#endif
typedef void (*pqsigfunc) (int signo);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);
diff --git a/src/interfaces/libpq/legacy-pqsignal.c b/src/interfaces/libpq/legacy-pqsignal.c
index db470df9ea6..2bed2120d76 100644
--- a/src/interfaces/libpq/legacy-pqsignal.c
+++ b/src/interfaces/libpq/legacy-pqsignal.c
@@ -28,10 +28,16 @@
* with the semantics it had in 9.2; in particular, this has different
* behavior for SIGALRM than the version in src/port/pqsignal.c.
*
- * libpq itself uses this only for SIGPIPE (and even then, only in
- * non-ENABLE_THREAD_SAFETY builds), so the incompatibility isn't
- * troublesome for internal references.
+ * libpq itself does not use this, nor does anything else in our code.
+ *
+ * src/include/port.h will #define pqsignal as pqsignal_fe,
+ * but here we want to export just plain "pqsignal". We can't rely on
+ * port.h's extern declaration either. (The point of that #define
+ * is to ensure that no in-tree code accidentally calls this version.)
*/
+#undef pqsignal
+extern pqsigfunc pqsignal(int signo, pqsigfunc func);
+
pqsigfunc
pqsignal(int signo, pqsigfunc func)
{
diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c
index 6cb0320edb1..ab8d83d3009 100644
--- a/src/port/pqsignal.c
+++ b/src/port/pqsignal.c
@@ -35,6 +35,10 @@
* Set up a signal handler, with SA_RESTART, for signal "signo"
*
* Returns the previous handler.
+ *
+ * Note: the actual name of this function is either pqsignal_fe when
+ * compiled with -DFRONTEND, or pqsignal when compiled without that.
+ * This is to avoid a name collision with libpq's legacy-pqsignal.c.
*/
pqsigfunc
pqsignal(int signo, pqsigfunc func)