pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Modernize our code for looking up descriptive strings for Unix s
Date: Mon, 17 Dec 2018 00:39:07 +0000
Message-ID: <E1gYgw7-0005e1-Hm@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1gYgw7-0005e1-Hm@gemulon.postgresql.org>
Permalink:  ../E1gYgw7-0005e1-Hm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gYgw7-0005e1-Hm@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Modernize our code for looking up descriptive strings for Unix s
  In-Reply-To: <E1gYgw7-0005e1-Hm@gemulon.postgresql.org>
  References: <E1gYgw7-0005e1-Hm@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox