// (C) 2017 Underground Software
//
-#define _GNU_SOURCE // Without this, functions in unistd.h go missing
+#define _DEFAULT_SOURCE // Without this, functions in unistd.h go missing
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <linux/reboot.h>
+#include <sys/reboot.h>
#include <sys/syscall.h>
#include <sys/socket.h>
#include <sys/types.h>
// to work without any problem as is.
while (waitpid(pid, NULL, 0) != pid);
- // Could just call sync() as well...
- syscall(SYS_sync);
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2C, cmd);
+ sync();
+ reboot(cmd);
}
}
else if (strcmp(argv[1], "test") == 0)
{
- ShutDown(LINUX_REBOOT_CMD_POWER_OFF);
+ ShutDown(RB_POWER_OFF);
}
else
printf("Invalid command\n");
// Now do something with it...
if (strcmp(buf, "poweroff") == 0)
{
- ShutDown(LINUX_REBOOT_CMD_POWER_OFF);
+ ShutDown(RB_POWER_OFF);
}
else if (strcmp(buf, "restart") == 0)
{
- ShutDown(LINUX_REBOOT_CMD_RESTART);
+ ShutDown(RB_AUTOBOOT);
}
else if (strcmp(buf, "halt") == 0)
{
- ShutDown(LINUX_REBOOT_CMD_HALT);
+ ShutDown(RB_HALT_SYSTEM);
}
else if (strcmp(buf, "status") == 0)
{