My os has no fork/exec - can I use busybox?

Dan Fandrich dan at coneharvesters.com
Thu Nov 5 22:53:39 UTC 2009


On Thu, Nov 05, 2009 at 02:19:10PM -0800, busby1 at llnl.gov wrote:
> I'm writing user-level code on a high performance computer (IBM Blue
> Gene).  The OS is missing some system calls, including fork/exec.  I was
> hoping to use busybox to fill in some functionality, maybe like this:
> 
>   ret = bb_system("ls -l foo*");
> 
> E.g., I would need to build all the commands into the shell, and then
> call the shell itself using a library function, instead of the usual
> fork/exec (or system(3)) call.

Busybox will use vfork() if you have that. Or, you could marshall the
arguments for each call and call the applet directly, e.g.  ls_main()
to do a directory. Or, more generically, rename busybox's main() to
something else and call that in the same way for any applet, or write an
execl()-style wrapper around it to make it easier to marshall the arguments
from within a program.

The TODO list shows a few potential gotchas with this approach, though. Pipes
of course wouldn't work, and because the applets aren't reentrant, it
won't be trivital to work around. Also, some applets aren't very good about
cleaning up memory, relying on exit() to do it for them, which won't be
available in your case.

>>> Dan
-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved


More information about the busybox mailing list