Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3475979rwl; Sun, 2 Apr 2023 08:15:14 -0700 (PDT) X-Google-Smtp-Source: AKy350ZY36x5x2gkRhIrCM/Zq8ke3VrDFU1GPwiu/Q3HcxB13o2tfJmvnerlxahw9ermP0pXg1gJ X-Received: by 2002:a17:906:2009:b0:933:4184:f0d7 with SMTP id 9-20020a170906200900b009334184f0d7mr33713491ejo.69.1680448514523; Sun, 02 Apr 2023 08:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680448514; cv=none; d=google.com; s=arc-20160816; b=hncHDSC/vRKAZs8ajSYvSEukA3zjVzrGHHrMHp95HkOUXqCTYtqhLuwB05yjZDGELO YUDOyFcSYgTTbwTeABedQLd5Pb3qo4Pgn39+25oylhrqnp4f2QGewRJyORqncXcDxi/P JCIJoLI++LW/BIeWczJanW6jkrAkYEBeVioumb+AYgreq3sIReJvWvxbaX3hiyXJ3quB UdmFXEA5SXpQEjcPTrAXZQSvuG1E09nsQIR1W4oeT8Z/ewBA6qQFop/D5UEFq20Q5VX0 8HPIyx0Ngx0VCk3FTKJl649UOsgj4vwtN97wbuf5kZcrGorfWJsmlwTcXczQ3WRPlono +QPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=kEd7pJj5rhqqqpCmSr+UCxz5vtRcTVZWdM+HoyYCW7E=; b=dCXiiHSk2LuM/pfNTR/GLttlIoH66q0jvEclj77iZCIdyq7AWJQZMpiBoIHNvHh/xK xamMCmc2gLaD4Uf+GNICctkclhXJgQ5z0vOjv1GopGDs150QBoIxyOs8L8xJVvaknUd7 tbBvAUA0SQv9JOnz55XtJmFuarR2MxX4xAk/M2vzroDwrSkIk3ZGrBA1LD3N02Qn3QYJ 3OeYi99eS8PKfLSCtF/TmZ4YAXa4kC3j1F9Frit07mezM+ecYqbiz+bjalfKtJjIu3XM Su32nD8VgJqMzJWowQzaCouBDBhh30kIJ1c4m/PCjgm+Ve6iLrNXKwLQCdc+4o2pMuF3 qLbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=Gw+WlslV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qp5-20020a170907206500b00932dac6402csi5624628ejb.370.2023.04.02.08.14.49; Sun, 02 Apr 2023 08:15:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=Gw+WlslV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjDBPHY (ORCPT + 99 others); Sun, 2 Apr 2023 11:07:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbjDBPHW (ORCPT ); Sun, 2 Apr 2023 11:07:22 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C818A73; Sun, 2 Apr 2023 08:07:21 -0700 (PDT) Date: Sun, 2 Apr 2023 15:07:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1680448040; bh=4hoeS1AG5TT22GF/AX/PrvaGgitME1JepnPdgtVCQ5c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gw+WlslVpht56HiY4GYcGPzF9fiXbrlmFrE1JTfIXqhvLVXmGrttZf4RXUMeNFT1M c1A+znX5te+VVl8T96Esb6dMrV8lZx6JJ/EHY2YKC6XBk9taAC+YNZc/c31JZklsR0 +e5tzQPPSZfYplPZvucidD/ELi81Ra7ia7I44Y1I= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Willy Tarreau Cc: Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v2 2/3] tools/nolibc: implement fd-based FILE streams Message-ID: References: <20230328-nolibc-printf-test-v2-0-f72bdf210190@weissschuh.net> <20230328-nolibc-printf-test-v2-2-f72bdf210190@weissschuh.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-04-02 16:03:38+0200, Willy Tarreau wrote: > On Sun, Apr 02, 2023 at 01:02:46PM +0000, Thomas Weißschuh wrote: > > Willy: > > > > This uses intptr_t instead of uintptr_t as proposed because uintptr_t > > can not be negative. > > Ah yes good point. > > > +/* provides the fd from of stream. */ > > +static __attribute__((unused)) > > +int fileno(FILE *stream) > > +{ > > + intptr_t i = (intptr_t)stream; > > + > > + if (i > 0) { > > If you don't mind I'll change this to "if (i >= 0)" since we also want > to set errno on NULL. Sounds good. > > + SET_ERRNO(EBADF); > > + return -1; > > + } > > + return ~i; > > +} > > OK for the rest of the series. Thanks, Thomas