From patchwork Thu Oct 13 09:23:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13005841 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B6C0C433FE for ; Thu, 13 Oct 2022 10:15:57 +0000 (UTC) Received: from localhost ([::1]:52466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oivFs-0007GM-3k for qemu-devel@archiver.kernel.org; Thu, 13 Oct 2022 06:15:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiuRR-0002GB-NX for qemu-devel@nongnu.org; Thu, 13 Oct 2022 05:23:49 -0400 Received: from mail-eopbgr140123.outbound.protection.outlook.com ([40.107.14.123]:28929 helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oiuRP-0004g6-Ly for qemu-devel@nongnu.org; Thu, 13 Oct 2022 05:23:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W3BnmwIx9HFbpUEQRZe3GId4OEf1n3usGhIX4vu6lKc8sbxIqEEIao9FcylpNOSyG4XzVkzzlPTFH5XdGjITdScAklpzsgigt50XSYmYkkmJBV2BMZGlYufsJBzCEIuL/LJjtjLvMSBKDUmX/JqKZpdDziQCpcys0eau8Js7v/CIpV7VdeOFq5dRo6NTIUxgX9As5Msx4eMlet5oS1BRPe35ov83pTT5Dw85eqSffX+Q1g/BfgC8LDYelGgEuUwP9wOQkQAjV2dbNIdzf02fLj3SfFDsxcln1GYYGNJGnUYK/u83tEBmhsHUt+CrLEShvsN4gNE2Jl/ZdP8xJANosA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rkK0u43PU85jFfHhbme9ZUTebOFAr5bhhPIK+wC4mG8=; b=KwU8Zots78kDaIRjlFrn06RQeAUksxmm5FCwkHjsFGqBmAY+DP6M5wv1fox9GUCOmJ8Y6vk8z1Brez5PJucM7QHxZS2xIiK6sWot641y0xqyT/2ZtY+PA2pKD2/o6NmksBaYdx8KtbNiKlCvzJUIrjjGhW0JDClPstH1FvolHwTK7MCp/B7ZcDx3fx6Ac4yMhShx7GdxCDaw28YuLOzX27KLS2xTaw5GPzjdB1YKp3nqsC97Ddl68g9LVGgOAwZ97h7ELrMYi/gLMSRXOILY2wfGnWCVjlRUrutvjJsFjlr4nymjoTgXbvGatgGEogUuJme8zxXXrKt18v+cD16Niw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rkK0u43PU85jFfHhbme9ZUTebOFAr5bhhPIK+wC4mG8=; b=r9VS2HvYio6DOOvP5Xq1QKGA2qnzRPiWujSUrnsKeOWTPKN8dif5CwPJ0AsROCf3MI+s6VAEmNZc/uAvo7oa4lhO1WOGvmFpklYjYV9N43XQw4kIMv1tS969TzVfOzix0E8kbwZmL9jxlozyduC5tD3y36kpZK8GDCejBLbToiS/S40JKBiuUn4fLLe0pXEVG95eeQwAyxNwi2IkjeeI1pCLjazWdIlCmmfqJXXan355/1Zz10JGYSYGC7kuZkk3UrR81LpqkdzzYF/xa0t0nvZRjjgzrHSYI5GWQm0YoEhyfzxuUN/H6jCzBDtV+5CgW7+d/JZ4PlI3ZH8U9EsvMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by AM8PR08MB6466.eurprd08.prod.outlook.com (2603:10a6:20b:363::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21; Thu, 13 Oct 2022 09:23:38 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::5174:25c7:6df8:741b]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::5174:25c7:6df8:741b%8]) with mapi id 15.20.5676.040; Thu, 13 Oct 2022 09:23:38 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: den@virtuozzo.com, michael.roth@amd.com, kkostiuk@redhat.com, marcandre.lureau@gmail.com Subject: [PATCH v4 4/7] qga: Add shutdown/halt/reboot support for FreeBSD Date: Thu, 13 Oct 2022 11:23:23 +0200 Message-Id: <20221013092326.2194646-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221013092326.2194646-1-alexander.ivanov@virtuozzo.com> References: <20221013092326.2194646-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0069.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::22) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR08MB7095:EE_|AM8PR08MB6466:EE_ X-MS-Office365-Filtering-Correlation-Id: f4d2ef11-21fd-4582-671a-08daacfc9c36 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e3TfhCsooQhUULGDwKmks1iZvbOkyC8UZi1jyidmMOLTB/CIH75YoGhiS7vG0VsmR+HouShJ6c8ZIV9fpQCXr0pPloHPQm3dqQ465OPhTWPuPcC6tQCVAy8zQ4orPJog9vaV01VUNLNFFJYt4V1L5szEB0eTNmtH4VOK9V5zVv061xZj8BdpqLBCWNx4TPzLWCeqTLhuxUMih5M94LrxCO9B8IAn3mfp0KMIAcUpOk21QqOVmDJE62wVEAalGZt/DQuhI1WEbQKgAN8ZSvi9GoHlBw6Gan/mXXk5XPVTfyhfphG6d3eShtpCV1tK63mZQZx4IyYWCfeT3dFoNsJCBE8HSxOvkJ3EBqrIIPNG801/IU6Mpaz7M3HdF32e8pllOxcsFhbj66EhojEAFDubuN8p1pkYc6Z1LrIUFVuDSyDCTkbrDznFXAROslZdhGRbcSg14V8RJQ58ot9xEPEM1oxM88D40qOpIlpluqH/H2CVYjMsV6awBgT2wA0nhxkkLjqNhOvvET36s9oKfWgfXHUsvXLwU3Ilkr4OK7qWNNcz8xeK57H6hm1uPxkWBg5nusvEHanunlO6ytsxQvYAvCYqyWyLceYrJCja+NRumyKHo9qNT3arRbaQzRIoY0texrVL7ehtudjqWqJT+TxsAs//lVng4wcRy+ustPmBZcE1SOZt/aBmE8amqI4Pxz4EWCAHHN5+mlj6DybQZfzq+JBbZ3iveo4Dy5sjnxmuqHVNDRCAwicQl0jSlOo4P26USvzRnEZ5p+JlQ1pdA4PqiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(376002)(346002)(136003)(39850400004)(396003)(451199015)(36756003)(2906002)(44832011)(4326008)(6512007)(5660300002)(41300700001)(8676002)(66556008)(316002)(86362001)(6916009)(66946007)(66476007)(8936002)(38100700002)(478600001)(6486002)(6666004)(38350700002)(26005)(6506007)(52116002)(2616005)(186003)(1076003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?rEeNqwnAWLHNYYqNThpB3W+Y7D3/?= =?utf-8?q?y1MH/P+V/lAgZKadMeqwVN4T5bFTf0JekMbrEqTAlkl9l5bw+s/Qbmfi3GGPM0qSj?= =?utf-8?q?Neey7bctooFebyjczEqFvK1zdWRLSTVjQ4DSKkP3IImEkyhSeMpEEoiDXmFty+Ixo?= =?utf-8?q?7C9suNq/30PVeiCqKi55yzfqH7sfnH3UNkHFNmK5VQ4k8vwIHAnmWYqrFotB1SKIt?= =?utf-8?q?1wQlGma+0wE/vPr0mSAxoTtoDseSGocF8OhwxCAkub/O7Haxe/34DXPiX3c/PR4mm?= =?utf-8?q?NpQ2MIzxX4gw8/Xwvuxh/VMIXXB4IGXiyNzhLcdmoHdNBGNWQatMkDmVEjadYdKf3?= =?utf-8?q?2Kxuk5BqSflGQMqfNGg/4h2hmoZNKji49l9ok6PnHoMnJoz9QIIHtGd4jeoBgJFbu?= =?utf-8?q?1vENwh3VWobDcITx6yYxzcAWnKkmdMKl7XIRhowXgnuU5rMSP7HbCev0gcaJSOMsU?= =?utf-8?q?LO78FB/c9RI5qKZWa0jMCmIUE1WvZd1jDTazjRKaF0+HFUUaVQn287C8DRR1urqZB?= =?utf-8?q?b95jOCBHjf2VhlTaT2KbMAabaTncF0MlSd+ydm4zZ6wjC8gsf+zuh3iqAYGN38BNS?= =?utf-8?q?9aDBJ99vxljECVwzeAk516iPKFvrmMGXzQ85a1jCfOXbNhUBnttKYXjN39Qi2xTMD?= =?utf-8?q?RGEFZP/W1w3wPtYk05lao6rYC2LWz9prDHCO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=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f4d2ef11-21fd-4582-671a-08daacfc9c36 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2022 09:23:38.1393 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KkrFMOwW9lAQ4BZfi3eO2Td8Pq1HrFX3+GUMjo1fbkZTXBS1yITdXR3668fMs/gU+rbvhNY/6pFpQ3GbWF15qU9Q29HMfVtoZTRjb069qXA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6466 Received-SPF: pass client-ip=40.107.14.123; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Add appropriate shutdown command arguments to qmp_guest_shutdown() for FreeBSD. Reviewed-by: Konstantin Kostiuk Reviewed-by: Marc-André Lureau Signed-off-by: Alexander Ivanov --- 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);