From patchwork Mon Feb 3 18:31:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 37659 Received: (qmail 25051 invoked by alias); 3 Feb 2020 18:38:47 -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 24934 invoked by uid 89); 3 Feb 2020 18:38:46 -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=sk:struct_, interval X-HELO: esa3.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=1580755124; x=1612291124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Xg2AIssQp4zHTINVrzHk65k0TN1rxEU2PvAHfM5RAtE=; b=OlGfIh8CtTx0Fh+/FxqfyfR7Q4Xz5J+WL0LL4S95p6C1XOfJqRaEoXgb asTYDNKrs5zNklAqo2pyDS9dMy2hq6o5XlpJPQa8yL/PO5usD7KqwudoV h9exCBkp3FOpgPUVPCMPh7SZxBxZaPxd5g3q2W9Nx09izu9Q70EmVzzji 8pmyH5312jkPlBvnsXzuASHctdalIRZsJCwFWKoadDwMaZHQXal3e0AB0 24RRJqIlxS/7pw+0KHId1bUDxNEY/wCxjgk54JekRICgSKhgBf68EGJHn crJjb0wmylZuZG9HjsHpTKcZiW8rI6bNItAR/0/PEaLdC+LpvJaQDv7XK g==; IronPort-SDR: CMy/bk/e2OQMdeajEQ7xs39otYc4QYw3NxpmWkByy3HDkmG9SSJqPoFFJ6M71MX2zQRScFgqYv SYrO31aIi2TM+Xmud4m+dTcTzo+VxaIsYs3pssV+/Oaowt4lTQl1/nJa1xLQU250PZTlv0B0uy rLO2xTSeE9S4K3UmxUN2hYEynE8mtLBOHoWLq3jdjHVc/Z9eWV/Q+K9DMbj5zeQFwWWYP2j81T 0QI+Vsup2N1RgutphqsZCyRKD5FQYtlGT0saeY9gS5+FQxatQrgTxgd2kKnxFbJRI7RQfodJIH TjA= IronPort-SDR: 6XwvhdY/LkZcGf5mba/iC6uWb3jKoqMQOYrn937f7ah0lgHoDlrT1XtXG/1Z443Ym+3UNTKslj GOfsweiLuyHmSb0Lxk8fFoG1W5XvgTa6DM/hbW2hwWCfcHEkbR+SourfkBoWLhFGu2o3NPZFSI 39lUyw57Dfl3pz01gvHLLu+RFp6kZVoREy95A1hSkjmdV8YlLRudQpSorF0vMsXgXbgorxg9Py 4MskBEAwLVAH/8fOrC/nTZK2Gr7A3XyH0Ic8GGsPGp8+E7eu+FxJ+4yCxSqURHV/cPasuYzTda 5zxBOE4U2l1ZkoId+EREjBC0 IronPort-SDR: EdhnqGdfmZGsBKXpxwh+u9vWRIUd2u7WZxm1ELUxDiOYT7OU7yDtLk+N9cg/16Srq/nS4Z4nSu lhXWDFok0EwfgLypV3YP4TXjxskV3r33RWIIiutq6LvrHiBQEGIcQTLt+0bzcm71n9LfKAK8ZK Msk+1dGA32MJQUAfnh6JF12fz9J6tJBgfxNvDXvZ0nrWWnBLjZ3p7YeuwiQi1onUuA5LJ/o9km xVDmYo68mGxkwP7RMZN//SK+K/za6IjJiuNoZNnEzHZT44J28BvJfw2bYyug0EuQztTAJoz3Vi vX4= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, lukma@denx.de, Alistair Francis Subject: [PATCH 4/6] linux: Use 32-bit time_t for itimerval Date: Mon, 3 Feb 2020 10:31:51 -0800 Message-Id: <20200203183153.11635-5-alistair.francis@wdc.com> In-Reply-To: <20200203183153.11635-1-alistair.francis@wdc.com> References: <20200203183153.11635-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. This means that all 32-bit architectures with a 64-bit time_t will be able to use this generic implementation. This code is based on similar code in alpha, but adjusted to pass the 32-bit time_t to the kernel. We can't directly call the __getitimer/__setitimer functions as they expect a struct itimerval but we need to pass in a struct itimerval32. --- include/time.h | 12 +++ .../linux/generic/wordsize-32/getitimer.c | 54 +++++++++++++ .../linux/generic/wordsize-32/setitimer.c | 77 +++++++++++++++++++ .../linux/generic/wordsize-32/tv32-compat.h | 35 +++++++++ 4 files changed, 178 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/getitimer.c create mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/setitimer.c create mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/tv32-compat.h diff --git a/include/time.h b/include/time.h index 898ff0fb2d..e1d80b4190 100644 --- a/include/time.h +++ b/include/time.h @@ -6,6 +6,7 @@ # include # include # include