Function report |
Source Code:kernel\reboot.c |
Create Date:2022-07-28 09:33:02 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Reboot system call: for obvious reasons only root may call it,* and even root needs to set up some magic numbers in the registers* so that some mistake won't make this reboot the whole machine.* You can also set the meaning of the ctrl-alt-del-key here.
Proto:SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, void __user *, arg)
Type:
Parameter:Nothing
315 | ret = 0 |
318 | If Not ns_capable(user_ns, Allow use of reboot() ) Then Return -EPERM |
322 | If magic1 != Magic values required to use _reboot() system call. || magic2 != LINUX_REBOOT_MAGIC2 && magic2 != LINUX_REBOOT_MAGIC2A && magic2 != LINUX_REBOOT_MAGIC2B && magic2 != LINUX_REBOOT_MAGIC2C Then Return -EINVAL |
334 | ret = reboot_pid_ns(pid_ns, cmd) |
341 | If cmd == LINUX_REBOOT_CMD_POWER_OFF && Not pm_power_off Then cmd = LINUX_REBOOT_CMD_HALT |
344 | mutex_lock( & system_transition_mutex) |
350 | Case cmd == LINUX_REBOOT_CMD_CAD_ON |
354 | Case cmd == LINUX_REBOOT_CMD_CAD_OFF |
358 | Case cmd == LINUX_REBOOT_CMD_HALT |
360 | do_exit(0) |
363 | Case cmd == LINUX_REBOOT_CMD_POWER_OFF |
364 | kernel_power_off - power_off the system* Shutdown everything and perform a clean system power_off. |
365 | do_exit(0) |
366 | Break |
368 | Case cmd == LINUX_REBOOT_CMD_RESTART2 |
370 | If ret < 0 Then |
377 | Break |
380 | Case cmd == LINUX_REBOOT_CMD_KEXEC |
381 | ret = Move into place and start executing a preloaded standalone* executable. If nothing was preloaded return an error. |
382 | Break |
391 | Default |
395 | mutex_unlock( & system_transition_mutex) |
396 | Return ret |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |