From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: EINTR in ftruncate()
Date: Thu, 14 Jul 2022 16:46:52 +0200
Message-ID: <20220714144652.jph7exiywushg4gc@alvherre.pgsql> (raw)
In-Reply-To: <CA+hUKGKx6Biq7_UuV0kn9DW+8QWcpJC1qwhizdtD9tN-fn0H0g@mail.gmail.com>
On 2022-Jul-15, Thomas Munro wrote:
> I checked that this throw-away assertion doesn't fail currently:
>
> if (IsUnderPostmaster)
> + {
> + sigset_t old;
> + sigprocmask(SIG_SETMASK, NULL, &old);
> + Assert(memcmp(&old, &UnBlockSig, sizeof(UnBlockSig)) == 0);
> PG_SETMASK(&BlockSig);
> + }
>
> ... but now I'm wondering if we should be more defensive and possibly
> even save/restore the mask.
Yeah, that sounds better to me.
> Originally I discounted that because I thought I had to go through
> PG_SETMASK for portability reasons, but on closer inspection, I don't
> see any reason not to use sigprocmask directly in Unix-only code.
ISTM it would be cleaner to patch PG_SETMASK to have a second argument
and to return the original mask if that's not NULL. This is more
invasive, but there aren't that many callsites of that macro.
--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
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: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, thomas.munro@gmail.com, andres@anarazel.de, pgsql-hackers@lists.postgresql.org
Subject: Re: EINTR in ftruncate()
In-Reply-To: <20220714144652.jph7exiywushg4gc@alvherre.pgsql>
* 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