函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\reboot.c Create Date:2022-07-27 10:33:37
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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.

函数原型:SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, void __user *, arg)

返回类型:

参数:

313  pid_ns等于取进程的空间
315  ret等于0
318  如果非ns_capable(user_ns, Allow use of reboot() )则返回:负EPERM
322  如果magic1不等于Magic values required to use _reboot() system call.magic2不等于LINUX_REBOOT_MAGIC2magic2不等于LINUX_REBOOT_MAGIC2Amagic2不等于LINUX_REBOOT_MAGIC2Bmagic2不等于LINUX_REBOOT_MAGIC2C则返回:负EINVAL
334  ret等于reboot_pid_ns(pid_ns, cmd)
335  如果ret则返回:ret
341  如果cmd恒等于LINUX_REBOOT_CMD_POWER_OFF且非pm_power_offcmd等于LINUX_REBOOT_CMD_HALT
344  mutex_lock( & system_transition_mutex)
346  :cmd恒等于Commands accepted by the _reboot() system call.* RESTART Restart system using default command and mode.* HALT Stop OS and give system control to ROM monitor, if any.* CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
347  kernel_restart - reboot the system*@cmd: pointer to buffer containing command to execute for restart* or %NULL* Shutdown everything and perform a clean reboot.* This is not safe to call in interrupt context.
348  退出
350  :cmd恒等于LINUX_REBOOT_CMD_CAD_ON
351  his indicates whether you can reboot with ctrl-alt-del: the default is yes等于1
352  退出
354  :cmd恒等于LINUX_REBOOT_CMD_CAD_OFF
355  his indicates whether you can reboot with ctrl-alt-del: the default is yes等于0
356  退出
358  :cmd恒等于LINUX_REBOOT_CMD_HALT
359  kernel_halt - halt the system* Shutdown everything and perform a clean system halt.
360  do_exit(0)
361  panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
363  :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  退出
368  :cmd恒等于LINUX_REBOOT_CMD_RESTART2
369  ret等于复制用户字符串
370  如果ret小于0则
371  ret等于负EFAULT
372  退出
374  buffer[buffer的长度 - 1]等于'\0'
376  kernel_restart - reboot the system*@cmd: pointer to buffer containing command to execute for restart* or %NULL* Shutdown everything and perform a clean reboot.* This is not safe to call in interrupt context.
377  退出
380  :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  退出
391  默认
392  ret等于负EINVAL
393  退出
395  mutex_unlock( & system_transition_mutex)
396  返回:ret