From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 04 Jul 2024 11:59:04 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sPJF0-001Sv1-2P for lore@lore.pengutronix.de; Thu, 04 Jul 2024 11:59:04 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1sPJEz-0003JR-EN; Thu, 04 Jul 2024 11:59:01 +0200 Received: from mail-am6eur05on2080.outbound.protection.outlook.com ([40.107.22.80] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sPJ2z-0002V2-Od; Thu, 04 Jul 2024 11:46:39 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bpDjYtTBxVuSPaYl+nbAJSqR3K71OE1yvOgD8m/sDMsrdU5DkqSSzGhZ5ZQnlGJ7wDf8iWwPbLcqKA6v8GygMw/HDWlHWPifKrs8asLxufRig6YsWC15NzM1iD/m3LLKs7cgnqxrZf7mpFg2t6VE30E1sHZQ68xqAm4DgrRIhsxkKPWjDHOLz6MSs4JI7/uhUtuHWPTt2L45ABN5rJgbFvHX0e9Go5/FZiyxSXa1RZKB0DsQ0RJAUrqFvxlZubRpaSRjxkLHgOskxYBEQehH7a3zAiYlXD3RrPGJFFSKp1z9bFUhFJncb3kqbvgJf2EOmakmgfK7Ss2s6Z/BVWExqA== 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=Kbq6KQyD+0GvBKw+gTCTkDsw2iHh1lUi4hoqlrIcIWA=; b=hzQKnrj8UjjTT79SdrtcSixGxtVvUjerEFMUuaOpitrznv5/BOnthtZhd2bL+cBPabVxuXqUf3pZV49WHwb8xf+q2g93URcwvZ5PQOAYMDBFcYV17TOAtDX7I/7Gfdvdj36pw1zBzAiHPIvkQ9IR+IdSuJwzC3OBtYJPOSTSvq+SPB/j3mpynXiy5cCf3omsPRT2pyIGVA08eBKqv2VsQJJ+BnHaqg238dWyQTXbWwIFRiCz4QA2DlsLuv5/Z9CbkY/G6FtTUgGll9xOklE0f6Enxj5L8wF6CGkcwtg74LjRQ8YdF0fiShhdAtM6V7nVWkbTLekDLJqeunk5HXSTXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 193.8.40.94) smtp.rcpttodomain=pengutronix.de smtp.mailfrom=leica-geosystems.com.cn; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=leica-geosystems.com.cn; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leica-geosystems.com.cn; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kbq6KQyD+0GvBKw+gTCTkDsw2iHh1lUi4hoqlrIcIWA=; b=VVVZ1jZGTPPVc++hWFwZnodJKGIaIyg+QQ3floOq6cqDNLZ4NjehAA0VnHA7tPu02uq+ypKa/RzpGh/ocFAz5LNBLjcxBi4FSrRu4YulGEm7muKWDpsHcDxXTDaLpHCgcBy/OO+uTLtH+Nywf4bu56h6cITn2+JtbHa5KxMsRBY= Received: from AM0PR02CA0010.eurprd02.prod.outlook.com (2603:10a6:208:3e::23) by DU2PR06MB8277.eurprd06.prod.outlook.com (2603:10a6:10:2d0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.27; Thu, 4 Jul 2024 09:46:35 +0000 Received: from AM3PEPF0000A79C.eurprd04.prod.outlook.com (2603:10a6:208:3e:cafe::88) by AM0PR02CA0010.outlook.office365.com (2603:10a6:208:3e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.29 via Frontend Transport; Thu, 4 Jul 2024 09:46:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 193.8.40.94) smtp.mailfrom=leica-geosystems.com.cn; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=leica-geosystems.com.cn; Received-SPF: Pass (protection.outlook.com: domain of leica-geosystems.com.cn designates 193.8.40.94 as permitted sender) receiver=protection.outlook.com; client-ip=193.8.40.94; helo=hexagon.com; pr=C Received: from hexagon.com (193.8.40.94) by AM3PEPF0000A79C.mail.protection.outlook.com (10.167.16.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.18 via Frontend Transport; Thu, 4 Jul 2024 09:46:35 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.116]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Thu, 4 Jul 2024 11:46:32 +0200 From: LI Qingwu To: Qing-wu.Li@leica-geosystems.com.cn, jie.gu@leica-geosystems.com.cn, oss-tools@pengutronix.de, m.felsch@pengutronix.de Date: Thu, 4 Jul 2024 11:46:29 +0200 Message-Id: <20240704094630.1216852-4-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240704094630.1216852-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20240704094630.1216852-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 04 Jul 2024 09:46:32.0955 (UTC) FILETIME=[0D9844B0:01DACDF7] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM3PEPF0000A79C:EE_|DU2PR06MB8277:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2d01cbf2-a785-49f9-3b41-08dc9c0e3196 X-SET-LOWER-SCL-SCANNER: YES X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Zr9NpCu73OaetzztRyjeY11rLB7iosokWdOPJR8DLfsdsATtnw+DL3h8HN8T?= =?us-ascii?Q?1fG4aUxKk5X5lvoHORBoHsLUoyk7g1wEy7PTLVuVv1qApbUID4yda6ukffvR?= =?us-ascii?Q?RwW6Tb+Di7CivGD/thBD8nLr3UKIn+ADvjf240rvODfRxt2Vm9diCsFQmN+/?= =?us-ascii?Q?7efWPjxeDTnOlHy3GMynqbwPT3rYgNO6plhAFSoxHYLVdzd/ZW6blZZvigDy?= =?us-ascii?Q?ThDKzWsdUyeNw6v7nJh+ws2PXiBr619j1FmNIhWFQF3eQDDtctsjDqKIwaGx?= =?us-ascii?Q?Bynx371FaOOhDmk0P1fIg8FGgkA+254/ispuQvIxbcWtLUCOv6ls53rZEdiY?= =?us-ascii?Q?iNp/MMG71tD3jSD/+yhIBNTZORDnqUHxQNOLBrrH8pT8mx1ZdNyy3Er/UIKk?= =?us-ascii?Q?7EGg2cviCHxkBITE6yo6l+JA+rad1jAPrCoDTjAuK7KTlw3CrbscliWVwqXA?= =?us-ascii?Q?ttBgWzxFa2Iduu2H1PVc9Nc5+M2uMd2mPs9/sSwIfRKNeOJMcb/jlGE++DFc?= =?us-ascii?Q?GaVSGPQdsQzZtcC6J0q8JRn9S8bSZEp81R9xNBmq1OLh1fZ7vqcA8eu93OFd?= =?us-ascii?Q?bDLQYWIR/UiqhFobL4zpXA8azGWtS4WvcbqGgHtR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:1; SRV:; IPV:CAL; SFV:NSPM; H:hexagon.com; PTR:ahersrvdom50.leica-geosystems.com; CAT:NONE; SFS:(13230040)(1800799024)(82310400026)(376014)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2024 09:46:35.4390 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d01cbf2-a785-49f9-3b41-08dc9c0e3196 X-MS-Exchange-CrossTenant-Id: 1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=1b16ab3e-b8f6-4fe3-9f3e-2db7fe549f6a; Ip=[193.8.40.94]; Helo=[hexagon.com] X-MS-Exchange-CrossTenant-AuthSource: AM3PEPF0000A79C.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR06MB8277 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Mailman-Approved-At: Thu, 04 Jul 2024 11:58:58 +0200 Subject: [OSS-Tools] [PATCH platsch V6 RESEND 4/5] Platsch: always fork child process X-BeenThere: oss-tools@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: Pengutronix Public Open-Source-Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bsp-development.geo@leica-geosystems.com Sender: "OSS-Tools" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: oss-tools-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false When running Platsch in the background with an ampersand, the initramfs may disappear after the rootfs is mounted. In such cases, Platsch may fail to read the resources. To address this, Platsch now always forks a child process after acquiring the resources. The chiled process keeps the DRM devices remain open while the parent process exits with a clear status. Signed-off-by: LI Qingwu --- platsch.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/platsch.c b/platsch.c index 6503066..756ba1c 100644 --- a/platsch.c +++ b/platsch.c @@ -119,17 +119,18 @@ int main(int argc, char *argv[]) platsch_drmDropMaster(); + ret = fork(); + if (ret < 0) { + platsch_error("failed to fork for init: %m\n"); + } else if (ret == 0) { + /* + * in the child go to sleep to keep the drm device open + * and give pid 1 to init. + */ + goto sleep; + } + if (pid1) { - ret = fork(); - if (ret < 0) { - platsch_error("failed to fork for init: %m\n"); - } else if (ret == 0) { - /* - * in the child go to sleep to keep the drm device open - * and give pid 1 to init. - */ - goto sleep; - } initsargv = calloc(sizeof(argv[0]), argc + 1); if (!initsargv) { @@ -147,6 +148,8 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } + return EXIT_SUCCESS; + sleep: platsch_redirect_stdfd(); -- 2.34.1