From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by sourceware.org (Postfix) with ESMTPS id 48ED03858D32 for ; Mon, 29 Aug 2022 15:11:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48ED03858D32 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 (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27TCpb2K029430 for ; Mon, 29 Aug 2022 17:11:08 +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=DooxYylRbyf88PjB4b6QhvfajLbV6pCXzDNOjcVrup0BWsP8vOKfC+UNvDNL7cLwMbD6 NBaUYVbgqmmjoo8epQSHCSFr5fWf/A3hEt0T8FipiNbD6Vw/om298KrwTJWgFbUap6xN HUsVw8Dew57y+rvRP+24zPwY4bL/j7zP2jcqKgu78kIc69+9xTwhuDIZMvAFqYYxvcet kUyvLTeVizh0dAbiBSuMip8VE1EzFiXyXgSkBzg+A334TrLLRPzobast68oA7u+IouH1 Y81z/WSqhthYIuGlS1ugpifdGbB3qEUEVKF7XXC5O15DeO43G7DHppgyyYhqfAOJS2HZ Bg== 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 3j78pk2j0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 29 Aug 2022 17:11:08 +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 04E0310002A for ; Mon, 29 Aug 2022 17:11:07 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9B552233C78 for ; Mon, 29 Aug 2022 17:11:07 +0200 (CEST) Received: from jkgcxl0002.jkg.st.com (10.75.127.117) 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 17:11:06 +0200 From: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= To: CC: =?UTF-8?q?Torbj=C3=B6rn=20SVENSSON?= Subject: [PATCH] Restore _lock initialization in single threaded mode Date: Mon, 29 Aug 2022 17:10:49 +0200 Message-ID: <20220829151049.3320719-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.117] 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_07,2022-08-25_01,2022-06-22_01 X-Spam-Status: No, score=-11.9 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 List-Id: 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