[uClinux-dev] binfmt_flat.c and multiple processes with the same executable file
mathieu.avila at laposte.net
Mon Oct 3 03:24:26 EDT 2005
Greg Ungerer wrote:
> Hi Mathieu,
> Avila Mathieu wrote:
>> I am currently trying to run multiple processes from the same
>> executable file. It seems that in that case, i get always the same
>> TEXT/DATA/BSS segments.
> Can you explain further, give your example?
> What architecture are you working with?
I am making a port of uClinux to the PowerPC (based on a 2.6.13 kernel),
specifically the 403GA in a NCD machine (explora401). However, it should
work for any other PowerPC.
My intent is to give it back to the community when it is finished.
Actually, i am able to boot, go through memory initialization, and run a
program; All relocations work fine, and my kernel is able to run a
Busybox shell, compiled together with uClibc.
My troubles now are coming from vfork and mmapping.
uClibc for PowerPC is using fork instead of vfork because :
/* Sigh. The vfork system call on powerpc
* seems to be completely broken. So just
* use fork instead */
Do you have any idea for this ?
That should be the reason why it used to get the same mapping for the
same file (it didn't copy some pages/data, i think)
I have forced it to use vfork, and it seems ok.
But when the 2nd process returns, unmmap crashes (nommu.c); it seems
some deallocations has already been done somewhere else. Or maybe it has
to be done in the arch-dependant code ? (i don't see things like this
When i comment that code (exit_mmap), it runs ok (although it's not a
solution). However, i have read that after a vfork, the forking program
waits until the 2nd one makes a "exit" or "execve". When it makes exit
directly, the 1st program gets back (ok), but it still blocks when the
2nd program makes a execve, even if it returns. Do you have any idea ?
Do i have to change it's running state, or read its return code or
something like this ? Shouldn't it be done automatically by a signal
sent to the parent process ?
Thanks for your help; I hope to give a uClinux for PowerPC soon ;)
>> I tried using a gzipped version of my file, hoping it would be copied
>> elsewhere each time it is being run. But it's not the case.
> Can you run:
> flthdr <yourprogram>
> Lets see what flags are set.
>> "binfmt_flat.c" contains a mapping of the file, which it seems is
>> released only when the process ends, meaning another process gets the
>> same mapping (is it possible ?) Maybe this has been corrected in the
>> latest versions of uclinux ? I am currently running the one coming
>> from kernel 2.6.9.
> Greg Ungerer -- Chief Software Dude EMAIL: gerg at snapgear.com
> SnapGear -- a CyberGuard Company PHONE: +61 7 3435 2888
> 825 Stanley St, FAX: +61 7 3891 3630
> Woolloongabba, QLD, 4102, Australia WEB: http://www.SnapGear.com
> uClinux-dev mailing list
> uClinux-dev at uclinux.org
> This message was resent by uclinux-dev at uclinux.org
More information about the uClinux-dev