why are init's arguments wiped ?

Ralf Friedl Ralf.Friedl at online.de
Mon Feb 1 13:26:29 UTC 2016


Nicolas CARRIER schrieb:
> "/proc/1/cmdline is not a standard Unix ..."
>
> I absolutely don't know any other OS, be it Unix or not... But don't 
> they provide a way to access the command-line used to launch a program ?
> In busybox's code at least, I see only one implementation of 
> read_cmdline, which reads the content of /proc/[PID]/cmdline.
> From that I conclude that only Unices having this file can have a 
> busybox ps implementation dealing with the command-line.
Busybox is primarily intended for Linux. While some of the applets are 
Posix compliant, others are very Linux specific.

Traditionally, Unix doesn't provide a way to access the comand-line of 
another program. Programs like ps used to do it anyway, but they had to 
be set-uid to root so that they could access the memory of another 
process. The whole /proc filesystem is not part of traditional Unix.

> What if I want to debug how init was launched ? The way it behaves now 
> makes it impossible to know if a runlevel has been passed, how it was 
> passed, or even if we are launching the right init binary.
Assuming you use Linux, which you do, you can use /proc/cmdline to see 
the Kernel command line. From this you can determine which init was use. 
Either it was specified, or the default was used. It also contains the 
runlevel that was passed to init.



More information about the busybox mailing list