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 4F8AA3857418 for ; Mon, 29 Aug 2022 19:33:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F8AA3857418 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=1661801610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YSB7+gz8nWFxV6K6hV1ypUlkb6BRkfMfmKRByd8dMws=; b=icEEjfHeM6g1urcRuaIdZjmr5xzJPBduQNUqoXd11wKOTnVW2aHEmqVavzt+jFFSsrivl8 yyGTtP519JpkOUV06Jt8dpkZUsk5KktfA8Ve/axW2+o4ogec2ks5720paR3pjqDmNnFeDT 4r0nKzksSj12CmAwwoaX6ZcPn8tALKg= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-496-ql-F7ItdMduzUY7uXhJTZA-1; Mon, 29 Aug 2022 15:33:27 -0400 X-MC-Unique: ql-F7ItdMduzUY7uXhJTZA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-33dc390f26cso142244887b3.9 for ; Mon, 29 Aug 2022 12:33:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=YSB7+gz8nWFxV6K6hV1ypUlkb6BRkfMfmKRByd8dMws=; b=dVtWfAnm/fLBVKBr19xucAn+seREWt9WrCIY4Hxzc27CH0j0fFume74kLXq18p1h6a Y6k22btPQ9Wbla6DkhkcaOYW/B2EVoDP///TGoSjjSHe4XGZGqsXWscOfJ4VCwGMHLf6 X3rCc9VL6UPVLeVV4fv2uzM5b7IlwsAtWarV7bbOB7gh/K06i5RYXzBOQ4NRkJhKppqN 3bowfxg2LJxpRDm+96Ac/8VuhSwnT2VwsNWmoKf2EjOlIgUC9sR6/on0MRxdFXdsYtai zRcSFBmznc9ZMKBnkdrK9ZVb4frkGEeUopKHnX1ygXVJ/h0LP5Egdi1Syj0+lN7e3I8G JxZQ== X-Gm-Message-State: ACgBeo2DiNWKDOEooKnNjGpVLfgOBDz5CR6LYEHf+rQl5CSkcydinZVI XsaD3aJahAmQa2X8vZGoj8rmtXRF2stNapOnanESwg5eX6cHMBfn8SKKMTb84tTOkMe5h0tJcUG 3z4zUxaHF9UJ7M0RPoZUnVKb9QkIfy4k= X-Received: by 2002:a25:6f8a:0:b0:695:8d02:89ed with SMTP id k132-20020a256f8a000000b006958d0289edmr9856921ybc.434.1661801606780; Mon, 29 Aug 2022 12:33:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6UafHWsgp+gqOS6V7y779NQ/s9DZkQRDv4J6rndzkcoUm4Az28fLmM8nH1ea7NjOAiABUIh1UaDR6jNgV7ROE= X-Received: by 2002:a25:6f8a:0:b0:695:8d02:89ed with SMTP id k132-20020a256f8a000000b006958d0289edmr9856910ybc.434.1661801606578; Mon, 29 Aug 2022 12:33:26 -0700 (PDT) MIME-Version: 1.0 References: <20220829151049.3320719-1-torbjorn.svensson@foss.st.com> In-Reply-To: <20220829151049.3320719-1-torbjorn.svensson@foss.st.com> From: Jeff Johnston Date: Mon, 29 Aug 2022 15:33:15 -0400 Message-ID: Subject: Re: [PATCH] Restore _lock initialization in single threaded mode To: =?UTF-8?Q?Torbj=C3=B6rn_SVENSSON?= Cc: Newlib X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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 19:33:34 -0000 Hi Torbjorn, Could you clarify? Your description and title says when SINGLE_THREAD, but your patch is #ifndef __SINGLE_THREAD__. -- Jeff J. On Mon, Aug 29, 2022 at 11:11 AM Torbj=C3=B6rn SVENSSON < torbjorn.svensson@foss.st.com> wrote: > 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=C3=B6rn 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 =3D NULL; > #endif /* _STDIO_CLOSE_STD_STREAMS */ > +#ifndef __SINGLE_THREAD__ > + if (ptr =3D=3D &__sf[0] || ptr =3D=3D &__sf[1] || ptr =3D=3D &__sf[2]) > + __lock_init_recursive (&ptr->_lock); > +#endif > #ifdef __SCLE > if (__stextmode (ptr->_file)) > ptr->_flags |=3D __SCLE; > -- > 2.25.1 > > 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 4F8AA3857418 for ; Mon, 29 Aug 2022 19:33:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4F8AA3857418 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=1661801610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YSB7+gz8nWFxV6K6hV1ypUlkb6BRkfMfmKRByd8dMws=; b=icEEjfHeM6g1urcRuaIdZjmr5xzJPBduQNUqoXd11wKOTnVW2aHEmqVavzt+jFFSsrivl8 yyGTtP519JpkOUV06Jt8dpkZUsk5KktfA8Ve/axW2+o4ogec2ks5720paR3pjqDmNnFeDT 4r0nKzksSj12CmAwwoaX6ZcPn8tALKg= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-496-ql-F7ItdMduzUY7uXhJTZA-1; Mon, 29 Aug 2022 15:33:27 -0400 X-MC-Unique: ql-F7ItdMduzUY7uXhJTZA-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-33dc390f26cso142244887b3.9 for ; Mon, 29 Aug 2022 12:33:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=YSB7+gz8nWFxV6K6hV1ypUlkb6BRkfMfmKRByd8dMws=; b=dVtWfAnm/fLBVKBr19xucAn+seREWt9WrCIY4Hxzc27CH0j0fFume74kLXq18p1h6a Y6k22btPQ9Wbla6DkhkcaOYW/B2EVoDP///TGoSjjSHe4XGZGqsXWscOfJ4VCwGMHLf6 X3rCc9VL6UPVLeVV4fv2uzM5b7IlwsAtWarV7bbOB7gh/K06i5RYXzBOQ4NRkJhKppqN 3bowfxg2LJxpRDm+96Ac/8VuhSwnT2VwsNWmoKf2EjOlIgUC9sR6/on0MRxdFXdsYtai zRcSFBmznc9ZMKBnkdrK9ZVb4frkGEeUopKHnX1ygXVJ/h0LP5Egdi1Syj0+lN7e3I8G JxZQ== X-Gm-Message-State: ACgBeo2DiNWKDOEooKnNjGpVLfgOBDz5CR6LYEHf+rQl5CSkcydinZVI XsaD3aJahAmQa2X8vZGoj8rmtXRF2stNapOnanESwg5eX6cHMBfn8SKKMTb84tTOkMe5h0tJcUG 3z4zUxaHF9UJ7M0RPoZUnVKb9QkIfy4k= X-Received: by 2002:a25:6f8a:0:b0:695:8d02:89ed with SMTP id k132-20020a256f8a000000b006958d0289edmr9856921ybc.434.1661801606780; Mon, 29 Aug 2022 12:33:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR6UafHWsgp+gqOS6V7y779NQ/s9DZkQRDv4J6rndzkcoUm4Az28fLmM8nH1ea7NjOAiABUIh1UaDR6jNgV7ROE= X-Received: by 2002:a25:6f8a:0:b0:695:8d02:89ed with SMTP id k132-20020a256f8a000000b006958d0289edmr9856910ybc.434.1661801606578; Mon, 29 Aug 2022 12:33:26 -0700 (PDT) MIME-Version: 1.0 References: <20220829151049.3320719-1-torbjorn.svensson@foss.st.com> In-Reply-To: <20220829151049.3320719-1-torbjorn.svensson@foss.st.com> From: Jeff Johnston Date: Mon, 29 Aug 2022 15:33:15 -0400 Message-ID: Subject: Re: [PATCH] Restore _lock initialization in single threaded mode To: =?UTF-8?Q?Torbj=C3=B6rn_SVENSSON?= Cc: Newlib X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000007297ad05e76656b4" X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,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: Message-ID: <20220829193315.TeV0oeRhILsceYgw3BQhL8ENkyDPWucU5Ab_RZsxdjs@z> --0000000000007297ad05e76656b4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Torbjorn, Could you clarify? Your description and title says when SINGLE_THREAD, but your patch is #ifndef __SINGLE_THREAD__. -- Jeff J. On Mon, Aug 29, 2022 at 11:11 AM Torbj=C3=B6rn SVENSSON < torbjorn.svensson@foss.st.com> wrote: > 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=C3=B6rn 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 =3D NULL; > #endif /* _STDIO_CLOSE_STD_STREAMS */ > +#ifndef __SINGLE_THREAD__ > + if (ptr =3D=3D &__sf[0] || ptr =3D=3D &__sf[1] || ptr =3D=3D &__sf[2]) > + __lock_init_recursive (&ptr->_lock); > +#endif > #ifdef __SCLE > if (__stextmode (ptr->_file)) > ptr->_flags |=3D __SCLE; > -- > 2.25.1 > > --0000000000007297ad05e76656b4--