This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: libiberty/pex-unix vfork abuse?
- From: "J.C. Pizarro" <jcpiza at gmail dot com>
- To: "Dave Korn" <dave dot korn at artimi dot com>, "Ian Lance Taylor" <iant at google dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 7 Dec 2007 18:24:13 +0100
- Subject: RE: libiberty/pex-unix vfork abuse?
On 2007/12/07, "Dave Korn" <dave.korn@artimi.com> wrote:
> > On the other hand, the setting of environ is very dubious and is
> > likely to break on real systems. The code should be changed to call
> > execve instead. Unfortunately there is no standard execvpe function.
> > Fortunately gcc never uses the variant which sets environ. Offhand
> > I'm not sure what does.
>
> Perhaps we could work around this case by setting environ in the parent
> before the vfork call and restoring it afterward, but we'd need kind of
> serialisation there, and I don't know how to do a critical section using
> pthreads/posix.
You can do a critical section mainly between processes using system calls of
IPC synchronization like filelocks, RPCs, shared memory with mmap and
mutexes/semaphores, messages passing through pipes as tunnels, MPI, etc.
Now well, a critical section between multithreaded processes are complicated.
J.C.Pizarro