我需要从用户空间进程重新启动Linux盒。我希望有以下行为:
失败。
这些要求能一起实现吗?
我正计划在proc/sysrq触发器中写一个“b”。有更好的办法吗?(不,这不会给我同步。)
谢谢!
发布于 2009-05-12 15:05:00
那么,做同步(1),杀死-1,再次同步,杀死-9 -1,同步,关闭-f.
我想这应该能行吧!
发布于 2009-05-12 15:04:51
我猜你有根。
。
希望这能有所帮助。
发布于 2009-05-20 05:20:36
这直接来自sys/reboot.h:
#ifndef _SYS_REBOOT_H
#define _SYS_REBOOT_H 1
#include <features.h>
/* Perform a hard reset now. */
#define RB_AUTOBOOT 0x01234567
/* Halt the system. */
#define RB_HALT_SYSTEM 0xcdef0123
/* Enable reboot using Ctrl-Alt-Delete keystroke. */
#define RB_ENABLE_CAD 0x89abcdef
/* Disable reboot using Ctrl-Alt-Delete keystroke. */
#define RB_DISABLE_CAD 0
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
__BEGIN_DECLS
/* Reboot or halt the system. */
extern int reboot (int __howto) __THROW;
__END_DECLS
#endif /* _SYS_REBOOT_H */我相信RB_HALT_SYSTEM会处理所有的同步(),等等。我通常自己处理,最后用RB_AUTOBOOT触发重新启动。
https://stackoverflow.com/questions/853194
复制相似问题