This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libiberty] Use pipe inside pex_run
- From: "Ian Lance Taylor via gcc-patches" <gcc-patches at gcc dot gnu dot org>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Martin Liška <mliska at suse dot cz>
- Date: Mon, 1 Oct 2018 11:18:26 -0700
- Subject: Re: [libiberty] Use pipe inside pex_run
- References: <c6aa8a97-0ac1-7b3e-fa15-d0d20c5de394@acm.org>
- Reply-to: Ian Lance Taylor <iant at google dot com>
On Mon, Oct 1, 2018 at 10:53 AM, Nathan Sidwell <nathan@acm.org> wrote:
> Ian,
> this patch implements the pipe error channel you suggested a while back.
> Before the (v)fork we create a pipe and set it up for CLOEXEC. If exec
> failure happens in the child, we write errno & the fnname to the pipe. In
> the parent we attempt to read the pipe. We'll get EOF if the child was
> successful. Otherwise we get the error and fn, which we pass back to our
> caller. As both child and parent are in the same address space, it's
> perfectly fine to pass string literal addresses down the pipe.
>
> An example of the difference is the behaviour of:
> ./xg++ -Bbogus ...
>
> before the patch we get:
> xg++: error trying to exec 'cc1plus': execvp: No such file or directory
>
> with the patch we get:
> xg++: fatal error: cannot execute ‘cc1plus’: execvp: No such file or
> directory
> compilation terminated.
>
> Martin has been kind enough to test this patch in his profiled-bootstrap
> build, and I've tested on AIX (where vfork is fork) as well asx86_64-linux.
Thanks for doing this.
This is OK.
Ian