Re: Obsolete coding in fork_process.c

Поиск
Список
Период
Сортировка
От Noah Misch
Тема Re: Obsolete coding in fork_process.c
Дата
Msg-id 20140502000053.GA1191730@tornado.leadboat.com
обсуждение исходный текст
Ответ на Re: Obsolete coding in fork_process.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Obsolete coding in fork_process.c
Список pgsql-hackers
On Thu, May 01, 2014 at 05:59:08PM -0400, Tom Lane wrote:
> I wrote:
> > Noah Misch <noah@leadboat.com> writes:
> >> Modern systems have other fflush(NULL) problems:
> 
> >> http://www.nntp.perl.org/group/perl.perl5.porters/2013/09/msg207692.html
> >> http://perl5.git.perl.org/metaconfig.git/blob/master:/U/perl/fflushall.U
> 
> > Fun.  I doubt that the postmaster's stdin would ever be a pipe, but
> > maybe we'd better leave well enough alone.  Should update the comment
> > though.
> 
> However ... after looking around I notice that fflush(NULL) is already
> being used in parallel pg_dump and pg_upgrade; and at least in the latter
> case I'm afraid to change that because it looks like there are probably
> other stdio output files open in the process.

Do those programs, operating in those modes, read from stdin or some other
long-lived, pipe-backed FILE*?

> BTW, while working on this I noticed that there are a boatload of places
> where we use system() or popen() without a prior fflush.  I suspect most
> of them are safe, or we'd have heard more complaints --- but shouldn't
> we clamp down on that?

You need the fflush() when forking and then using stdio in the child before
any exec().  Have you caught wind of any system() or popen() implementation
having that property?

-- 
Noah Misch
EnterpriseDB                                 http://www.enterprisedb.com



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Obsolete coding in fork_process.c
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Obsolete coding in fork_process.c