X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Finit.c;h=7836158203fa60b86a2233b0e7e567b3514dc28d;hb=HEAD;hp=ef7011c032543e1d29b679b617431d307e7d139e;hpb=9c08c62a9f4ae9a2bb8bf7029da2bcdb60a1a125;p=qemu-sanity-check.git diff --git a/src/init.c b/src/init.c index ef7011c..7836158 100644 --- a/src/init.c +++ b/src/init.c @@ -1,5 +1,5 @@ /* 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 @@ -34,12 +34,21 @@ main (int argc, char *argv[]) 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");