[BusyBox] builtin echo for ash

Rob Landley rob at landley.net
Sun Aug 7 21:35:14 UTC 2005

On Sunday 07 August 2005 06:28, Riku Voipio wrote:
> On Sat, Aug 06, 2005 at 10:33:16PM -0500, Rob Landley wrote:
> > On Saturday 06 August 2005 17:26, Shaun Jackman wrote:
> > > I'd guess the primary reason for the performance difference here is
> > > the fork(2) call.
> > > The typical solution in *nix was to provide a shell built-in as Paul
> > > has done. Busybox is in the unique position of being able to provide
> > > another solution, namely
> > > optionally providing a bb_fork() via longjmp implementation.
> >
> > I realise you think that's the greatest thing since sliced bread, but
> > what I've cared about for a while is that it should be possible for the
> > "standalone shell" to just call applets as functions (which they are) and
> > have them return sanely.  (And _that_ is why I care about the cleanup
> > stuff.)
> That would be really neat. I have created busybox with a few most common
> applets called directly, which seemed to increase speed quite a bit.
> However, it would be  ugly to add all the applets to builtincmd[] table of
> ash..

Check applets.c for run_applet_by_name();

It's fairly cool.  But right now you have to fork before using it because the 
applets don't clean up after itself (and if what you're calling is a nested 
invocation of ash, you have to exec() because ash's initialization relies on 
stuff starting out zeroed by the compiler...)

> > The setjmp/longjmp stuff there is completely unnecessary complication and
> > a hack for systems that have had lobotomies in the name of space.
> longjmp seems to be necessary to replace bb_error_msg_and_die from
> some places, like syntax() in coreutils/test.c. Which risks
> leaving static variables at a unexpected state. Is that what the
> cleanup work is about?

That's some of it.  And yeah, I can see longjmp for that.

I'm not saying that the setjmp/longjmp work is _bad_, just that it's not 
something that directly interests me enough to put effort into this.  
(However, it dovetails nicely with the areas I _am_ interested in, and as 
such I'm all for it, cleanly separated out.  Sorry if that wasn't clear.)

But right now, I need to finish testing mount, and then get 1.0.1-rc2 out.  
Off to work on that some more...


More information about the busybox mailing list