From patchwork Wed May 24 17:57:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 98645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp97613vqr; Wed, 24 May 2023 11:20:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4LvR7NFlcaH6Vq7YPZp5GR7D6lW6EoaXMoXBibwwmgIRS02uVOySQNq5rW0o1rYLEj25J3 X-Received: by 2002:a05:6a21:6d92:b0:10b:4330:1de6 with SMTP id wl18-20020a056a216d9200b0010b43301de6mr13002164pzb.10.1684952453702; Wed, 24 May 2023 11:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684952453; cv=none; d=google.com; s=arc-20160816; b=uHf0JzT5N863HswD1yhzrN++hhLco4cYPAxdqEeGWbtgEXK5MxrKf2feAggzGpWOqb 4Yao5SCLUviCocEnE1aaPxJxB8tGPrjsSpc+k3jn3FLH18mVCOh7P7dSuEHc4pFTKRsj dbmFr9MT6TUcBw/JDDpcIHJzkYNhhtlwi513qiLUwJgYYor+h5O6SwDNIwv1+HW0pZIk zxUbK24Y5LoZdt8zMy2j5iBcVwurCRW2q1kccnoxMbsWD4r8cbP5QBd0jYvparrt7wcd 7Lqw79m+uhD8WFLif+1ruAM+RRjVp5UkAFZxFYLhLe7N7ncfLMEEF6QcdSVpkw9JtWGG KnIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=HPJr/DpWViA+XYl4F3WHI6QuRSFbuhfB5M20FaHKjx8=; b=DJIhoe4nyEkuVS5Jx5hkFCCxSnrC32CpU8YvfHEp8rmNeiGtvqQHnM+uqyKWbygwFg 22PnDcr2ezQN5xcCumMfVVE9ZzqzXT3AThlinWqt4GRNlNRCNsY1HA127dBRK1OjHGWg K4hFWRzUYy42ShyXPrGDmdDxbR9FJZ33cYF57YvFYXyQzaiao0U7bWXH+5wxSKbumQIk xb3nH3wdK+B8mdWXlDekw7ODxfsOdqbx8hIW1+E3kfb7L3zNxSvmBVA0nw+npkLjCZGC ddTRTHaxeKBiOmv2eOT8781NsFa72UtqOm1cQFv/Ol0a3L9Vgaer8bBCRcmWV3xxpAUP sHSg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r28-20020a638f5c000000b0053eedcc504esi568734pgn.373.2023.05.24.11.20.40; Wed, 24 May 2023 11:20:53 -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 S234365AbjEXR5l (ORCPT + 99 others); Wed, 24 May 2023 13:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231658AbjEXR5j (ORCPT ); Wed, 24 May 2023 13:57:39 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76BA398; Wed, 24 May 2023 10:57:36 -0700 (PDT) X-QQ-mid: bizesmtp69t1684951051toedm1f2 Received: from linux-lab-host.localdomain ( [116.30.125.36]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 25 May 2023 01:57:30 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: 1U/NVTUyJNR0Bdf3bNTIg9tVMMQ36KW+m0gOe7QYfuSjie+syXUksgUIyPwT9 XfFw8T5ZcY0Gquio8enXfYroGAwnsHycofnfTqboltbdqCDUUnRUVfDdQvLU4WvGApwZDmN bAN6znioI8PEsk337ISXWj6upRE/YjYx52ag3fsAJyiq4tZ26fjpekhGMHr/nYoxUoDKTYU 6S9Cj0J1aASneoJI34cnjcZTI00YRCWzxAihgavquQbYb9F5spPI4fNfgj/l9yZIVq6KWXo a6u2uupdH0bFQEDqTZhEIceDjXFL2DwMqyhdHjNld9/7nfjCGEzUsIU/oflxOuhOMH7GnTA mW8SbP+DccbvKioNg2HMYwFQW6yUW75OfYEsj38yT1ZpwZ2SpCTFlWISeGvAQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 7132561189251988013 From: Zhangjin Wu To: w@1wt.eu Cc: falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com, thomas@t-8ch.de Subject: [PATCH 09/13] tools/nolibc: sys_poll: riscv: use __NR_ppoll_time64 for rv32 Date: Thu, 25 May 2023 01:57:24 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766800704495202268?= X-GMAIL-MSGID: =?utf-8?q?1766800704495202268?= 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 */ +}; + /* 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))