diff mbox series

Use portable RB_AUTOBOOT for reboot(2)

Message ID EB2E94CD-0560-4542-841A-6DA3F1E4BBD2@siemens.com
State Accepted
Headers show
Series Use portable RB_AUTOBOOT for reboot(2) | expand

Commit Message

Storm, Christian Jan. 25, 2024, 2:31 p.m. UTC
Use the portable RB_AUTOBOOT instead of the Linux-specific
LINUX_REBOOT_CMD_RESTART. Both are defined as 0x01234567.
glibc and at most other libc implementations define this.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 tools/swupdate-ipc.c      | 3 +--
 tools/swupdate-progress.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tools/swupdate-ipc.c b/tools/swupdate-ipc.c
index 2fd759c5..2343ba6b 100644
--- a/tools/swupdate-ipc.c
+++ b/tools/swupdate-ipc.c
@@ -24,7 +24,6 @@ 
 #include <sys/un.h>
 #include <sys/select.h>
 #include <sys/reboot.h>
-#include <linux/reboot.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <ifaddrs.h>
@@ -647,7 +646,7 @@  static int sysrestart(cmd_t  __attribute__((__unused__)) *cmd, int argc, char *a
 			restart_system(ndevs);
 			sleep(5);
 			sync();
-			if (reboot(LINUX_REBOOT_CMD_RESTART) < 0) { /* It should never happen */
+			if (reboot(RB_AUTOBOOT) < 0) { /* It should never happen */
 				fprintf(stdout, "Please reset the board.\n");
 			}
 			break;
diff --git a/tools/swupdate-progress.c b/tools/swupdate-progress.c
index 8aaef069..d00b3365 100644
--- a/tools/swupdate-progress.c
+++ b/tools/swupdate-progress.c
@@ -19,7 +19,6 @@ 
 #include <sys/un.h>
 #include <sys/select.h>
 #include <sys/reboot.h>
-#include <linux/reboot.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <pthread.h>
@@ -194,7 +193,7 @@  static void reboot_device(void)
 {
 	sleep(5);
 	sync();
-	if (reboot(LINUX_REBOOT_CMD_RESTART) < 0) { /* Should never happen. */
+	if (reboot(RB_AUTOBOOT) < 0) { /* Should never happen. */
 		fprintf(stdout, "Please reset the board.\n");
 	}
 }