busybox 1.1.3 - fork on nommu

Denis Vlasenko vda.linux at googlemail.com
Thu Oct 26 01:03:48 UTC 2006


On Thursday 26 October 2006 01:35, Rick Garcia wrote:
> 
> 	I'm working with BB1.1.3, so if at any point, I need to just upgrade to 
> 1.2.x, let me know :).
> 
> 	I'm looking at the "run" function in init.c - it's getting the struct 
> init_action ok, but immediately, it calls fork :
> 
> line 401:
> ...
> 	sigprocmask(SIG_BLOCK, &nmask, &omask);
> 
> 	if ((pid = fork()) == 0) {
> 		struct stat sb;
> 
> 		/* Clean up */
> 		close(0);
> 
> ...
> 
> 	and there's no check for the possibility that fork returns -1, as it 
> does on my m68k-nommu clone here.  Since fork can't really be 
> well-implemented without an mmu, I can't see how this isn't broken for 
> every nommu system out there - so my immediate conclusion is that I'm 
> already way off base about something else in my setup.  Any suggestions?

Someone was lazy and didn't code the check.
Send patch to fix it.

Well, I am unfortunately do not have nommu system here
(I would love an qemu-usable image of one. hint).

I see that we have some NOMMU friendly helpers:

* vfork_daemon_rexec() - a daemon() equivalent for NOMMU?
* spawn() - vfork()+exec()

but none is applicable to the piece of code you are talking of.

The more I look into it, init.c will need some surgery if you
want to make it work without forking (not fork+exec, just fork).

Hmm. There are only four fork() calls in init.c: three in run() and
one in reboot code. Maybe it will not be that hard? ;)
--
vda



More information about the busybox mailing list