From patchwork Mon Feb 10 17:43:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 37862 Received: (qmail 56087 invoked by alias); 10 Feb 2020 17:50:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 55971 invoked by uid 89); 10 Feb 2020 17:50:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT autolearn=ham version=3.3.1 spammy=Structures X-HELO: esa2.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581357024; x=1612893024; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t7C7fqmnD3Tb5YcEHDjCK4mJcZk3b4dLpSQ3RYa41vg=; b=i2/N61Opv25m973sdAx7T8Z1wW/HayEq5hTAM0jntVo20GsT48xEzuOo pj0xjks0rriLKsR3Ho37fs+SfBICNZ8xHFDcCcQC/HX6cukLF/Fnl8EZg bFE5swWptBA6jHLa/RkYBrnIjBYFVpE5UwkkipoQAv6Kxfjzrwsijdcwe 5L6zVsSXlfXS7juK9KQQoXBip8lIkvryB2D9vb8TfdlWUv4R12rkjDNt3 sZsu1M/Zj/iFDnrqwUCuNZ2loqEVv3rlk9CZ4qaHrNas/t+arWUEmOQMQ UzPaMWdaW29SjlwryYXfbFv6kuIwqMzWDYdRCAS7KCUKIZbGQ4XCUfBWe Q==; IronPort-SDR: UvVEWsp9jyK8ozHoN3N7DBFNk1bHZ/Gqezn+r94K5twWlPHY/uGRazD0SCk90U2YbPI5eTMk45 t2i1nd4ypb5E6IUkeoA2jv7BFBA8jCUW7A/6vSO/WXsmRka7TnAyOZvs6i35xlADzZW0DslD0O pvVSsFTeeCt7BvYXM4iTsaDK1YamA7joEouyzXa76XxYM4zXn71VdrqAgESce6Jc1yWk35lpC9 ZjTih49F2So/456Kbgoc1zmfpqiltiqFC8kgSvh7tLADI1I9KBA63yqFPSjQkh083c92eGKNNJ AMw= IronPort-SDR: ZAMJyDB2MOUwQ5m+GWEAm7W9cxUWBJo0simR5vpSKPNFu0093twVHn0lZmmZ1+KyHH4GaPLL22 X3Quib9F4aQIuum5JMxQik7X1G/m8xzxv3ZmajJcfCAnMOCx9jZ5L33zhSYza7gQRXctHgmqB3 5g0cd108Xois4tfSYyJaO06gE3Z0U/hc/nCKFe4VdD6WQHGWk+pFowAhtW3jmBAC1ICpXK0VKx 99NaxfEFKwoGBSGnnl5cp/S845I9RGQ28KoHbqDS2PosgGyZCWtk6Ly6siOJhHUars67rXRx5B 9nyWgHH0PDC84uR725yvWatQ IronPort-SDR: snqD4SdtByb+qFg3HDvlp9OARqxoUwuBzAYKeV++qr5t+iFHdB2FSfUL8pVMBBOyTdYTwNLOXL L6BJBdE6aMT/fBJMUWdRON9TXTgs0gsIU0Du8QrNnS/4pDQDdLNKKi8wLohcYxSacc7tdVIbl2 WtE49/qHbF0a1NW0jyyuyAvnpSmjkh1OY0fwVln/H//WcHqhhyCTRD6F7M7kTLWuSLhEi/dd3d Jf5Ie/UNOBQI+arOq50I8vi5yezUavvv7vN8nhr/XySVHK4A2m3Y02HxTeDif/AVUA1OD6nSwE Ffc= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v2 4/6] linux: Use long time_t __getitimer/__setitimer Date: Mon, 10 Feb 2020 09:43:23 -0800 Message-Id: <20200210174325.6566-5-alistair.francis@wdc.com> In-Reply-To: <20200210174325.6566-1-alistair.francis@wdc.com> References: <20200210174325.6566-1-alistair.francis@wdc.com> MIME-Version: 1.0 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. --- include/time.h | 12 ++++ sysdeps/unix/sysv/linux/getitimer.c | 54 ++++++++++++++++ sysdeps/unix/sysv/linux/setitimer.c | 89 +++++++++++++++++++++++++++ sysdeps/unix/sysv/linux/tv32-compat.h | 35 +++++++++++ 4 files changed, 190 insertions(+) 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 684dabba9c..52b1aba70e 100644 --- a/include/time.h +++ b/include/time.h @@ -6,6 +6,7 @@ # include # include # include