From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id BCC1A3852741 for ; Wed, 31 Aug 2022 08:07:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BCC1A3852741 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661933269; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WYT/x8Pjtc5j7XYvAKa/3Ufb0VJshUGTreuGCE/1j60=; b=N+eokgRayFqnYu015szlFULY4hKd4MEZb4D1cTSngZbxAIJ6csKgmg+EWJfgCgfK3TOCk3 seCuTh1woHOhHrV6E5gqhC92EJAjtxFLn1sBdPrqVi6pB2xD6OnNtZoyPv5l2M3jjZKCP4 ZhIdUjq7+XrZCZ28LIJb2SF6clrYvo8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-PwTWS1EUPQOlmUd_73Kr5A-1; Wed, 31 Aug 2022 04:07:48 -0400 X-MC-Unique: PwTWS1EUPQOlmUd_73Kr5A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC1831020BA9 for ; Wed, 31 Aug 2022 08:07:47 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.193.176]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9FF52026D4C for ; Wed, 31 Aug 2022 08:07:47 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 5AD91A80874; Wed, 31 Aug 2022 10:07:46 +0200 (CEST) Date: Wed, 31 Aug 2022 10:07:46 +0200 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH v2] Restore _lock initialization in non-single threaded mode Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20220830135452.2247049-1-torbjorn.svensson@foss.st.com> MIME-Version: 1.0 In-Reply-To: <20220830135452.2247049-1-torbjorn.svensson@foss.st.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,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: On Aug 30 15:54, Torbjörn SVENSSON wrote: > When __SINGLE_THREAD__ is not 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 > > Contributed by STMicroelectronics > > 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..2cc549537 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 Pushed. Thanks, Corinna