From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 19 Jun 2024 14:57:56 +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 1sJust-008hFw-1e for lore@lore.pengutronix.de; Wed, 19 Jun 2024 14:57:55 +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 1sJusr-0005V0-Fj; Wed, 19 Jun 2024 14:57:53 +0200 Received: from mail-db5eur01on20600.outbound.protection.outlook.com ([2a01:111:f403:2600::600] helo=EUR01-DB5-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 1sJsSZ-00012k-Vl; Wed, 19 Jun 2024 12:22:36 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DZ9N1Y3epE5nfwYvK3gD6YPuRQ9WD2hmQjeOgpNzhsknwWSuUHXpewCojAtqYEIHxw6mMCmGV/M+djJGDv2HL2G3Ds9GLwcr50BSJ/UyvKzcQtPDSPj4ENE3gIVlmAYV9NlAn9mlAAe98+hrzCP8Zv90lCTzwAfXNRJDo0Bvi9izTE40N3As3c01GoIsDoH+/LiaaXDcahFHnWJPYTzhPu4/7rQt2nSMDrcOldvzlRpW/hTDUS2DlMTb30BjDYIxZEvmnH1eH8sI1FsTbmN0PV1PaAFfu0SnCihoh9bPDu/CDMqK7lBFck6mkt4DjH6d7BT3rt9jPW9/1r8ii/RtBw== 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=ScwBID0HBfkaqv0GIiMzMTFQv85ulZALhICXc7N4t5rMm1yOyYnuZ0tlpqLs25/1HAEFwmcIdGqm13qs8xmR0MjBeYhLrTrS4sbDOQu0ACwuDa8mpoetwDRdqD/rIS+UNXXbNiN2eTuRsWNKP/mrkS6KCgL9/hWLx9TbvHpWzJfnWSEo1FNSOuKdIAO60EUfNjtgbiFEjV5YIPXS7+8eOkAoulWBwkUN82J8escu4e0gO2GlyPTnZ7qBRWXzO5cWnqO244VY87V3RQxQYPJb91c0hFiC86iQUItRDfJXAtaVJTPfa7jynrIoBYf1Z+5j0j1O8MlrNB9zE/z1kkPbkg== 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=hmTVrmiYiYHK7nK0Z9Zdjj97NKXYGvpNUBo32GFGBBheONy8HpenOOnyUHjN6mMW8J+BxEP/dZwSKP2yIFE1vzFZWGgYz+6p7Rs5vKINxLYICGxYyroLoRwlL9q5Xx8MlYK9P32t/FeStvK5yAuZIrF/lYWc8Gg8pT6cYCEIuc0= Received: from DUZPR01CA0008.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::17) by AM9PR06MB7841.eurprd06.prod.outlook.com (2603:10a6:20b:38b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.19; Wed, 19 Jun 2024 10:22:33 +0000 Received: from DU2PEPF0001E9C3.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::9) by DUZPR01CA0008.outlook.office365.com (2603:10a6:10:3c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.32 via Frontend Transport; Wed, 19 Jun 2024 10:22:33 +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 DU2PEPF0001E9C3.mail.protection.outlook.com (10.167.8.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Wed, 19 Jun 2024 10:22:33 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.116]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Wed, 19 Jun 2024 12:22:30 +0200 From: LI Qingwu To: Qing-wu.Li@leica-geosystems.com.cn, oss-tools@pengutronix.de, m.felsch@pengutronix.de Date: Wed, 19 Jun 2024 12:22:26 +0200 Message-Id: <20240619102227.2013556-4-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619102227.2013556-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20240619102227.2013556-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 19 Jun 2024 10:22:30.0854 (UTC) FILETIME=[979B4660:01DAC232] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C3:EE_|AM9PR06MB7841:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 3392c9bc-776f-4dda-fb51-08dc9049bbc0 X-SET-LOWER-SCL-SCANNER: YES X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|1800799021|82310400023|36860700010|376011; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?OZn906unfJye8fMvzOR54/OWlicOuBE+h/gLmU/gWcJ2+xcuy/6RndBHzHpm?= =?us-ascii?Q?UVYyCPhb5FKuvEaq7UJgu0eygPr/ScTcwze/BWjGGYCbbEzkXzYCA30OlqeH?= =?us-ascii?Q?zkEWtFoDMVDM4BCffaFv3Q7RHlq8zparujK6E/8jfH8IzyM/gu3nMb/Gorbo?= =?us-ascii?Q?+dVoXemSy1R7PsrW2Ixr5P3ysOPIs7rmhwfUBAxZgFKooEQKParHbggwQzwn?= =?us-ascii?Q?6C3uICjAw8WIoIBXcZwOPmhkO4G6zRAiaBJBnvpeCZaxT1oqPHWiOpqxfbkm?= =?us-ascii?Q?vh0Dr7K4py1NZbfVrxSbnTMwZp+qBm7h4wa8EsYuf2GHhMMxxkE+7TfgX0sp?= =?us-ascii?Q?UEXl/QBWUbESug7A9S7V4J/TIeNvzZfqY2HOwRGyt25IAyOXLbmikYn7GIyP?= =?us-ascii?Q?/ZTC5R/SXlG/VlZGFC8GMjgzFl57O/mK9LyjgSEAqJVTXBOpg4BVMf7AjWPy?= =?us-ascii?Q?noRioyr6VHuhR5Fc+lanWMLIARANm/uFDEGKOdiluhpwKY+P997pZpaJ09f4?= =?us-ascii?Q?h11wjO0oyY+SMZGfYQKXUooK3wSys+Mx5Cd3qlgwadnrrTm7q+RIayh39cYJ?= =?us-ascii?Q?Td4ambqRB59LrCr+d8CoLCsQlByICFMk2AgLNLSXcb6xTTMe7IbPvZ3rlLdZ?= =?us-ascii?Q?RMMix/wfxoJ2yPm3Rxf9G2IutluSjldULXvmXu2u2pyc5ytOqJWKk6yEamSP?= =?us-ascii?Q?3MwBe9So+LCyoSy75lR9g9M2IWzwzJa8z4BoGq1tBtsoV/sAo9A+UckClux8?= =?us-ascii?Q?l5Flc23s+spSiLKBMi9ViyIqOlWe6CeTCL48KVx38CGWrZWdA3SE3rR1wQry?= =?us-ascii?Q?tgNo08VH7hcN/Qxyhg2fJrktC9tpXRMC6r9EgOtTlsDJxXQ6vf6AuJ5mxagU?= =?us-ascii?Q?jd9dugDa0A5yfXE+9AYL88tBw7QfIThzQgVge++S9Gq6/yEH+RLAR4QZ0K71?= =?us-ascii?Q?/smoHouHx3HpSXByizOzxw24kgNXnDdJ0Wt7Ae9YJ9nWyWeIXAlAjvz5pTN2?= =?us-ascii?Q?7hMA9jjm5zhJQtewBQX3aGQE6prhbgm2LuPlVEHbEurPYxTwy0AazuoPtNfn?= =?us-ascii?Q?jKMZiC90rj79RSsvNZ6X++RimAiedMCGrH8hTQsNuIBiHWJLbq/OXJRDNuuZ?= =?us-ascii?Q?JfkYux5HXwLsOh2bhuTxSzxnQrCIrQjCVfKXGb8Cm36HWop0Wes2qTICtYTX?= =?us-ascii?Q?DqpxkpX+7TYA/jo89ltJjYc6gq3HBtOc5jDL68ZSNdyTodKVgvYeIpRO5bqO?= =?us-ascii?Q?lujP0snS6/0dvBq+L40I4MD0qeKgW98aiKfeUTQWq+5K4ICE3Ur93/EfNXTC?= =?us-ascii?Q?ossGmB01Lt0lpH3qxIukClbqFqQiRgW1r8dTnU3+2RdiTBOEaM042fNY826T?= =?us-ascii?Q?XGCVZYoR4mXo1G6LIgLqm3nZX6pvewno4eKrjLPqBfNBQLjT6w=3D=3D?= X-Forefront-Antispam-Report: CIP:193.8.40.94; CTRY:CH; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:hexagon.com; PTR:ahersrvdom50.leica-geosystems.com; CAT:NONE; SFS:(13230037)(1800799021)(82310400023)(36860700010)(376011); DIR:OUT; SFP:1101; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2024 10:22:33.5360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3392c9bc-776f-4dda-fb51-08dc9049bbc0 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: DU2PEPF0001E9C3.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR06MB7841 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.8 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 X-Mailman-Approved-At: Wed, 19 Jun 2024 14:57:50 +0200 Subject: [OSS-Tools] [PATCH platsch V5 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