From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 26 Jun 2024 10:41:41 +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 1sMODj-00CU77-2L for lore@lore.pengutronix.de; Wed, 26 Jun 2024 10:41:41 +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 1sMODh-0007r9-OM; Wed, 26 Jun 2024 10:41:37 +0200 Received: from mail-vi1eur04on2056.outbound.protection.outlook.com ([40.107.8.56] helo=EUR04-VI1-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 1sLLnU-0008Ke-7M; Sun, 23 Jun 2024 13:54:16 +0200 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U3UD9DIMNbNiUocIlebsKH06/w0rBE3TZ3E7MjF5C71YOkOCxpzGGHXSrNE5/TqEJK4KXMS9fAdOZFz4upAyW25/GY1zhUbQvGZqgD3jK2A3J1vL+7JWvCl1aR2OEuAKlkJGCeUlShW48m4T/9ev3Rx+5HEyhHsS7dLQOY5VYzdkYk47LveR6HNVmj8fOz1B+aMQC70ptaT6oVUtqkIkrP9LexdcEUbSnyp5tftE2g7wfV382JkrtMFE0XFb3HjQJcvqGqfmHE8FRpSs+JbjNg/WuTlcifGGQzLPGAaTh9JOOwm0FtR+9/jnqDjo2iITrCcQ7tPoYhtIerPQgsey4Q== 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=SQ96jsUHU1lKZIzec5pvpjjR62nPhOudtwuCf6IO+S9mJAHLiooL9CF9/KPNfOQkoRIRxNRbUiY0G+9aeVB8yu8Pu6937DYUDtwnyLxISyylixHbnseU98XT6F+BDZx49/MRhHFXzlFLObPoKQWODUEMNQoIdY0ynUY7Xvij1CTYXEXOpVTIUCHuehwgFCqLkxs8Hbelekad75MC3JGm3mXym+lRWz96Lifgdb8k96FP/irF5unECT+oDy6bkpRLdn9VgCWPw2BcHvC7gui5mKK9Pb/9OKUg1Ez1gXHqKpeqHdtFkAUY/Q6/ZZ9E6GG30AMzjrVJySF98BkIS24LWw== 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=MWTC154ObjzuOXKHOnBKcwWu1G18yPjXQA6yTwLAUCs6Jq29gqLjYbCi/fBvMX2JKYVi/gjx0i1dbbnlvVIO/pKOZXUF4EGXI78AFbIWTGHgvs4vKG09WoEuwis5ECjCFuq6BBcho8Mkq6E29wygXAHxoWZU1zv3WSC2hWaHm8E= Received: from AM8P251CA0022.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:21b::27) by PR3PR06MB6778.eurprd06.prod.outlook.com (2603:10a6:102:63::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.25; Sun, 23 Jun 2024 11:54:13 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:21b:cafe::c0) by AM8P251CA0022.outlook.office365.com (2603:10a6:20b:21b::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.38 via Frontend Transport; Sun, 23 Jun 2024 11:54:13 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.15 via Frontend Transport; Sun, 23 Jun 2024 11:54:13 +0000 Received: from aherlnxbspsrv01.lgs-net.com ([10.60.34.116]) by hexagon.com with Microsoft SMTPSVC(10.0.17763.1697); Sun, 23 Jun 2024 13:54:09 +0200 From: LI Qingwu To: Qing-wu.Li@leica-geosystems.com.cn, oss-tools@pengutronix.de, m.felsch@pengutronix.de Date: Sun, 23 Jun 2024 13:54:06 +0200 Message-Id: <20240623115407.983326-4-Qing-wu.Li@leica-geosystems.com.cn> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240623115407.983326-1-Qing-wu.Li@leica-geosystems.com.cn> References: <20240623115407.983326-1-Qing-wu.Li@leica-geosystems.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-OriginalArrivalTime: 23 Jun 2024 11:54:09.0414 (UTC) FILETIME=[0EA7F260:01DAC564] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|PR3PR06MB6778:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: caea49a9-a924-4552-efbb-08dc937b33a7 X-SET-LOWER-SCL-SCANNER: YES X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|82310400023|36860700010|376011|1800799021; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LfeQyaiqT75NUKrCy7veQsP4gzhpyrxYyT4J8t8yfXO2mjq6M/+cVYAA9noY?= =?us-ascii?Q?dIv444ewQFthvEr/jChi2tH1grIQqd1dQziZA18v/6jRv2DWWCL3H2qGPkmp?= =?us-ascii?Q?K1APcCjI/lsZB9SFwCn0Tzj0SsnvgarwMhRLVG+VGaesdxb6Himd9i+WP8b0?= =?us-ascii?Q?ls+LgZn+sejYh4agrG1tMnLTdogM++isklIDCyJOdo2gPbDx0Waxch0uuRie?= =?us-ascii?Q?4fw51TRBi0TlEriyKmvJthQv3cgAnzZg9NdkgBxory0/qljJUuB85Lt63CYY?= =?us-ascii?Q?itRtSZh4nTzDKawrm+DZ1M/ADhtYnSUSt2hdIcE87xIJpt5oWNGm8HamdHCX?= =?us-ascii?Q?N+oJ4ofOpnQfSiAWpnsmlpQqJSTEEIf5PYngZOxJx7cJ7+fdiIhaRbvgbP3r?= =?us-ascii?Q?HCakKxzh9Um2Gp3D64WeAv/pxD7/WWLJ/rOpgga4OKVM1YCXcZXCRS7H1p2M?= =?us-ascii?Q?rB3QrCmGYB5pkstJ8o+HUnGzunOb+YjcWPr31+yT1QzV/0ppteZcJkPIph0c?= =?us-ascii?Q?Zbg+b90D2Sp59cP014tqu5S2yz4LvIWJq1TEAE8mBFOVxPhx9fZk4zmZ1Epe?= =?us-ascii?Q?HbolUSBffjsXXpO0BuAMofHb/uwLR3aWxa42vox3yc9ENj4+NuRmJS5+Ia5a?= =?us-ascii?Q?t048JULXQdUc7iuQLUc/6ztXXCR21OH87paCYJtddZcYy5BOJvOpNhJk5XsP?= =?us-ascii?Q?vVq1GvwZVWwdTBl3a0xh+QD+yM47UOxRogVSw6CjSI5jFZrvshOB1yWFmpF9?= =?us-ascii?Q?3vhSLVkUIyqj0NW1X5Pw9xK+GFCQuexUpZCQvNgE9SURIPV28kMsEr4T6tUm?= =?us-ascii?Q?oPDUe/hq8GpnoISwfjWVzE+w4rejkJKq9Jn7lRNbN9qlp/VYYN2xuP+hNgRv?= =?us-ascii?Q?bqllTJf7bmHxLS7efbjIkZmlseT7bVaIcFjdDX1YcbqHIzYab46Ywktsh9E+?= =?us-ascii?Q?bqiCGv3lLclv2q/9j2s9avurK4soPFquVqULCATGtshXB/94518CEQJ/h5PD?= =?us-ascii?Q?QZyEeMMErjUTQ+vpA9NSJapgyZ9nA67Mp6AcwQy9waRdxsGSwwcNVJ/ATqjF?= =?us-ascii?Q?mLTZIuAhgfosiPhh35c0/avdhLWt8AdneNvWViJb8QcnJjDR4THwnaJr6eAT?= =?us-ascii?Q?l0evPks85C35TCS+WkILyO0X1J1eKM4pGheLpXJfJENZ1bay2Tg2dDVuAKeB?= =?us-ascii?Q?+Us5j65AY2ZCYbVIB5tPg3IFT9TRlWhAOEER4NFC7eXb1Ngj8Z2+4x/G6Gfo?= =?us-ascii?Q?szOnOqrWkDnWENZW7bbdYyQtTKpvytc+N7usatS4RpuJ+rL/TFx4g1SjLI0M?= =?us-ascii?Q?XSE7vKJxDz8S+blW0GnPF8Bj/3fwtBziv+SFmRntCysC8PxKwXRrNiYNhU7w?= =?us-ascii?Q?1z6uinu4XBdeZSol67QUjbkFFrV4yuxI90al2J4dJ66EtHHfpg=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)(82310400023)(36860700010)(376011)(1800799021); DIR:OUT; SFP:1101; X-OriginatorOrg: leica-geosystems.com.cn X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2024 11:54:13.5734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: caea49a9-a924-4552-efbb-08dc937b33a7 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR06MB6778 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: Wed, 26 Jun 2024 10:41:34 +0200 Subject: [OSS-Tools] [PATCH platsch V6 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