Linux reboot() system call: why it calls do_exit(0) after kernel_halt()?
Posted
by
axeoth
on Stack Overflow
See other posts from Stack Overflow
or by axeoth
Published on 2012-11-19T10:34:13Z
Indexed on
2012/12/11
11:04 UTC
Read the original article
Hit count: 222
This is related to: http://stackoverflow.com/a/13413099/1284631
Now, the question is:
Why the reboot() system call, when called with LINUX_REBOOT_CMD_HALT
parameter (see here: http://lxr.linux.no/linux+v3.6.6/kernel/sys.c#L480) is calling do_exit(0)
after having already called kernel_halt()
, as calling kernel_halt()
boils down to calling stop_this_cpu()
(see here: http://lxr.linux.no/linux+v3.6.6/arch/x86/kernel/process.c#L519), as part of native_machine_halt()
(see here: http://lxr.linux.no/linux+v3.6.6/arch/x86/kernel/reboot.c#L680).
Or, it seems to me that stop_this_cpu()
is never returning (it ends with an infinite loop).
So, it is do_exit(0)
called just in case that kernel_halt()
doesn't do its job and it return? Why not panic()
directly instead, then?
© Stack Overflow or respective owner