Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2046442rwd; Fri, 26 May 2023 00:27:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6f9ED2+GMPeZcwOZWfDDfocDLRmaSoXVe8NZWuhST81yLmuNOpjk4fVwK0kpCM7eUi1Fkh X-Received: by 2002:a17:90b:fc2:b0:253:3e9d:f925 with SMTP id gd2-20020a17090b0fc200b002533e9df925mr1419467pjb.31.1685086077672; Fri, 26 May 2023 00:27:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685086077; cv=none; d=google.com; s=arc-20160816; b=g2Gyv5nFDgxNJG26S994YvIgdxmKuYOmVLbKLWFoJsZ9kyJTs6pXliQQ2qPrEqKtka l2iT2rizMFmBLdS2KrVV3fDm0MKSCnbMTdewtRMJ4bWrE8sycO5QntgnyGhuVE3E6STY u8V3XzyJoiJ7B6Yzu5B3S9o2qm43kR2/ds1Nv1FpjNe6K4l89n2T5ek52ZvtVmzsnQ7K TNiNcp3avZ/rkGUeLPs4ciUkxlIwgo3gSM+y7dWcaZ9w/t8F6LXIR0e4GmyGwHO+2dLB wVNF7vBP14Sf59h05vm8GsN0QYZs9er2VKB0y8AKrvZxmmmKC3UDQiqLblDUCpJmmldH J+uQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=PR1OCxk6RVzRQn3K8NBbjmIt49U5gt0fhY20Lu4ZJ2Q=; b=AQlZYnA2khQYHzheHivMkhb66aLpJ/OWgpWnnkyu9OkFd3b4Wpfu8RDcOfuI4DT/ir 6qXDZyxyGxevyBomMr0cdBQvtC/z+c6xMpuIIg9c0uZoWNQcguBtLurA9+XR6jKRbran 3gdcaFNM3BJiNLi0jXEsNYc/4cyJLXL2laKL4K2NYo08CTEuDArI9hf6FmjEA9QVl97b uOju8gguak0Ej+8j7Lp0dQuaXPr1sd1O6Lv03WZa/T9p1RHvBNvKzrW9oV4T+tdU4Qf0 2V4HX9RablFfWVQ9jMC4Sn94J9UIppf9/2zeA1kfHjm7DZ0JcBdS5JCfVeYKQ8M11H2x bgIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@t-8ch.de header.s=mail header.b=WDvP36Kk; 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 bj19-20020a17090b089300b0025345363ef3si3481296pjb.115.2023.05.26.00.27.44; Fri, 26 May 2023 00:27:57 -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=@t-8ch.de header.s=mail header.b=WDvP36Kk; 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 S236611AbjEZHPQ (ORCPT + 99 others); Fri, 26 May 2023 03:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231691AbjEZHPP (ORCPT ); Fri, 26 May 2023 03:15:15 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DDF0114; Fri, 26 May 2023 00:15:13 -0700 (PDT) Date: Fri, 26 May 2023 09:15:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1685085311; bh=rEZjZ7jb112xctWDeTzmzbvGkTYxGoBvCV4K9U7x4Hk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WDvP36KkQDB/msyE6X9PkQOMhUADIby45vq3TxdlP5SKnqWYJYDKLVN8940oQU5Xt snRCrStgmWdheBAeetdgxvwrS6ajR/r5rPA4tzQti1PzuSXiD8iotOU/IwPy5jWEGH oYRiMtqWVGPA3rl4VZwFBnzyj9pg3Xv74JBjLkqs= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Zhangjin Wu Cc: w@1wt.eu, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com Subject: Re: [PATCH 09/13] tools/nolibc: sys_poll: riscv: use __NR_ppoll_time64 for rv32 Message-ID: <78d91061-1bcd-4031-89e1-706c3f49d762@t-8ch.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,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 2023-05-25 01:57:24+0800, Zhangjin Wu wrote: > rv32 uses the generic include/uapi/asm-generic/unistd.h and it has no > __NR_ppoll after kernel commit d4c08b9776b3 ("riscv: Use latest system > call ABI"), use __NR_ppoll_time64 instead. > > Signed-off-by: Zhangjin Wu > --- > tools/include/nolibc/std.h | 1 + > tools/include/nolibc/sys.h | 7 ++++++- > tools/include/nolibc/types.h | 6 ++++++ > 3 files changed, 13 insertions(+), 1 deletion(-) > > diff --git a/tools/include/nolibc/std.h b/tools/include/nolibc/std.h > index 83c0b0cb9564..221385c0e823 100644 > --- a/tools/include/nolibc/std.h > +++ b/tools/include/nolibc/std.h > @@ -32,6 +32,7 @@ typedef signed long off_t; > typedef signed long blksize_t; > typedef signed long blkcnt_t; > typedef signed long time_t; > +typedef long long time64_t; > typedef long long loff_t; > > #endif /* _NOLIBC_STD_H */ > diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h > index 0ff77c0a06d7..08d38175bd7b 100644 > --- a/tools/include/nolibc/sys.h > +++ b/tools/include/nolibc/sys.h > @@ -923,8 +923,13 @@ int pivot_root(const char *new, const char *old) > static __attribute__((unused)) > int sys_poll(struct pollfd *fds, int nfds, int timeout) > { > -#if defined(__NR_ppoll) > +#if defined(__NR_ppoll) || defined(__NR_ppoll_time64) > +#ifdef __NR_ppoll > struct timespec t; > +#else > + struct timespec64 t; > +#define __NR_ppoll __NR_ppoll_time64 > +#endif > > if (timeout >= 0) { > t.tv_sec = timeout / 1000; > diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h > index 15b0baffd336..ee914391439c 100644 > --- a/tools/include/nolibc/types.h > +++ b/tools/include/nolibc/types.h > @@ -203,6 +203,12 @@ struct stat { > time_t st_ctime; /* time of last status change */ > }; > > +/* needed by time64 syscalls */ > +struct timespec64 { > + time64_t tv_sec; /* seconds */ > + long tv_nsec; /* nanoseconds */ > +}; A question to you and Willy, as it's also done the same for other types: What is the advantage of custom definitions over using the one from the kernel (maybe via a typedef). From linux/time_types.h: struct __kernel_timespec { __kernel_time64_t tv_set; long long tv_nsec; }; > + > /* WARNING, it only deals with the 4096 first majors and 256 first minors */ > #define makedev(major, minor) ((dev_t)((((major) & 0xfff) << 8) | ((minor) & 0xff))) > #define major(dev) ((unsigned int)(((dev) >> 8) & 0xfff)) > -- > 2.25.1 >