On 12/05/2013 06:10 PM, Harald Becker wrote:
Hi !

On 05-12-2013 14:59 ChenQi <[email protected]> wrote:
I noticed that switch_root in our busybox supports an extra
option '-c DEV' which is not supported by the same command from
util-linux. According to the source file, it's used to 'reopen
stdio to DEV after switch'.

Does anyone know why we need this option? Is there any use case
where this option is useful or maybe necessary?
You probably need to reopen stdio after switching your root. As
long as you keep devices open, there are open file descriptors in
the kernel and the device i-nodes on the old file system can't
be deleted. Some programs do there own handling of devices and
reopen stdio in the new root, other may miss this reopen step
and you have to care of it for your own. In this case the -c
option simplify the switch usage, as it bundles the reopen in
same step as switching the root file system.

--
Harald



Hi Harald,

Thanks for your explanation.

I don't know if I understand it right.
Does it mean that as long as we don't do some strange redirections of standard IO in our initramfs, we don't need to add this option when switching root? So in most cases we don't need to reopen the stdio, right?

Best Regards,
Chen Qi

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to