diff options
| author | Tom Lane | 2020-07-16 02:05:12 +0000 |
|---|---|---|
| committer | Tom Lane | 2020-07-16 02:05:12 +0000 |
| commit | c6d43ffab3c0b25f1d745a3c920ec515e7c9d935 (patch) | |
| tree | cd2f3f1a6376931170edaf5c14836de1327c9ebd /src/include | |
| parent | c6d33d14408664ccd1ebcd2f4e7dddd54cfe698e (diff) | |
Replace use of sys_siglist[] with strsignal().
This commit back-patches the v12-era commits a73d08319, cc92cca43,
and 7570df0f3 into supported pre-v12 branches. The net effect is to
eliminate our former dependency on the never-standard sys_siglist[]
array, instead using POSIX-standard strsignal(3).
What motivates doing this now is that glibc just removed sys_siglist[]
from the set of symbols available to newly-built programs. While our
code can survive without sys_siglist[], it then fails to print any
description of the signal that killed a child process, which is a
non-negligible loss of friendliness. We can expect that people will
be wanting to build the back branches on platforms that include this
change, so we need to do something.
Since strsignal(3) has existed for quite a long time, and we've not
had any trouble with these patches so far in v12, it seems safe to
back-patch into older branches.
Discussion: https://postgr.es/m/3179114.1594853308@sss.pgh.pa.us
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/pg_config.h.in | 7 | ||||
| -rw-r--r-- | src/include/pg_config.h.win32 | 3 | ||||
| -rw-r--r-- | src/include/port.h | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index a19f6981d74..a33acbf2d89 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -182,10 +182,6 @@ don't. */ #undef HAVE_DECL_STRTOULL -/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you - don't. */ -#undef HAVE_DECL_SYS_SIGLIST - /* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you don't. */ #undef HAVE_DECL_VSNPRINTF @@ -547,6 +543,9 @@ /* Define to use have a strong random number source */ #undef HAVE_STRONG_RANDOM +/* Define to 1 if you have the `strsignal' function. */ +#undef HAVE_STRSIGNAL + /* Define to 1 if you have the `strtoll' function. */ #undef HAVE_STRTOLL diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 9bc4b3fc0f6..e48ded8973d 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -414,6 +414,9 @@ /* Define to use have a strong random number source */ #define HAVE_STRONG_RANDOM 1 +/* Define to 1 if you have the `strsignal' function. */ +/* #undef HAVE_STRSIGNAL */ + /* Define to 1 if you have the `strtoll' function. */ #ifdef HAVE_LONG_LONG_INT_64 #define HAVE_STRTOLL 1 diff --git a/src/include/port.h b/src/include/port.h index a9d557b55ca..c97d9be2502 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -189,6 +189,9 @@ extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2); #endif #endif /* USE_REPL_SNPRINTF */ +/* Wrap strsignal(), or provide our own version if necessary */ +extern const char *pg_strsignal(int signum); + /* Portable prompt handling */ extern void simple_prompt(const char *prompt, char *destination, size_t destlen, bool echo); |
