[PATCH] init: Support standalone shell

Shaun Jackman sjackman at gmail.com
Wed May 24 17:31:17 UTC 2006


Ping! Comments?

Cheers,
Shaun

On 4/21/06, Shaun Jackman <sjackman at gmail.com> wrote:
> This patch calls run_applet_by_name when the standalone shell feature
> is enabled.
>
> Cheers,
> Shaun
>
> 2006-04-21  Shaun Jackman  <sjackman at gmail.com>
>
>         * init/init.c (run): Support CONFIG_FEATURE_SH_STANDALONE_SHELL.
>
> ============================================================
> --- init/init.c 91b3286fd0e49728adc3b204deae6d4729546dd4
> +++ init/init.c 33574ea601b172c0e23ce1aaa688b047ea1a4371
> @@ -389,7 +389,7 @@
>
>  static pid_t run(const struct init_action *a)
>  {
> -       int i, junk;
> +       int i, junk, argc;
>         pid_t pid;
>         char *s, *tmpCmd, *cmd[INIT_BUFFS_SIZE], *cmdpath;
>         char buf[INIT_BUFFS_SIZE + 6];  /* INIT_BUFFS_SIZE+strlen("exec ")+1 */
> @@ -504,6 +504,7 @@
>                         cmd[1] = "-c";
>                         cmd[2] = strcat(strcpy(buf, "exec "), a->command);
>                         cmd[3] = NULL;
> +                       argc = 3;
>                 } else {
>                         /* Convert command (char*) into cmd (char**, one word per string) */
>                         strcpy(buf, a->command);
> @@ -515,6 +516,7 @@
>                                 }
>                         }
>                         cmd[i] = NULL;
> +                       argc = i;
>                 }
>
>                 cmdpath = cmd[0];
> @@ -585,6 +587,14 @@
>                 }
>  #endif
>
> +#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
> +               /* Try an applet first. */
> +               if (strcmp(cmdpath, DEFAULT_SHELL) == 0)
> +                       run_applet_by_name(DEFAULT_SHELL_SHORT_NAME, argc, cmd);
> +               else
> +                       run_applet_by_name(cmdpath, argc, cmd);
> +#endif
> +
>                 /* Now run it.  The new program will take over this PID,
>                  * so nothing further in init.c should be run. */
>                 execv(cmdpath, cmd);
>
>



More information about the busybox mailing list