public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: [email protected]
Subject: pgsql: Centralize logic for restoring errno in signal handlers.
Date: Wed, 14 Feb 2024 22:35:19 +0000
Message-ID: <[email protected]> (raw)

Centralize logic for restoring errno in signal handlers.

Presently, we rely on each individual signal handler to save the
initial value of errno and then restore it before returning if
needed.  This is easily forgotten and, if missed, often goes
undetected for a long time.

In commit 3b00fdba9f, we introduced a wrapper signal handler
function that checks whether MyProcPid matches getpid().  This
commit moves the aforementioned errno restoration code from the
individual signal handlers to the new wrapper handler so that we no
longer need to worry about missing it.

Reviewed-by: Andres Freund, Noah Misch
Discussion: https://postgr.es/m/20231121212008.GA3742740%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/28e46325091dfac5c6ab9ea1e047a8d09dbd16e7

Modified Files
--------------
doc/src/sgml/sources.sgml             |  8 --------
src/backend/postmaster/autovacuum.c   |  4 ----
src/backend/postmaster/checkpointer.c |  4 ----
src/backend/postmaster/interrupt.c    |  8 --------
src/backend/postmaster/pgarch.c       |  4 ----
src/backend/postmaster/postmaster.c   | 16 ----------------
src/backend/postmaster/startup.c      | 12 ------------
src/backend/postmaster/syslogger.c    |  4 ----
src/backend/replication/walsender.c   |  4 ----
src/backend/storage/ipc/latch.c       |  4 ----
src/backend/storage/ipc/procsignal.c  |  4 ----
src/backend/tcop/postgres.c           |  8 --------
src/backend/utils/misc/timeout.c      |  4 ----
src/fe_utils/cancel.c                 |  3 ---
src/port/pqsignal.c                   |  6 ++++++
15 files changed, 6 insertions(+), 87 deletions(-)



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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: pgsql: Centralize logic for restoring errno in signal handlers.
  In-Reply-To: <[email protected]>

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

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