pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Daniel Gustafsson <dgustafsson@postgresql.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
Date: Wed, 14 Sep 2022 11:06:35 -0400
Message-ID: <2684964.1663167995@sss.pgh.pa.us> (raw)
In-Reply-To: <E1oYTUJ-000JsF-OM@gemulon.postgresql.org>
References: <E1oYTUJ-000JsF-OM@gemulon.postgresql.org>

Daniel Gustafsson <dgustafsson@postgresql.org> writes:
> Since pg_recvlogical is also supposed to run as a daemon, teach it about
> SIGTERM as well and update the documentation to match.  While in there,
> change pg_receivewal's time_to_stop to be sig_atomic_t like it is in
> pg_recvlogical.

While looking at this commit, I wondered why both of those programs
are declaring their signal handlers like

static void
sigint_handler(int signum)

rather than our standard convention

static void
pmdie(SIGNAL_ARGS)

Evidently we don't (any longer?) have any platforms where SIGNAL_ARGS
is non-default, but that still doesn't make this good coding.  More
than once I've grepped for SIGNAL_ARGS to locate signal handlers.

Hmm, looks like same mistake in pg_waldump ... barring objection,
I'm going to run around and fix those.

I also notice that port.h has

typedef void (*pqsigfunc) (int signo);
extern pqsigfunc pqsignal(int signo, pqsigfunc func);

which is a bit inconsistent with the idea that SIGNAL_ARGS
might be different from that.  Shouldn't we declare it as

typedef void (*pqsigfunc) (SIGNAL_ARGS);

??  I'm definitely going to do that for testing, because then
I can alter SIGNAL_ARGS to help me find any other stragglers.

			regards, tom lane





view thread (5+ messages)  latest in thread

Message-ID: <2684964.1663167995@sss.pgh.pa.us>
Permalink:  ../2684964.1663167995@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2684964.1663167995@sss.pgh.pa.us

 · 

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, dgustafsson@postgresql.org
  Subject: Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical
  In-Reply-To: <2684964.1663167995@sss.pgh.pa.us>
  References: <E1oYTUJ-000JsF-OM@gemulon.postgresql.org> <2684964.1663167995@sss.pgh.pa.us>

* 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