[BusyBox] insmod on old kernels

Julien Gaulmin julien23 at alcove.fr
Wed Feb 28 07:45:18 UTC 2001


Erik Andersen <andersen at lineo.com> wrote:
> I got this far and decided that I did not trust your test results since the
> functions you were testing do not work properly.  Then I got busy and forgot
> about it.  BTW, here is a linear search that should actually work:
>
>     struct BB_applet *find_applet_by_name(const char *name)
>     {
>       for(applet_using = (struct BB_applet *)applets;
>                           applet_using < &applets[NUM_APPLETS];
>               applet_using++) {
>           if(strcmp(applet_using->name, name)==0) {
>               return applet_using;
>           }
>       }
>       return 0;
>     }

Yes, I like this one better... as it works for me ;-)

Anyway, I still don't understand why strcmp() crashes in bsearch(). I did try
to put the bsearch() in run_applet_by_name() to avoid another function branch
but without more success? It is definitly strange.

julien


PS: Here is what strcmp() looks like in my uClibc version

#ifdef L_strcmp
int strcmp(d, s)
const char *d;
const char * s;
{
  /* There are a number of ways to do this and it really does depend on the
     types of strings given as to which is better, nevertheless the Glib
     method is quite reasonable so we'll take that */

#ifdef BCC_AX_ASM
... ASM (what arch is it for ???) ...
#else /* ifdef BCC_AX_ASM */
   register char *s1=(char *)d, *s2=(char *)s, c1,c2;
   while((c1= *s1++) == (c2= *s2++) && c1 );
   return c1 - c2;
#endif /* ifdef BCC_AX_ASM */
}
#endif

-- 
Julien Gaulmin - Open Source Software Engineer
Alcove, liberating software... http://www.alcove.com





More information about the busybox mailing list