pgsql: Modernize our code for looking up descriptive strings for Unixs

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Modernize our code for looking up descriptive strings for Unixs
Дата
Msg-id E1gYgw7-0005e1-Hm@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Modernize our code for looking up descriptive strings for Unix signals.

At least as far back as the 2008 spec, POSIX has defined strsignal(3)
for looking up descriptive strings for signal numbers.  We hadn't gotten
the word though, and were still using the crufty old sys_siglist array,
which is in no standard even though most Unixen provide it.

Aside from not being formally standards-compliant, this was just plain
ugly because it involved #ifdef's at every place using the code.

To eliminate the #ifdef's, create a portability function pg_strsignal,
which wraps strsignal(3) if available and otherwise falls back to
sys_siglist[] if available.  The set of Unixen with neither API is
probably empty these days, but on any platform with neither, you'll
just get "unrecognized signal".  All extant callers print the numeric
signal number too, so no need to work harder than that.

Along the way, upgrade pg_basebackup's child-error-exit reporting
to match the rest of the system.

Discussion: https://postgr.es/m/25758.1544983503@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a73d08319537d807a520a72bc5bd17279672c3de

Modified Files
--------------
configure                             |  2 +-
configure.in                          |  1 +
src/backend/postmaster/pgarch.c       | 11 ++----
src/backend/postmaster/postmaster.c   | 16 +++------
src/bin/pg_basebackup/pg_basebackup.c | 18 ++++------
src/common/wait_error.c               | 16 +++------
src/include/pg_config.h.in            |  3 ++
src/include/pg_config.h.win32         |  3 ++
src/include/port.h                    |  3 ++
src/port/Makefile                     |  2 +-
src/port/pgstrsignal.c                | 67 +++++++++++++++++++++++++++++++++++
src/test/regress/pg_regress.c         |  9 ++---
12 files changed, 97 insertions(+), 54 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Make error handling in parallel pg_upgrade less bogus.
Следующее
От: Michael Paquier
Дата:
Сообщение: pgsql: Make constraint rename issue relcache invalidation on targetrel