diff mbox series

[v3,4/7] qga: Add shutdown/halt/reboot support for FreeBSD

Message ID 20221003093911.1844031-5-alexander.ivanov@virtuozzo.com
State New
Headers show
Series qga: Add FreeBSD support | expand

Commit Message

Alexander Ivanov Oct. 3, 2022, 9:39 a.m. UTC
Add appropriate shutdown command arguments to qmp_guest_shutdown()
for FreeBSD.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
 qga/commands-posix.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Konstantin Kostiuk Oct. 3, 2022, 1:43 p.m. UTC | #1
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Mon, Oct 3, 2022 at 12:39 PM Alexander Ivanov <
alexander.ivanov@virtuozzo.com> wrote:

> Add appropriate shutdown command arguments to qmp_guest_shutdown()
> for FreeBSD.
>
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
> ---
>  qga/commands-posix.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/qga/commands-posix.c b/qga/commands-posix.c
> index 49f9996a9c..88e0d0fe24 100644
> --- a/qga/commands-posix.c
> +++ b/qga/commands-posix.c
> @@ -90,6 +90,10 @@ void qmp_guest_shutdown(bool has_mode, const char
> *mode, Error **errp)
>      const char *powerdown_flag = "-i5";
>      const char *halt_flag = "-i0";
>      const char *reboot_flag = "-i6";
> +#elif defined(CONFIG_BSD)
> +    const char *powerdown_flag = "-p";
> +    const char *halt_flag = "-h";
> +    const char *reboot_flag = "-r";
>  #else
>      const char *powerdown_flag = "-P";
>      const char *halt_flag = "-H";
> @@ -120,6 +124,9 @@ void qmp_guest_shutdown(bool has_mode, const char
> *mode, Error **errp)
>  #ifdef CONFIG_SOLARIS
>          execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y",
>                "hypervisor initiated shutdown", (char *)NULL);
> +#elif defined(CONFIG_BSD)
> +        execl("/sbin/shutdown", "shutdown", shutdown_flag, "+0",
> +               "hypervisor initiated shutdown", (char *)NULL);
>  #else
>          execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
>                 "hypervisor initiated shutdown", (char *)NULL);
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 49f9996a9c..88e0d0fe24 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -90,6 +90,10 @@  void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
     const char *powerdown_flag = "-i5";
     const char *halt_flag = "-i0";
     const char *reboot_flag = "-i6";
+#elif defined(CONFIG_BSD)
+    const char *powerdown_flag = "-p";
+    const char *halt_flag = "-h";
+    const char *reboot_flag = "-r";
 #else
     const char *powerdown_flag = "-P";
     const char *halt_flag = "-H";
@@ -120,6 +124,9 @@  void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
 #ifdef CONFIG_SOLARIS
         execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y",
               "hypervisor initiated shutdown", (char *)NULL);
+#elif defined(CONFIG_BSD)
+        execl("/sbin/shutdown", "shutdown", shutdown_flag, "+0",
+               "hypervisor initiated shutdown", (char *)NULL);
 #else
         execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
                "hypervisor initiated shutdown", (char *)NULL);