Re: [Patch] Create a new session in postmaster by calling setsid()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [Patch] Create a new session in postmaster by calling setsid()
Дата
Msg-id 13252.1546203405@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [Patch] Create a new session in postmaster by calling setsid()  (Heikki Linnakangas <hlinnaka@iki.fi>)
Ответы Re: [Patch] Create a new session in postmaster by calling setsid()  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Heikki Linnakangas <hlinnaka@iki.fi> writes:
> Here's a patch to implement that. Seems to work. There is a small window 
> between launching postmaster and installing the signal handler, though, 
> where CTRL-C on pg_ctl will not abort the server launch. I think that's 
> acceptable.

Hm ... you could partially forestall that by installing the signal handler
first.  But then you have to assume that storing a pid_t variable is
atomic, which perhaps is bad?  Though it's hard to credit that any
platform would need multiple instructions to do that.  Also, I suppose
there's still a window, since the fork will necessarily occur some time
before you're able to store the child PID into the variable.

Another possible idea is to block SIGINT from before the fork till after
you've set the variable.  But that seems overly complicated, and perhaps
not without problems of its own.  So on the whole I concur with your
approach.

> Forgot attachment, here it is.

This comment needs copy-editing:

+         * If the user hits interrupts the startup (e.g. with CTRL-C), we'd

Looks good otherwise.

            regards, tom lane


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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: [Patch] Create a new session in postmaster by calling setsid()
Следующее
От: Petr Jelinek
Дата:
Сообщение: Synchronizing slots from primary to standby