This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using vfork() in do_system() instead of fork()


OK, my clone(VFORK|VM)/execl() implementation of system has passed my
own battery of tests, and now I'm looking for any other tests that I might
leverage.  I did some grepping through LTP, but didn't find anything that
tests system() specifically.  I'm especially interested in tests that verify
system()'s handling of signals and cancellation.

Does anyone have suggestions for where I might find good tests
for exercising the system() call?

Thanks,
Dave

On Tue, Jun 23, 2009 at 11:38 AM, Mike Frysinger<vapier@gentoo.org> wrote:
> On Tuesday 23 June 2009 14:16:02 David Wuertele wrote:
>> > Linux implements copy-on-write, therefore after the fork you shouldn't
>> > be using any more memory (modulo the new structures allocated by the
>> > kernel). Are you actually seeing memory usage double after the fork? I
>> > think your problem is elsewhere.
>>
>> I don't have direct evidence that the memory usage doubles, but system()
>> only fails if my app has consumed more than half of physical memory.
>>
>> One test I did was to write a program that allocates and touches more and
>> more memory, while running system() and my replacement of glibc's
>> system() that uses vfork() instead of fork(). ÂAfter the test program
>> allocates about half of remaining memory, the standard system() starts
>> returning -1, but my vfork() implementation continues to work right up
>> until there's really nothing free.
>
> since there's pretty much no chance of do_system() changing, why not use your
> simple wrapper. Âthe amount of code needed to do vfork+exec on a string is
> pretty small.
> -mike
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]