From 46dec5a0c30b1b970bc2767b26e8577b3770e5b3 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Mon, 3 Apr 2017 12:26:14 -0500 Subject: [PATCH] Switch from _GNU_SOURCE to _DEFAULT_SOURCE. --- init-ng.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/init-ng.c b/init-ng.c index 3b969be..d161b84 100644 --- a/init-ng.c +++ b/init-ng.c @@ -10,14 +10,14 @@ // (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 #include #include #include #include #include -#include +#include #include #include #include @@ -221,9 +221,8 @@ void ShutDown(int cmd) // 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); } @@ -278,7 +277,7 @@ int main(int argc, char * argv[]) } else if (strcmp(argv[1], "test") == 0) { - ShutDown(LINUX_REBOOT_CMD_POWER_OFF); + ShutDown(RB_POWER_OFF); } else printf("Invalid command\n"); @@ -363,15 +362,15 @@ int main(int argc, char * argv[]) // 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) { -- 2.37.2