Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYTyM-0000Aa-86 for pgsql-committers@arkaria.postgresql.org; Wed, 14 Sep 2022 15:06:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oYTyK-0005v8-Cg for pgsql-committers@arkaria.postgresql.org; Wed, 14 Sep 2022 15:06:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYTyK-0005uz-5d for pgsql-committers@lists.postgresql.org; Wed, 14 Sep 2022 15:06:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYTyH-0008Ii-Gz; Wed, 14 Sep 2022 15:06:39 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 28EF6ZUQ2684965; Wed, 14 Sep 2022 11:06:35 -0400 From: Tom Lane To: Daniel Gustafsson cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Handle SIGTERM in pg_receivewal and pg_recvlogical In-reply-to: References: Comments: In-reply-to Daniel Gustafsson message dated "Wed, 14 Sep 2022 14:35:40 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2684963.1663167995.1@sss.pgh.pa.us> Date: Wed, 14 Sep 2022 11:06:35 -0400 Message-ID: <2684964.1663167995@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson 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