Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3410270rwl; Sun, 2 Apr 2023 07:05:09 -0700 (PDT) X-Google-Smtp-Source: AKy350bl0tp0W5J6R0jdhjgjHNvJG0MNXTcfWYKakhnQtww56OvZKD0hAm3WQqE/QdpLqWpOFXqL X-Received: by 2002:a17:902:f34d:b0:1a1:cef2:accf with SMTP id q13-20020a170902f34d00b001a1cef2accfmr26910477ple.30.1680444308869; Sun, 02 Apr 2023 07:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680444308; cv=none; d=google.com; s=arc-20160816; b=yL+Eyv2fv96Yxgh9FLLB8JcE+nBPeIicU1CTePqwVzY1/wF/lDcPsvtLAqHjGsFyJo Jk+p8DZsyiN9LF9+grFzbKBaYKLdBlIZWpZfUsPvx9YTK3idfqiks+jFcZ8yBwX3Ocnj bgq290q7gC2wx1AheI6YQ3Ss62/1858uoctPmDghMjhLHS/8+VviElHkkcoCYK/59o1g fD9PFtioUZ2KB7q71oY0pBie5nDScqMZnIXTYSy+8Lohir8jiQNO7GMGHG4e4KCp5ZYD MBYt9Lk+nUBMpJ9OCSK/FYqk42JE44IYmxqS0NBZBpq995hmOcLKUbQpdsNILyPi2JH8 L5Yw== 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:date; bh=MM4wDjS6GOQFF7bDMuG3EaYrSluas3VDJUEsrAjL0S4=; b=adKwp9OuLFfYVXVhrCXZsLJM4eda4L6tJBoDncGWPfzjoA1Xjbf0s7FHuTl58nOoU0 Y08ALxYcgcbNggd4iRNJIIbTeslHw/upvibo9txR888QkyFvg/gkeWBbvJhZYVtDKYl4 WrmTYjuVVQujjPEn8506pUppVh1LeMbL2rfEjXMNMj27lb1MSoQtpA4EmEfIYyrRz58A YA0o3VTtktxz0Gb74Xd9aNHMr1FufrYl3VVcE1gk4xLrHpc+mFTIfNhjMSaActQDdTlP 1xMztgZt+Pm0Xl/m3BGDYcTSdW8iU9JnutTKYjv17CzvR2QE1aFNR+sIWX2/NADLiy9D cSww== ARC-Authentication-Results: i=1; mx.google.com; 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 x24-20020a1709027c1800b001a1f68ff791si6011832pll.17.2023.04.02.07.04.57; Sun, 02 Apr 2023 07:05:08 -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; 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 S230326AbjDBODv (ORCPT + 99 others); Sun, 2 Apr 2023 10:03:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbjDBODu (ORCPT ); Sun, 2 Apr 2023 10:03:50 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 583F7FF0A; Sun, 2 Apr 2023 07:03:47 -0700 (PDT) Received: (from willy@localhost) by mail.home.local (8.17.1/8.17.1/Submit) id 332E3ciM019674; Sun, 2 Apr 2023 16:03:38 +0200 Date: Sun, 2 Apr 2023 16:03:38 +0200 From: Willy Tarreau To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230328-nolibc-printf-test-v2-2-f72bdf210190@weissschuh.net> X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,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 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. > + SET_ERRNO(EBADF); > + return -1; > + } > + return ~i; > +} OK for the rest of the series. Thanks! Willy