config: disentangle PREFER_APPLETS from SH_STANDALONE and SH_NOFORK

On user request.
I thought enabling/disabling them all together is more consistent.
Evidently, some people do want them to be separately selectable.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-07-22 18:48:38 +02:00
parent 49117b4800
commit 0fb0045aa9
4 changed files with 11 additions and 6 deletions

View File

@ -143,7 +143,9 @@ int main(int argc, char **argv)
printf("};\n"); printf("};\n");
printf("#endif\n\n"); printf("#endif\n\n");
#if ENABLE_FEATURE_PREFER_APPLETS #if ENABLE_FEATURE_PREFER_APPLETS \
|| ENABLE_FEATURE_SH_STANDALONE \
|| ENABLE_FEATURE_SH_NOFORK
printf("const uint8_t applet_flags[] ALIGN1 = {\n"); printf("const uint8_t applet_flags[] ALIGN1 = {\n");
i = 0; i = 0;
while (i < NUM_APPLETS) { while (i < NUM_APPLETS) {

View File

@ -19,7 +19,9 @@ extern const uint8_t applet_flags[] ALIGN1;
extern const uint8_t applet_suid[] ALIGN1; extern const uint8_t applet_suid[] ALIGN1;
extern const uint8_t applet_install_loc[] ALIGN1; extern const uint8_t applet_install_loc[] ALIGN1;
#if ENABLE_FEATURE_PREFER_APPLETS #if ENABLE_FEATURE_PREFER_APPLETS \
|| ENABLE_FEATURE_SH_STANDALONE \
|| ENABLE_FEATURE_SH_NOFORK
# define APPLET_IS_NOFORK(i) (applet_flags[(i)/4] & (1 << (2 * ((i)%4)))) # define APPLET_IS_NOFORK(i) (applet_flags[(i)/4] & (1 << (2 * ((i)%4))))
# define APPLET_IS_NOEXEC(i) (applet_flags[(i)/4] & (1 << ((2 * ((i)%4))+1))) # define APPLET_IS_NOEXEC(i) (applet_flags[(i)/4] & (1 << ((2 * ((i)%4))+1)))
#else #else

View File

@ -68,7 +68,8 @@ pid_t FAST_FUNC xspawn(char **argv)
return pid; return pid;
} }
#if ENABLE_FEATURE_PREFER_APPLETS #if ENABLE_FEATURE_PREFER_APPLETS \
|| ENABLE_FEATURE_SH_NOFORK
static jmp_buf die_jmp; static jmp_buf die_jmp;
static void jump(void) static void jump(void)
{ {
@ -174,7 +175,7 @@ int FAST_FUNC run_nofork_applet(int applet_no, char **argv)
return rc & 0xff; /* don't confuse people with "exitcodes" >255 */ return rc & 0xff; /* don't confuse people with "exitcodes" >255 */
} }
#endif /* FEATURE_PREFER_APPLETS */ #endif /* FEATURE_PREFER_APPLETS || FEATURE_SH_NOFORK */
int FAST_FUNC spawn_and_wait(char **argv) int FAST_FUNC spawn_and_wait(char **argv)
{ {

View File

@ -88,7 +88,7 @@ config FEATURE_SH_EXTRA_QUIET
config FEATURE_SH_STANDALONE config FEATURE_SH_STANDALONE
bool "Standalone shell" bool "Standalone shell"
default n default n
depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS depends on (HUSH || ASH)
help help
This option causes busybox shells to use busybox applets This option causes busybox shells to use busybox applets
in preference to executables in the PATH whenever possible. For in preference to executables in the PATH whenever possible. For
@ -121,7 +121,7 @@ config FEATURE_SH_STANDALONE
config FEATURE_SH_NOFORK config FEATURE_SH_NOFORK
bool "Run 'nofork' applets directly" bool "Run 'nofork' applets directly"
default n default n
depends on (HUSH || ASH) && FEATURE_PREFER_APPLETS depends on (HUSH || ASH)
help help
This option causes busybox shells to not execute typical This option causes busybox shells to not execute typical
fork/exec/wait sequence, but call <applet>_main directly, fork/exec/wait sequence, but call <applet>_main directly,