Re: EINTR in ftruncate()

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: EINTR in ftruncate()
Дата
Msg-id 20220714144652.jph7exiywushg4gc@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: EINTR in ftruncate()  (Thomas Munro <thomas.munro@gmail.com>)
Ответы Re: EINTR in ftruncate()  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: EINTR in ftruncate()
Следующее
От: tushar
Дата:
Сообщение: Re: replacing role-level NOINHERIT with a grant-level option