summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9c08c62)
Try a clean power off before using reboot.
Also this commit adds a debugging message before each call to
reboot(). I wasn't sure if reboot(RB_POWER_OFF) happens
synchronously, apparently it does, at least on x86-64.
- * Copyright (C) 2013 Red Hat Inc.
+ * Copyright (C) 2013-2023 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
fprintf (stderr, "\n");
fprintf (stderr, "\n");
fprintf (stderr, "\n");
fprintf (stderr, "\n");
-#if defined(HAVE_SYS_REBOOT_H) && defined(RB_AUTOBOOT)
- /* Try to reboot the system. */
+#if defined(HAVE_SYS_REBOOT_H)
+#if defined(RB_POWER_OFF)
+ /* Try to power off the system. */
+ fprintf (stderr, "init: calling reboot RB_POWER_OFF\n");
+ reboot (RB_POWER_OFF);
+ perror ("reboot: RB_POWER_OFF");
+#endif
+#if defined(RB_AUTOBOOT)
+ /* Try to reboot the system (qemu -no-reboot turns this into exit). */
+ fprintf (stderr, "init: calling reboot RB_AUTOBOOT\n");
- perror ("reboot");
- /* Reboot attempt failed, fallthrough below. */
+ perror ("reboot: RB_AUTOBOOT");
+#endif
+ /* Power off or reboot attempt failed, fallthrough below. */
fprintf (stderr, "expect to see a kernel panic below, that is normal\n");
fprintf (stderr, "\n");
fprintf (stderr, "expect to see a kernel panic below, that is normal\n");
fprintf (stderr, "\n");