|
From: Tom H. <th...@cy...> - 2004-02-11 09:58:23
|
In message <Pin...@ye...>
Nicholas Nethercote <nj...@ca...> wrote:
> On Wed, 11 Feb 2004, Tom Hughes wrote:
>
>> I wonder if system is implemented using vfork rather than fork?
>>
>> The NPTL C library implements fork using clone, and as part of
>> the NPTL/TLS changes I made valgrind handle that, but it may be
>> that vfork is also being done using clone with slightly different
>> flags and valgrind isn't catching that.
>>
>> Try stracing the test program without valgrind and see what
>> system calls the system() is doing.
>
> Full trace attached. The interesting bit is:
OK. It isn't vfork as such, it's a custom fork that system uses...
If you look at sysdeps/unix/sysv/linux/system.c in a recent glibc you
will see that it defines FORK() before including the generic version
of the system() code. That version of FORK() actually uses clone with
the CLONE_PARENT_SETTID flag to get the value of the child's PID in
a variable in the parent for cancellation.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|