On 2014-08-26 01:48, Shea Levy wrote: > Hi all, > > Is there any official documentation of the init process? I'm > specifically interested in the process state at kernel handoff (argv, > envp, open fds, etc.) as well as any special properties pid 1 has > (parent of all orphans, anything else?). > > Thanks, > Shea Levy > > P.S. I am not subscribed to LKML, please CC me in responses This is following is just my understanding based on what I have seen and read, and I may well be totally wrong on some points (if that is the case, I would love to know about it, I'm always trying to learn more).
As far as I can tell, the argv that gets passed to the init process is the concatenation of all arguments on the kernel command-line that the kernel doesn't recognize or parse. A lot of LiveCD's make use of this to control hardware detection and module loading. The only open file descriptors (i believe, I may be wrong) are 0, 1, and 2, all pointing at /dev/console. As for special properties: * Parent of all orphans * Doesn't have a session ID until it calls setsid() (not certain about this one) * Calling exit() will cause either a reboot or possibly a panic (I think that this is dependent on the argument passed to exit()) * Not catching a fatal signal will cause a panic (this means that sending SIGKILL and SIGABRT to PID 1 will always cause a panic). * Has a PPID of 0, only other process like this is kthreadd * Becomes the parent of most X programs (almost all of them dissociate very quickly from whatever started them. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/