/* init
- * 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
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");
reboot (RB_AUTOBOOT);
- perror ("reboot");
- /* Reboot attempt failed, fallthrough below. */
+ perror ("reboot: RB_AUTOBOOT");
+#endif
#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");