From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: EINTR in ftruncate() |
Date: | 2022-07-14 14:46:52 |
Message-ID: | 20220714144652.jph7exiywushg4gc@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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/
From | Date | Subject | |
---|---|---|---|
Next Message | tushar | 2022-07-14 14:53:37 | Re: replacing role-level NOINHERIT with a grant-level option |
Previous Message | Thomas Munro | 2022-07-14 14:26:10 | Re: EINTR in ftruncate() |