From patchwork Tue Mar 31 15:46:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38691 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 2A64F385DC00 for ; Tue, 31 Mar 2020 15:54:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2A64F385DC00 IronPort-SDR: b096baGaKYk1Ik/SNGf6MIgOoLr8YM/qHNnK7jPnS/PZKig5oup2M1LAnKJvqvoS1bY1RPTOUo 4exav82PlfIHGlc3l85fj+zXUlf/YWIMTQtkaVViH/o7E9EfhifSf4om06v+KSr5RSPqZsC2nO UDA7Fto8o48lLnvKT0cwjiJNPz3tnZv9qKQy+I0//R4hDn1G57EL8BGbMgDriWgyYORSMgfHkS 5bGUaoeoi8w7BaQup7VewQaDKYsCcwR/2yYHgiyyW1KfUoghKhSW2zRHuw4D8O/CnVMlZ0d72N fPA= X-IronPort-AV: E=Sophos;i="5.72,328,1580745600"; d="scan'208";a="134068948" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Mar 2020 23:54:40 +0800 IronPort-SDR: i89WSNCnGJZvbF+t/6c7MiX9kxcel6hQ7FnkGQJpDyA++BJq7ICxNIVgU7qwXc+7Ev5+QeWxzZ gUGb7plCij9RZm6A4J95nBUeuqsVB7qOCvSdCQe2Wq3tskyz14KVWXyvg6mLI68z2aEGIhaZcN E8/APxzpUWynP4XGjOipJCAKJly3e7TsjMGuo1bopoDYrI9npjm8ROvVmvhf2FcfQtS3j7ixFt XzgBPeeQ5IuMVQ35erTJrtIWaLTNvMBUJr5EyeAONVPF08BZu4LvGaz6tSmK4VOx1EhThEm79Y 4rfHT40k6y+2NzWB1vYG7ajA Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Mar 2020 08:45:34 -0700 IronPort-SDR: ujWHRu54feF65lmD89pR7gYYjKpcHQ13UmWOL+zdClaxErIMtPzyk8hFpSZdCeFMssih9DuYds q9TDbkkKWgJxbcviuNQR+TGxugX3QfaCcrUbUdC0iUe0JZ0v+4tXQ+V2pAeVrCsejinUcBubCO 4Ad/Mu7HYls7Bt2kWLzdWjeU5dO0vprnpJrt/1jaiBtlGgr60f47P9zG8FTtm1HMJ3HMwKgr+U LO4+vEotonZSIjHY553sudS3mvCAc0gxtGG3drBj0l9tgeIYMgGFikX3LXdV2h5dvD6Id4xLeh rGE= WDCIronportException: Internal Received: from usa001473.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.8]) by uls-op-cesaip01.wdc.com with ESMTP; 31 Mar 2020 08:54:40 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: Vineet.Gupta1@synopsys.com, alistair23@gmail.com, Alistair Francis , Lukasz Majewski , Adhemerval Zanella Subject: [PATCH v7 2/5] linux: Use long time_t __getitimer/__setitimer Date: Tue, 31 Mar 2020 08:46:53 -0700 Message-Id: <20200331154656.687841-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331154656.687841-1-alistair.francis@wdc.com> References: <20200331154656.687841-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2020 15:54:45 -0000 The Linux kernel expects itimerval to use a 32-bit time_t, even on archs with a 64-bit time_t (like RV32). To address this let's convert itimerval to/from 32-bit and 64-bit to ensure the kernel always gets a 32-bit time_t. While we are converting these functions let's also convert them to be the y2038 safe versions. This means there is a *64 function that is called by a backwards compatible wrapper. Tested-by: Lukasz Majewski Reviewed-by: Adhemerval Zanella --- include/time.h | 15 +++++ sysdeps/unix/syscalls.list | 2 - sysdeps/unix/sysv/linux/getitimer.c | 61 +++++++++++++++++ sysdeps/unix/sysv/linux/setitimer.c | 94 +++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/tv32-compat.h | 31 +++++++++ 5 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/getitimer.c create mode 100644 sysdeps/unix/sysv/linux/setitimer.c create mode 100644 sysdeps/unix/sysv/linux/tv32-compat.h diff --git a/include/time.h b/include/time.h index 2523e0ff0d..4522fe9c4f 100644 --- a/include/time.h +++ b/include/time.h @@ -6,6 +6,7 @@ # include # include # include