Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2323559rwb; Sat, 29 Jul 2023 04:54:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlEcSD3boo2ZRehBRIPQoKi/vpwDx0OBkaKYnmzN7PHaaO5T1Ae7+XBshvfa0FKW01+dl1Xz X-Received: by 2002:a05:6402:1016:b0:522:1dce:ca09 with SMTP id c22-20020a056402101600b005221dceca09mr4016971edu.29.1690631662658; Sat, 29 Jul 2023 04:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690631662; cv=none; d=google.com; s=arc-20160816; b=w6Mow1mn9X06n7x5GzV4sAPtXfvg9xCLUbYm5loYnel28Rwd4/hCXsQgVySwxjLYKH bUIafIWzJ3CjY9a3MO5Ohko+whumnQpJS/nWqxecGNpFBG7IcLLwM6GKWNFSI3FjOBMf ZP1sbumZtKjnkjF/1QQplehXewqwDvh7DJUaJY719Tbh8KOiqaeKrFtA0pyfBeBT7Fas N1Mf2wyvpnNf8Bn2WN49sX8zQK9pB9yyb4B1+MBo7GyrYbx+F+HiOdufaNTadoDIT+tE OWQ6BxburUF9fBU5uF11h2svhK108IJ5xS+bXeO+cdTuGmcncqGFDJTVdjs+x8/NlzYq 4YEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cc6cJnxHxW4EM5BD8okjjzJWxtzEcw+16MIJk9xkua0=; fh=lemBPq3vBsodp5vwIY3s5MU4zM8cSgWZie/MQvg4MOM=; b=V3Mvue7R8XPkbX4B2ujxsnUBfPt3TX9kGuKKypIJZ3C8hly9oM0UmdOzGmKzIGchPX hvc/cxr80p02A0AVtEnlR2MMXqDRf2bKazW6PeqBVY2xpUxgYbvcUmDNpIbexmTalHgq 07l+hAdhAi6hWhkM7nvsFZuCMzR2XjlwhVZweszLkYgLbLphVunYdjoUA0J123qYn6kF XKl98lZyDCNML7JISQ7rY+1WWb3ADZ1rDKhQoRQbd+z7W/rlANG2qkTMyGcZDq+oBqc9 4pbDlZYoBk+5OI6XCtKlbObL4xyKRU7KAjdJpLWOP2crBy3SjRIrWqSzhj5ZpDHQpH86 TnAQ== 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 d9-20020a50fb09000000b005222bc367e1si3859324edq.98.2023.07.29.04.53.58; Sat, 29 Jul 2023 04:54:22 -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 S231279AbjG2KEM (ORCPT + 99 others); Sat, 29 Jul 2023 06:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjG2KEL (ORCPT ); Sat, 29 Jul 2023 06:04:11 -0400 Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0B85210D0; Sat, 29 Jul 2023 03:04:08 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 36TA41ej004582; Sat, 29 Jul 2023 12:04:01 +0200 Date: Sat, 29 Jul 2023 12:04:01 +0200 From: Willy Tarreau To: Zhangjin Wu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org Subject: Re: [PATCH 1/2] tools/nolibc: add pipe() support Message-ID: <20230729100401.GA4577@1wt.eu> References: <20230728191717.GA32165@1wt.eu> <20230729083700.7554-1-falcon@tinylab.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230729083700.7554-1-falcon@tinylab.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 Sat, Jul 29, 2023 at 04:37:00PM +0800, Zhangjin Wu wrote: > > This one does not have the correct prototype for the function exposed > > to the user, pipe really is "int pipe(int pipefd[2])". Maybe you were > > thinking about sys_pipe() instead ? But since MIPS also has pipe2() now, > > there's no reason to make an exception. > > > > Yes, pipe2() should be a better choice, but I have seen this sentence in > syscall manpage [1]: > > /* On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the > following prototype; see NOTES */ > > #include > > struct fd_pair { > long fd[2]; > }; > struct fd_pair pipe(void); > > If it is about syscall, then we are ok to align all of the architectures > together to use "int pipe(int pipefd[2])" Yes it's OK, that's how applications expect it to be used: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pipe.html For the archs you mention above, it's the libc that wraps the call, exactly what we ought to do as well (using pipe2() since it will be easier). Willy