When doing "make sh", scripts/single.sh looks for MAYFORK commands to pull in 
as builtin's
Which means any command that is declared with MAYFORK is automatically included 
into the shell when doing "make sh".
TOYFLAG_MAYFORK is essentially "if we are calling this in the shell, don't 
fork/exec to save system resources"

There is a pretty large distinction between "I'd like this to be automatically 
put in the shell when doing 'make sh'"
and "I'd like to have this be used by the shell instead of forking if it's in 
the same toybox binary as it"

Commands like cat, ls, mv, cp, du, find, rm, etc would benefit by being MAYFORK 
commmands,
But it also would not make sense to automatically include them into a single 
command binary of the shell.

The solution to this, that would give a multicommand binary with a shell the 
ability to run faster by not forking off
processes. And a single command binary of the shell the ability to have 
commands like ':' without pulling in things like
find or rm, would be to create 2 flags with the same value, and only scan for 
one in scripts/single.sh.
I.e. changing the existing MAYFORK declarations to something else 
(TOYFLAG_SHELLDEP, maybe TOYFLAG_BUILTIN?).
Scanning for _that_ instead of MAYFORK in scripts/single.sh, and adding a 
declaration of it in lib/toyflag.h.

Thoughts? I already have this working, there isn't any build infrastructure I 
know of that breaks when you do this, 
and the only reason I am not sending a patch yet is because I dunno a actual 
good name for the flag

-   Oliver Webb <aquahobby...@proton.me>
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to