From patchwork Mon Oct 17 07:28:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13008278 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 A06DAC4332F for ; Mon, 17 Oct 2022 07:52:29 +0000 (UTC) Received: from localhost ([::1]:56350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okKvD-0002bm-OA for qemu-devel@archiver.kernel.org; Mon, 17 Oct 2022 03:52:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okKd9-00086R-Rw for qemu-devel@nongnu.org; Mon, 17 Oct 2022 03:33:53 -0400 Received: from mail-am6eur05on20730.outbound.protection.outlook.com ([2a01:111:f400:7e1b::730]:31873 helo=EUR05-AM6-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 1okKd5-00029q-UV for qemu-devel@nongnu.org; Mon, 17 Oct 2022 03:33:46 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e+lYg+RzLLWnE+rA4BPKtG70qaHedPtwXJlM/czz5XHxfJZ3t2osazhgAU1a3X8KXKj79N6LyBD0FpyTTcPt3PcAZTb4Y8gVcdbeSv+0jrDUN9WgnG7xMdboZkKlGiNxeXWvEOeRFxZIFo+y8rh/9g0Hp+svhT4yNvXiDOyYhdNyFJbmHJXXnu3/aoA/bKK8W2GmcC3CNrdYf8VAczeD5PGpZxO16JnR0BhjGvI+vE44JDEG+O3MBeCoD6fZ+RbtdWApexr/L+dqDyHAxyKHFbT7ATx0vBkmOW1VbVLJnoufG8coEFQxPwS/GGeGzHtlHC8chtduPk0Wzr7E+PQFuQ== 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=ku6Djti0TjfMuEVA+aLc+awmoKymOD59H9ccnlZTYRM=; b=Dc52DeNTD/fhNjz6YAhXpX2vOfFVXEvO2vznkLiekU/8iR7aUrSrFl/KyJ5SnJG6UGUJPUyUMbyvdMDlSO1+qUQRa3MPtKo8vCEdzHDVDpX/lhJwddybQFK2LblwmW+jwjqDhCK+67xiS/Uz/7sv+/RTOcN6IhABd3V+PJXQ+IvnBCTohNaOdMzgr4+EUdV952bZIAVCJhuKMBkQwC9Zl5BXtWNF4SpZT2InXVairyoiYOrrj6aTi8fVtPOLc3NfU8RF55Elwm3L0RjH3AzvAZd0sa3fzhFy9RfQwcxp7FUu+C/xQNGalx9kk4qFFkC5fjJsguSfdzcy5T56o6bq+g== 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=ku6Djti0TjfMuEVA+aLc+awmoKymOD59H9ccnlZTYRM=; b=c9WPAy2R8y/oo2Ab+AB2ijjVqTlBmpNak3jOoccUU9eSMJRKQNjohvkVaHcRRI3NbZb96nJmXfIkRRXE7d1DDw0fijodPQguapiYQCQJfZWDTNRXVQI2jmo80oRM5kll0X628FxSOKYAxa6b4+MuNWVKceYHiQTJnGRCBvKjKhmACpWq97h3nzx3l4fS+TGmF0m6nwL93Yxvzfsv3XL60uHkLsVUukHpu0WljSIhcsbS4pfsptZXZaiNuPfr2XV86+VL0IrVD1IFEOhTgYWXzDDwIcGdUCZy2no6nKz3yYK8un2yYg5LQK+sdhZ/ovoNcPrDJa/w+LoZ++BZDMTFTA== 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 PA4PR08MB7458.eurprd08.prod.outlook.com (2603:10a6:102:2a5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Mon, 17 Oct 2022 07:28:39 +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; Mon, 17 Oct 2022 07:28:39 +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 v5 4/7] qga: Add shutdown/halt/reboot support for FreeBSD Date: Mon, 17 Oct 2022 09:28:22 +0200 Message-Id: <20221017072825.72867-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221017072825.72867-1-alexander.ivanov@virtuozzo.com> References: <20221017072825.72867-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR3P281CA0033.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR08MB7095:EE_|PA4PR08MB7458:EE_ X-MS-Office365-Filtering-Correlation-Id: d9998b73-0480-4495-d486-08dab01135e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ny8pDCgdFjOBlXqh9cgTB7810WPMP5n6pq65uQ0uCAgKuc31RflXYtYHRkyoao6bfOyyEfMHaBoBZh3voeJSkfErJK5xSxI8kX/t0pXyJwKmLyVDAntt1vNmZoxtyJ0bRUwzy1vM08c0uFqcdz2lgh6IJ1fSUAralfOLNeDu5SRAtH4CS/8N/y/wbOTTK+U6RiK+MQCuZa8JlSDf9KkfW/WZKGvjDSDDDdJGwqiXtk3KPCn++HRIYy/qr8iaa18TV6V0TuKANJjsRD5I9eXC9g/hVNwS1jgfvXmD1hrxlSjdwSgfsdWNn4buYpGXqDducE1YsRPE1a74w9QVmqV91Emy2n3com6yj8v99vqJrKDVSccm71eY1P9MenM730mM/Juw4UH3QHTryGZZTDZi8IP3W0rJFRJEv+s+vsrR+BfSkM8cQfPHU/mW2AMvILHPxHQCQgm/5X/0OMP6qNqWpgCEjvPLgFuBRcmYwa8KraxuMw4NipM/LnNj6zYkWFQT5rPdFaC70zIAMCV4VSBM2HAQj7+zPPKRBfGh4Lw6beOAWMoiAQluSJT+KBdvLOcV/Uvjo62YMHL9tuNU7McDShjTNRrWxkyzLOxBiYCPAY3M3tqjhzAwAEjDwU/nHpwjkCQv7UKYBR2wQ40QAMd0O7xc5H/dHaRrE5stJfz13wAz0ETVcAOOHuZ3BG0LhiJbyb/C0SEinkPO6zIvyrp2tdyRIve2UZNLHEvXX+NISHBKYk/Q8vBPCY0MIKFIfFvOkeLygz4HzC/aQRHTSuX5g== 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(451199015)(36756003)(86362001)(38100700002)(38350700002)(1076003)(186003)(2906002)(5660300002)(44832011)(6506007)(6666004)(26005)(6512007)(2616005)(478600001)(52116002)(6486002)(316002)(6916009)(66946007)(66556008)(8676002)(4326008)(66476007)(41300700001)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Q+GIEpuMNmb6bnsL2ZOXuzLcASLe?= =?utf-8?q?5nAH5UDBNCthqH3XBgy8CqpzrIjt3+ofYlYeyAyL0ltWCDSbqdRivtvpef2h7s97O?= =?utf-8?q?o6voszCWTmR86vO+mlmqySjEZ25E52YwNNSvNy0y0o6E6Z9mZtke20nOL6hUqNDJ/?= =?utf-8?q?FrxfN+JA+Xig2BFz0n1gdAbr1yhSrj/eAAMfqTSydDIWIN8fwNjSeU2OTf2rdBIWQ?= =?utf-8?q?/4yJNx/Gad5qLS9gHqhZ/Qh98VawdyP4guXPAUacj7hWemtFGgsW4lvS2SXAcNiuW?= =?utf-8?q?rY9ZshtqH5RFfBG4Hg5SeNRN2J+fCSM3F5/9OCN4i68gcY9y1EivEP7dhtXa7Cngd?= =?utf-8?q?bv5T9VWQHCQMf9ekwlwmpfcnmpkP+zBXmBybJKrQm79Yh/3f+aFi0dF0c6Gmm7wKa?= =?utf-8?q?eT6I9f9HEy8rrgmVxgmUWOFd949xZ7p3e00GuvAkWYh4ktrye1/nqE8uDkfo0cP4S?= =?utf-8?q?14WHncv88oL1fFQ2BOZ98P1Vg/AH/b6axYCQKFV0szyc+arq/LFeupEVfv9u147RR?= =?utf-8?q?ERzrXVjXSZTj/6CYRt74QZhq9RYCRtWaTm1a7/BPMBkqf8ZG0RPI7636j2ka6s5NZ?= =?utf-8?q?Q+raL4u+MDqv5qN8rzXBiSwWOdLsCPC4cUWraIY+YDMqOYp+3+6wkfEblrkNvsian?= =?utf-8?q?t2rYbK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ZlUjuryJcNBxw=3D=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9998b73-0480-4495-d486-08dab01135e7 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2022 07:28:39.3226 (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: lEFdauscYJAfGREOHyqqV2BptKqcbf7uuXH893blhw2gjANXEJPk5HXSlRClfQTJGlcnucXeKUceHh3DKICfHKp3mn9pE001av4mSeUgw98= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7458 Received-SPF: pass client-ip=2a01:111:f400:7e1b::730; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, 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 6875ea8888..b0b467ebdb 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);