[RFA] save/restore environ in libiberty pex_unix_exec_child
Mon Dec 7 20:25:00 GMT 2009
On Mon, Dec 7, 2009 at 12:09 PM, DJ Delorie <firstname.lastname@example.org> wrote:
> If the child assignment truly clobbers the parent, won't the parent's
> assignment clobber the child?
> If it's portable enough, using exevpe/execve instead of execvp/execv
> would be preferred.
The context is a child running under vfork. While the linux man page
says one cannot assume, for example, that the parent is blocked until
the child execs/exits, it would be odd if in implementations where the
parent is not blocked that assignments in the parent clobbered the
child. s/odd/broken/ even. :-)
[from man vfork]
4.3BSD, POSIX.1-2001. The requirements put on vfork() by the
standards are weaker than those put on fork(2), so an implementation
where the two are
synonymous is compliant. In particular, the programmer cannot
rely on the parent remaining blocked until a call of execve(2) or
_exit(2) and cannot
rely on any specific behavior with respect to shared memory.
I don't disagree re. execve, *if* it's portable enough. I wasn't
prepared to investigate the full gamut of portability issues for this.
Some thought may have gone into what's there now (maybe, maybe not,
but I err'd on the side of being cautious). My patch seems like a
straightforward fix to what's there now.
More information about the Gdb-patches