From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 480BB3858C20 for ; Mon, 29 Aug 2022 18:19:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 480BB3858C20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27TCpY3l021862 for ; Mon, 29 Aug 2022 20:19:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=selector1; bh=YiqzEaPQBMUKmbLQ3feYx9LFo7D+NV3HyAHK4hxy3sE=; b=xWXQ1a6iZcp8XBhnMW7LxSNHeltpld3MQ7A12y8rOePdVXH5IeD7t2oqSXfoz26NS3TP 1GhsDUuXYR8xKyertmqBmq0frVbYjmIoOjTemDKVIAL0jA+nEaZhs4ssF6QNrXq+xQCL 2qO4DuZCtg4KmmgsSZzlpZdOfxpqJvWicoGZCcIq89PclElA5XxJ24VdTQ1q0pEi2sgy 9C7kx7UzOn5uM8lfNnCAB1nz1eSRPaU946IhYoVjuKD4h3qXCQBdZkilUKdW15DZKS5Q M9n+PIyYu+Gqdbd28eJLFwUL/hATkg4bWPNAJJ01cC29qRAXiGGK+f94xkCaRILJLKpI 1Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3j7a5hu7py-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 29 Aug 2022 20:19:06 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 0E79410002A for ; Mon, 29 Aug 2022 20:19:06 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0A66724C45C for ; Mon, 29 Aug 2022 20:19:06 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.119) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2375.7; Mon, 29 Aug 2022 20:19:05 +0200 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= To: Subject: [PATCH] Restore _lock initialization in single threaded mode Date: Mon, 29 Aug 2022 20:18:51 +0200 Message-ID: <20220829181851.3323955-1-torbjorn.svensson@foss.st.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.75.127.119] X-ClientProxiedBy: GPXDAG2NODE4.st.com (10.75.127.68) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-08-29_09,2022-08-25_01,2022-06-22_01 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2022 18:19:12 -0000 Message-ID: <20220829181851.4torthxTT6p2xyY-4istzrCP6HTfpxDeIx01bMH4OYA@z> When __SINGLE_THREAD__ is defined, stdin, stdout and stderr needs to have their _lock instance initialized. The __sfp() method is not invoked for the 3 mentioned fds thus, the std() method needs to handle the initialization of the lock. This is more or less a revert of 382550072b49430f8c69adee937a0ba07bd385e6 Signed-off-by: Torbjörn SVENSSON --- newlib/libc/stdio/findfp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index c43028209..f7249f6d7 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -88,6 +88,10 @@ std (FILE *ptr, #else /* _STDIO_CLOSE_STD_STREAMS */ ptr->_close = NULL; #endif /* _STDIO_CLOSE_STD_STREAMS */ +#ifndef __SINGLE_THREAD__ + if (ptr == &__sf[0] || ptr == &__sf[1] || ptr == &__sf[2]) + __lock_init_recursive (&ptr->_lock); +#endif #ifdef __SCLE if (__stextmode (ptr->_file)) ptr->_flags |= __SCLE; -- 2.25.1