Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit06a367c

Browse files
committed
Put back pqsignal() as an exported libpq symbol.
This reverts commitf7ab802. Per discussion, we can't remove anexported symbol without a SONAME bump, which we don't want to do.In particular that breaks usage of current libpq.so with pre-9.3versions of psql etc, which need libpq to export pqsignal().As noted in that commit message, exporting the symbol from libpgport.awon't work reliably; but actually we don't want to export src/port'simplementation anyway. Any pre-9.3 client is going to be expecting thedefinition that pqsignal() had before 9.3, which was that it didn'tset SA_RESTART for SIGALRM. Hence, put back pqsignal() in a separatesource file in src/interfaces/libpq, and give it the old semantics.Back-patch to v12.Discussion:https://postgr.es/m/E1g5vmT-0003K1-6S@gemulon.postgresql.org
1 parent3b5d372 commit06a367c

File tree

3 files changed

+59
-2
lines changed

3 files changed

+59
-2
lines changed

‎src/interfaces/libpq/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ endif
2929

3030
OBJS=fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o\
3131
fe-protocol2.o fe-protocol3.o pqexpbuffer.o fe-secure.o\
32-
libpq-events.o
32+
legacy-pqsignal.olibpq-events.o
3333

3434
# src/backend/utils/mb
3535
OBJS += encnames.o wchar.o

‎src/interfaces/libpq/exports.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ PQserverVersion 113
116116
PQgetssl 114
117117
pg_char_to_encoding 115
118118
pg_valid_server_encoding 116
119-
#pqsignal117 # no longer exported, see libpgport instead
119+
pqsignal 117
120120
PQprepare 118
121121
PQsendPrepare 119
122122
PQgetCancel 120
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* legacy-pqsignal.c
4+
* reliable BSD-style signal(2) routine stolen from RWW who stole it
5+
* from Stevens...
6+
*
7+
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8+
* Portions Copyright (c) 1994, Regents of the University of California
9+
*
10+
*
11+
* IDENTIFICATION
12+
* src/interfaces/libpq/legacy-pqsignal.c
13+
*
14+
*-------------------------------------------------------------------------
15+
*/
16+
#include"postgres_fe.h"
17+
18+
#include<signal.h>
19+
20+
21+
/*
22+
* This version of pqsignal() exists only because pre-9.3 releases
23+
* of libpq exported pqsignal(), and some old client programs still
24+
* depend on that. (Since 9.3, clients are supposed to get it from
25+
* libpgport instead.)
26+
*
27+
* Because it is only intended for backwards compatibility, we freeze it
28+
* with the semantics it had in 9.2; in particular, this has different
29+
* behavior for SIGALRM than the version in src/port/pqsignal.c.
30+
*
31+
* libpq itself uses this only for SIGPIPE (and even then, only in
32+
* non-ENABLE_THREAD_SAFETY builds), so the incompatibility isn't
33+
* troublesome for internal references.
34+
*/
35+
pqsigfunc
36+
pqsignal(intsigno,pqsigfuncfunc)
37+
{
38+
#ifndefWIN32
39+
structsigactionact,
40+
oact;
41+
42+
act.sa_handler=func;
43+
sigemptyset(&act.sa_mask);
44+
act.sa_flags=0;
45+
if (signo!=SIGALRM)
46+
act.sa_flags |=SA_RESTART;
47+
#ifdefSA_NOCLDSTOP
48+
if (signo==SIGCHLD)
49+
act.sa_flags |=SA_NOCLDSTOP;
50+
#endif
51+
if (sigaction(signo,&act,&oact)<0)
52+
returnSIG_ERR;
53+
returnoact.sa_handler;
54+
#else/* WIN32 */
55+
returnsignal(signo,func);
56+
#endif
57+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp