Ric*_*ver 3 c linux gcc system-calls llvm-gcc
Linux x86-64与gcc编译和静态链接我有:
#include <sys/reboot.h>
if (str[0] == 'r')
reboot(0x1234567);
Run Code Online (Sandbox Code Playgroud)
但我似乎无法找到等效函数调用shutdown.如果不同,我也想知道llvm函数.
来自sys/reboot.h
:
/* Perform a hard reset now. */
#define RB_AUTOBOOT 0x01234567
[...]
/* Stop system and switch power off if possible. */
#define RB_POWER_OFF 0x4321fedc
Run Code Online (Sandbox Code Playgroud)
所以reboot(0x4321fedc);
或reboot(RB_POWER_OFF);
应该工作.