Re: A bit of PG archeology uncovers an interesting Linux/Unix factoid

From: Greg Stark <stark(at)mit(dot)edu>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A bit of PG archeology uncovers an interesting Linux/Unix factoid
Date: 2016-02-16 01:03:52
Message-ID: CAM-w4HMtJZLHS7tMOxRoSNhAXvfNS1etL-qotcHy8r8cqz1bCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 16, 2016 at 12:51 AM, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
> If the calling process subsequently waits for its
> children, and the process has no unwaited for children that were
> transformed into zombie processes, it will block until all of its
> children terminate, and wait(), wait3(), waitid() and waitpid() will
> fail and set errno to [ECHILD].

Sure, but I don't see anything saying system() should be expected to
not handle this situation. At least there's nothing in the system.3
man page that says it should be expected to always return an error if
SIGCHILD is ignored.

And actually looking at that documentation it's not clear to me why
it's the case. I would have expected system to immediately call
waitpid after the fork and unless the subprocess was very quick that
should be sufficient to get the exit code. One might even imagine
having system intentionally have some kind interlock to ensure that
the parent has called waitpid before the child execs the shell.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2016-02-16 01:39:27 Re: [PROPOSAL] VACUUM Progress Checker.
Previous Message Tom Lane 2016-02-16 00:57:15 Re: postgres_fdw vs. force_parallel_mode on ppc