Re: waitpid in pg_basebackup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: waitpid in pg_basebackup
Date: 2012-07-04 17:54:47
Message-ID: 25402.1341424487@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> waitpid() is used with "#ifdef HAVE_WAITPID" in reaper(), but NOT in
> BaseBackup().
> Why not? We can ensure that all platforms which PostgreSQL supports
> have waitpid()?
> If so, can we get rid of "#ifdef HAVE_WAITPID" in reaper()?

The Single Unix Spec V2 (1997) specifies both waitpid() and wait3(),
but says the latter is "legacy" and new applications should use only
waitpid(); furthermore it documents that platforms need not support
wait3() (they can just return ENOSYS instead of making it work).

I notice that pgbench also uses waitpid() unconditionally in its
"#ifndef ENABLE_THREAD_SAFETY" section. That's been there for
quite some time, making it even less likely that there are still
any platforms where waitpid() isn't available.

I agree, let's drop the support for waitpid() not being present.
It looks to me like we could remove the macro maze in reaper()
completely, if we fixed win32_waitpid() to not have an API randomly
different from the real waitpid(). That would be a noticeable
readability gain there.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2012-07-04 17:56:48 Re: Event Triggers reduced, v1
Previous Message Tom Lane 2012-07-04 17:30:25 Re: enhanced error fields