builtin-commands + sash

Denis Vlasenko vda.linux at googlemail.com
Mon Jan 28 09:31:52 UTC 2008


On Monday 28 January 2008 04:26, kalyanatejaswi balabhadrapatruni wrote:
> > > ar, chattr, cmp, ed, file, grep, gunzip,
> > > lsattr, mknod, more, mount, mv, printenv, prompt,
> > > sum, tar, umount, where
> > 
> > These should all be available, but they don't need
> > to be marked as
> > built-in. 
> But if they are not implemented as builtin, we are
> loosing primary advantage of built-in commands, i.e.,
> no forking overhead. Isnt it?

One advantage of built-ins is that they are always available,
even if they are not present in /bin etc.
If you select SH_STANDALONE, this will be the case
for all applets.

No forking overhead is "nice to have" but usually not
that important. However, this is also supported by busybox
if you select PREFER_APPLETS option -
then some applets will be called internally.
To see what those "some applets" are, grep for NOFORK in applets.h:

USE_TEST(APPLET_NOFORK([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
USE_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename))
USE_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat))
USE_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname))
USE_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_NEVER, echo))
USE_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false))
USE_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hostid))
USE_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_NEVER, length))
USE_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname))
USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd))
USE_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm))
USE_RMDIR(APPLET_NOFORK(rmdir, rmdir, _BB_DIR_BIN, _BB_SUID_NEVER, rmdir))
USE_SEQ(APPLET_NOFORK(seq, seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER, seq))
USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep))
USE_SYNC(APPLET_NOFORK(sync, sync, _BB_DIR_BIN, _BB_SUID_NEVER, sync))
USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch))
USE_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true))
USE_USLEEP(APPLET_NOFORK(usleep, usleep, _BB_DIR_BIN, _BB_SUID_NEVER, usleep))
USE_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER, whoami))
USE_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes))

> If you can run ash, you can run the
> > others, if compiled in
> > busybox. You do have a configuration switch for
> > trying compiled-in
> > commands first.
> 
> Is CONFIG_FEATURE_SH_STANDALONE feature you are
> suggesting? As i understand, this feature helps in
> case my system is screwed up and busybox comes to the
> rescue with its commands. But again, it doesnt ensure
> "no forking" for non built-in commands. Isnt it?

SH_STANDALONE implies PREFER_APPLETS.
Yes, it doesn't automatically ensure "no forking" for
*all* applets, since many complex ones would be unsafe
in this mode. But NOFORK applets really will not fork.
We can gradually make more applets NOFORK-clean.
--
vda



More information about the busybox mailing list