apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <...@manyfish.co.uk>
Subject Re: Problem with apr_proc_wait and/or svn_io_run_cmd
Date Thu, 23 Jan 2003 10:01:28 GMT
On Wed, Jan 22, 2003 at 11:44:08PM -0500, Eric Gillespie wrote:
> As an attempt to make this on-topic for both lists, i won't go
> into how i discovered the bug.  I don't think it's necessary.
> Correctly using waitpid(2) involves checking for EINTR and trying
> again.  That leads to common usage being something like this:

That does look like a bug.

> It looks like the APR equivalent is supposed to be:
>     do {
>         apr_err = apr_proc_wait (&cmd_proc, &exitcode_val,
>                                  &exitwhy_val, APR_WAIT);
>     } while (APR_STATUS_IS_CHILD_NOTDONE (apr_err));
> Is that correct?

I don't think so really: the child will only be "NOTDONE" if you pass in
APR_NOWAIT; otherwise, the waitpid waits until the child *is* done.

> It may be as simple as changing APR_STATUS_IS_CHILD_NOTDONE, in
> which case apr_proc_wait doesn't need to change at all.  But i am
> not sure that is the solution.  No matter what, svn_io_run_cmd
> will need to change so that it repeats the apr_proc_wait call as
> necessary (unless you want to make apr_proc_wait itself loop over
> waitpid(2), which i think is NOT the way to go).

My guess would be to make apr_proc_wait loop over waitpid whilst
errno=EINTR; that's what the rest of APR does.  Though the interactions
between waitpid and SIGCHLD here are a bit daunting, just from reading
the Linux waitpid() man page.



View raw message