[PATCH] init: allow to preserve init's command-line

Daniel Thompson daniel.thompson at linaro.org
Wed Feb 3 12:02:31 UTC 2016


On 01/02/16 18:09, Nicolas CARRIER wrote:
> Thank you for all your comments.
> Please find a new version attached.

> +//config:config FEATURE_PRESERVE_CMDLINE
> +//config:	bool "Prevent init from altering its command-line after parsing"
> +//config:	default n
> +//config:	depends on INIT
> +//config:	help
> +//config:	  When launched as PID 1 and after parsing its arguments, init
> +//config:	  wipes all the arguments but argv[0] and rewrites argv[0] to
> +//config:	  contain only "init", so that its command-line appears solely as
> +//config:	  "init" in tools such as ps.
> +//config:	  If you set this option to Y, all the arguments including argv[0]
> +//config:	  will be preserved, be they parsed or ignored by init.
> +//config:	  The original command-line used to launch init can then be
> +//config:	  retrieved in /proc/1/cmdline on Linux, for example.

Having reviewed the thread I read FEATURE_PRESERVE_CMDLINE like a 
double-negative.

The feature is not preserving the cmdline; the feature is scrubbing the 
command line. It would be *much* easier to document the feature when we 
can say what is does do (i.e. increase compatibility with legacy unix 
environments) than by saying what it doesn't do.

I also think keeping scrubbing on by default is rather conservative. Why 
not be brave and default to smaller code size!


Daniel.


More information about the busybox mailing list