[BusyBox] Upcoming changes....
Erik Andersen
andersen at lineo.com
Fri Jun 30 19:58:06 UTC 2000
On Fri Jun 30, 2000 at 02:30:12PM -0400, Pavel Roskin wrote:
> Hello, Erik!
>
> > 1) struct BB_applet in internal.h will be getting a few new members:
> > int min_args;
> > int max_args;
>
> Is it about all arguments or about all non-option arguments? I'm afraid
> that only few apps will really benefit (i.e. eliminate code) from the
> former.
All arguments was what I had in mind. Right now a lot of apps have code in
them like:
if (argc <= 1)
usage(tar_usage);
I'm not expecting miracles (things like cat still have to do things
themselves), but I think this overhead may end up a net win. It is probably
worth further research to see if it really is a net win or not.
> > 6) All apps will migrate to using getopt for option parsing. Those
> > that need to handle long options (i.e. tar, rm, ln) will use
> > getopt to match "-" and then use strcmps and needed.
>
> Consider GNU getopt. More apps may need it / benefit from it.
Are you talking about getopt_long? I was just thinking of regular old
getopt(3). Long options should be pretty rare in busybox (outside of --help
and --version). This will let us optimize for the common case (i.e. short
options), which as a side effect increases cross-libc portability. Since the
few cases with long options can be handled, I think it will be a net win to use
just getopt. What do you think?
> > 7) All apps will have any now-redundant argument bounds checking
> > removed.
>
> I'm afraid it's not going to be a big win.
Right. As noted above, this one still needs to be researched to
see if it is a net win or not.
> It would be nice to rely on the linker, not on defines.
> I remember me seeing a hack for Linux that eliminated unneeded functions
> using some features of binutils.
You mean
CFLAGS += -ffunction-sections -fdata-sections
LDFLAGS += --gc-sections
which only works for static linking. I spent a few minutes a while back trying
to get this to do something but I couldn't make it work (I have some stuff
commented out in the Makefile -- experimenters welcome). The biggest win with
this would be making a static libbusybox.a out of the common stuff, and
staticlly linking busybox with it using --gc-sections to trim the cruft. It would
be very nice if this let us throw away most of the #defines.
Hmm. Unrelated thought:
I was just thinking that we could make a common function that would set up
stdin and/or stdout for any app that was interested, so that every app could
automagicaly be a filter.
-Erik
--
Erik B. Andersen email: andersen at lineo.com
--This message was written using 73% post-consumer electrons--
More information about the busybox
mailing list