From patchwork Mon May 29 19:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 100403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1741476vqr; Mon, 29 May 2023 13:06:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65UJGanC98CANIi8MHkQL+dFISkyz/dyMcshsSNXaWpfQpC4g6lq3oGypcdpbek1Zikstk X-Received: by 2002:a17:90a:7527:b0:255:69e5:2f6c with SMTP id q36-20020a17090a752700b0025569e52f6cmr186511pjk.26.1685390757945; Mon, 29 May 2023 13:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685390757; cv=none; d=google.com; s=arc-20160816; b=VMtZAZDB1kTqtFI8Wny3k0gdPDv4z3UiXNIyuvBdp3HOwJlgqPiHdTOyH8/b3sJVf2 4MVe4Fu5DQToWy+v1M8S9V8u22kvEDkZHajRHYv3xpxLhcXMhjjEiYqW7fpGqBuxm5Dz 2dWO7Poc+Bhn+e6bx6a0sLH42wdiA4EW8fTTjSAcARNZAHLvSFq7o+3kOvF3YWaprgeu gSO+wH+iAnYD/JAPVYd2ursNBx1KHJuw3/GvPzLdhMbxMIJMNtwcD46WG5dFcjnK0r3W DWojQYuJJFcxDs8esSSp8kI9wyhQHTRPSuoUoHqy/TSXPbhcijPDt/FasMGi1hfWAhj/ ggwQ== 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=z/hRqTJ44PqGiC5gX24sKUwFTXc2wA/fHiMfakBtTns=; b=AVV7EHXx4X6gQSZ1E0QcGsPqzZgiWLJgJMwHphrtH552YkYukFKQfrZkMOoVeY5nqP smNyf/7FKXKhcmpGwbp4a8mpxhGdb0ccEimBfmQSbyT+3bYocNC3I5FVYEpM00P3R5a2 ThKvmB0nNaAMz5kFggaodloNM4Ni81UkeK1bTqTc/j4eiFf4KGR5Gyp6+HkI4RA2BEn9 j2mFDT/+IBT7gPemabIagTh1VzH5oQaM9jPF0rRsllW0XLEOlnJGkvuoSxq/tpdDkfPV JIlyFG3L3SKP0NZhYub16LkYkOQ595ZrEHxm/tbh5yfjIZJ4RnGe/L2Dds2RD/NJweXx H7fQ== 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 a9-20020a17090a740900b00256a6aab74esi583591pjg.111.2023.05.29.13.05.43; Mon, 29 May 2023 13:05: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; 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 S229632AbjE2T7C (ORCPT + 99 others); Mon, 29 May 2023 15:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjE2T7A (ORCPT ); Mon, 29 May 2023 15:59:00 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57E89B7; Mon, 29 May 2023 12:58:58 -0700 (PDT) X-QQ-mid: bizesmtp81t1685390329tl4a1sn8 Received: from linux-lab-host.localdomain ( [119.123.130.80]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 30 May 2023 03:58:48 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: 9fp+MOMfZT2zNx5cI/90p1+iD3OFYm3s3YK5fd6MqPYblqw1OWNOqBS6mtmxO fMoOM+E+goEI3ecHYGOH/rDB2EhsgYIwM5UgrdO6NKUa0jQ0vC5le58Goq/yJpBxb+QpkiK f/vtUsnjRUKAVtIvhP3uG0qEaAOKEDu1l+HU9ziNNi/9Lfj7/wkOqNDUij2iR6gXCjDyZ4n 9lTIoyirLK/p7BAhjuaT0ah2jVt+yKYWrTeA25q9PEpJK2mFtyrxEXUF6lqNnOmRL3N/K9i 45+J3itzDAeYalzg1hO+DaTd+jvKUXN2yBI7B5sZqCUToA1X/NJbzbD662koEts8WroOj3X dtwBusqYja9KxUeXB3ViNXaNnE0ucLWqFCxKVsIIrih7kvbRw4= X-QQ-GoodBg: 0 X-BIZMAIL-ID: 5773408727969922355 From: Zhangjin Wu To: w@1wt.eu Cc: arnd@arndb.de, falcon@tinylab.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, thomas@t-8ch.de Subject: [PATCH v2 10/13] tools/nolibc: sys_poll: add pure 64bit poll Date: Tue, 30 May 2023 03:58:42 +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?1767260299742912073?= X-GMAIL-MSGID: =?utf-8?q?1767260299742912073?= It's time to provide 64bit time structs for all platforms, for y2038 is near. ppoll_time64 has been added from v4.20 and the last arch support is at least from v5.0.0 Signed-off-by: Zhangjin Wu --- tools/include/nolibc/sys.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index db648b5b9a1c..ca802627e88f 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -940,14 +940,21 @@ 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_time64 + const long nr_ppoll = __NR_ppoll_time64; +#elif __SIZEOF_LONG__ == 8 + const long nr_ppoll = __NR_ppoll; +#else +#error No __NR_ppoll_time64 defined, cannot implement time64 sys_poll() +#endif struct timespec t; if (timeout >= 0) { t.tv_sec = timeout / 1000; t.tv_nsec = (timeout % 1000) * 1000000; } - return my_syscall5(__NR_ppoll, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); + return my_syscall5(nr_ppoll, fds, nfds, (timeout >= 0) ? &t : NULL, NULL, 0); #elif defined(__NR_poll) return my_syscall3(__NR_poll, fds, nfds, timeout); #else