System() returning ECHILD error on FreeBSD 7.2

Andriy Gapon avg at icyb.net.ua
Wed Feb 10 17:58:37 UTC 2010


on 10/02/2010 19:52 Garrett Cooper said the following:
>     Isn't this section of the system(3) libcall essentially doing what
> you want, s.t. you'll never be able to get the process status when you
> call waitpid(2)?
> 
>        do {
>            pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);
>        } while (pid == -1 && errno == EINTR);
>        break;
> 
>     You typically get status via wait*(2) when using exec*(2) or via
> the return codes from system(3), not system(3) with wait*(2)...

Exactly.  I think that SIGCHLD handler would effectively 'reap' the child and thus
wait*() in system would rightfully return ECHILD (perhaps after doing EINTR
iteration of the loop).

-- 
Andriy Gapon


More information about the freebsd-hackers mailing list