From patchwork Tue Jun 28 08:44:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 102078 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1468938qgy; Tue, 28 Jun 2016 01:45:41 -0700 (PDT) X-Received: by 10.98.196.18 with SMTP id y18mr2871316pff.163.1467103541103; Tue, 28 Jun 2016 01:45:41 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d67si6916759pfc.12.2016.06.28.01.45.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 01:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-71169-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-71169-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-71169-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; q=dns; s=default; b=Z2z+VnBQzrUcofPS 9UZS1X4QJpkIbGb0jtbtPRCiDO1F/yb5wHLWD1sC6E/r3rNVRrL0BuTsBvTGa805 SkYXTm6SKIQDCZIjUWLlWZ96EGsSSz231577ufSPGDkraKnFdz+Opwt5h/XykPms pCH2fW6dPKpl8yobe+jYX92jvjg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type; s=default; bh=Yji97NXv9aHVJWfthDRmo3 H0htI=; b=fqrEjX0IwsyJmj/RD9RKIbPBYj3Z5QSCoMT3JgNfIngEx+yUGU+TGT dHY+Fm2mZSDYVaBh/NO7EnrVxLeTkCcKj1HdL2fx2sr2eYyYo0s6EwyASZb6QNtD Yj8n5/1UBvudzTruCrKccNWs6jEighEmUZ6HSvgtiFEwI6bxPZieI= Received: (qmail 2567 invoked by alias); 28 Jun 2016 08:45:33 -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 2550 invoked by uid 89); 28 Jun 2016 08:45:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=3212, facing, ipc, IPC X-HELO: na01-bl2-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; From: Yury Norov To: CC: , , , , , , , , , , , , , Yury Norov Subject: [RFC PATCH] AARCH64/ILP32: introduce kernel time types Date: Tue, 28 Jun 2016 11:44:58 +0300 Message-ID: <1467103498-24243-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-ClientProxiedBy: AM4PR02CA0041.eurprd02.prod.outlook.com (10.165.239.179) To SN1PR07MB2253.namprd07.prod.outlook.com (10.164.47.147) X-MS-Office365-Filtering-Correlation-Id: e5f19930-525b-4efb-2e7d-08d39f3082e4 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2253; 2:xEixcjEg+3tKL7gMwdBaTtpm6HvcZFegjru6F4+DSDSPPRriNgs/JBbMObIfSkjyLeZAGRiNTHiazyAcxpCj//XDggEaJqoPoT0FdXj4AczbH1WF+P7FH7kj2gFNJxD79qEBycD3OONXJDHSEcVNoEDN7ZdSJ8liaoV0uVRzHdyTll0oOAHKFa9EZGe478h6; 3:5aB8cNu23cRxhrRJJ7LLp1Lfxdcoj2NeXUuArLGlmhq3z8I3rhzt+letb1qNo2EhUP+1qpfxarb/INfupFgtPa7kXPF/1Ct10cOOvSMrrwRxKH+q51NeaufTbtPSFg+z X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2253; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2253; 25:2x9bUH7uDlukfrATu+CbIUmDLSt7k57mxkO40bF4MJ1FpknDmEdYS3HGG6hUlmZbeZoWNiW3Y+2gG4gJT7WUziwLS+4f0f/xjk7TqRcEvShzNSFfGyVNh059Mp6Rpukd5KBLzpET57jjqzoMGl365tGxuUoqcdL75N26hprHzpl/39EQfQmO0ILe8sgTsuYYMozSBJ4DmWXB656ypaIl1ZP7mZdKgQvsugYGLz457RLiNx8EX/NKSEcdi9B7c3EMR4xQCLyQ7pEiNfJtbiIiwkjDNg4coaMs7aiGsHDM8en4fjqAtuz8GTNjCMJj5gven7RG2ltqU3U8go1nlsFeKL7etCRvDqhpEceN13ehUmCsq1e+Go8R3VfMV6UQCabp1faZI+ZampWzoTNC+tm1ScDabUHylz0fEPPHkaMzNRqwauT3pi3enfKP6W0uNuj0cm4Atqeh2nmNB4x9X/I/nwqQVs/1L3oeoJKi72R9Jmqzc652BvhAH6nBaP3owDZNHueV2fMRgrCPOQo36u3G9BCh2/7JcFgsKK57MzCSkZRLHotjvEKlc1kKmafyBPHZ0zuZSOjyTDbmt1U4CDgmioHFn0qpfvtGMzAkxaE+UjDJ6Zdzn2dcpxuA8LuQC4aJq4GBwkSSWy5vlpKB1VuGX6et37HTgKOxp2N0/6oMzCsznNCqpxsPDnKGsVLEWHtBv66awVsxh3rvyCkD+aVr3SmxZqR9pvgw/Bz952eNQhc4DG1LqMJP3iIXIEwZBzKT X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2253; 31:6hiBXcrymvVozsj0XccErZ0Nen/W5/HyC8C/wgE8PcI8wK5d6u74tOtzSJ0R/POWTp4kluice+KcVdlug4LOHwlreeDWL/7Wog5owdPFRx76q1BEdt5HTFqwKCLZmun/glishWnpAoo69vQk3CYXd3ecVT5oGUyVPCS/Zswu4uNDQSSlWXsDtOhG30pDb13g+XvaStGVuIubtwVz266gIg==; 20:iSvJ8bEklELmTZfaPiUgGS65pduL/2LMS+sUl0nIY5Kbh9xApM5rQ96Sl81qL6fVi467IAvn+tZnz8DK1V00PjhGG1SO/87UXzyfJnW4ngshV3+PVMENobZXUq+nD19RGujSSDZW43sC1pFtu4lIdNNEyWyej3vdDfiAbdilsqGGmUCq/bopUGNsOP+S1KfEaiwXGSU6okhmWd8f1hLJ+L464cQa5lLDlCUIpamW9NY588TENUhDfZSVRxI/MsXgK17E0nxmNijlc1vgov/ZHfZqb6FzRGJGYdlgLJsOk7SNJbW0syIXMVl5Qu759L5AJrnXyIMNV2IaPhdzw7OJfWupV9SuDAnCTnRBqQc15KGDSu9AHe7o8P5rudtioixX71xO4rC8XNilSLPbZU0/d1qpHFfWN5qAMZlzatzh7U29dhXxaAY0VnufCS3ql+WBd24BUseJ4SfoMyRs5LDemNUi3qEd/wwt4zR8DZCducl3VXLBzT3z7thlkqMarfM9jsY2wlSqdNf2YFO73TLFQK9Qtt4QxFHNaSM4GbyuanGUUFFgD38Y27065Q8I3q1QR28efDq3gYTBZe/nj5UgsYo85iF3SLgg+UHGgllM8Lw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:SN1PR07MB2253; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2253; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2253; 4:hbbljTMROMHplawG8CoAP1+zOxmyOU8XkFsc3uCx5/uN/Eq4JBwYVmPdtRLf9kxVfSGaP92ecYZu7NEL90gHV3BikUmzl77DamiSoy68q88aJRo79pHdI8KZrHuztveHD2ek2lHiLvUQPeh5VEpZgOu5xgAe06gC86UzQZlqVl/TG9uN78WdkB2l2XHJ8v8c+OGA5ilSr3kIhqP1lr5pxTw24yFeAY2DCcftWR1HvCwfpLI4HM8MffnaxmRlWRPND4RPpgSt7esVRT23/cmRp43w+JxUPktltu61npjej5TRb2s4BAObU/r+n4FpP/wMG+GdtJ147KPB+WxxuuqSVTTHfhXp4KIkF/S1odxkX0pRwd7vDM/Gc2RBuF4Es6+6 X-Forefront-PRVS: 0987ACA2E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(50466002)(48376002)(8676002)(47776003)(2906002)(33646002)(66066001)(81156014)(36756003)(19580405001)(189998001)(7846002)(7736002)(19580395003)(50986999)(81166006)(97736004)(42186005)(101416001)(305945005)(586003)(5003940100001)(68736007)(110136002)(107886002)(3846002)(4326007)(6116002)(50226002)(92566002)(229853001)(76506005)(575784001)(77096005)(105586002)(4001430100002)(106356001)(2351001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2253; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2253; 23:wAL4tLcHLVTd9H4pf3Xcayt0o+N7wcyihtY6QyHGw+DA/DuVmMoUwlMN3jbjnsEAgeNmA0+AAlb4SSVoXQq6cjxAIkBNMJ8B+v55KzU0+9rJj52ncpQ2avaJsFIE3QRt2GWeIFSThC/9aD5H1SqqamNGqxK6TiG+3mYpVzCZ5dIhU9O8C5GiOU/PPjNaLZgkA4uarIiHpkj9zT+uNbVMsf8bLbJO5zb819Aj8TEeiQfYUHspL+ykJfhDX7gxFMozU9sM5riltpgX6hEZGF1d8efrZXAo1tvHDE6goDohcdYZ09kWQFp0o4EZyOQ07+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8Szf96SmTEih8LpBgeb1psPbr1bcQr2Jbd2f/zJ/uDfOHsald/za2Ct1o68pG795K9EsxQgoCY=; 5:fMxOH+y3je0LvyCgxF/9aTJnCGFc3uLlnrqCJCYqGATE3EEa1zffds763HoVGycL4NaL0YGKtCb0AsrGoYxk4HpVfm+uGYmkwvXUbFQhmdEPaO1xUd+RYkUoauKTlj0hMixZLqV1I48QB0/vrCFWSA==; 24:DaZyh0qbUnGkacFA8veGbvD98TH1gdVfet3m5gzhQrr63LdyGq20sD1VsW/VC6QisOHFzqPKDYezS88Gt4GKULfLjG5EA10OXOJFKYXd0OQ=; 7:3FazO4GI4wDnaI66omdynt1Pu03V6HclsAEWEeCffbKDfMgTR3gAskNihiSfTL9D+2jddr3dy0Cvn/VbJgUuL0LdhwS4XZZVJFStJjORymcFDwLpkMGKcjj5C77f8060JDro5j/NA50q+CUsqCwuyUlbtW8vJrlpYfjjdlpDOBVboabDR77sTvpk5YqgZbyuD/E4GIxMoFgbxUk6f2t5PF4V0qnknUi9gyjRwipNOKauofltBv3Z/IavtIcieFWf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jun 2016 08:45:08.8757 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2253 Structures utmp and utmpx are shared between ilp32 and native ABIs, and so should have same layout. As now, architectures where this compatibility is required enable __WORDSIZE_TIME64_COMPAT32 option, and so make lp64 utmp{x} backward-compatible to ilp32 ones. AARCH64 doesn't require such compatibility, and so we can do opposite conversion. This patch introduces new option __KERNEL_TIME_T_MATCHES_TIME64_T, and adds internal __ktime_t, __kusecond_t, __ksusecond_t types, that are native-sized for normal case, and forced to 64-bit size if __KERNEL_TIME_T_MATCHES_TIME64_T is enabled. This is generic solution because we are facing y2038 problem, and all new ABIs should follow this convention. This approach might also be used for RISC-V as default. If no objections, I'll incorporate it to v2 of AARCH64/ILP32 patchset. Signed-off-by: Yury Norov --- bits/types.h | 17 +++++++++++++++-- sysdeps/gnu/bits/utmp.h | 6 +++--- sysdeps/gnu/bits/utmpx.h | 4 ++-- sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h | 7 ++++++- sysdeps/unix/sysv/linux/bits/time.h | 6 ++++++ 5 files changed, 32 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/bits/types.h b/bits/types.h index 01753bd..47535eb 100644 --- a/bits/types.h +++ b/bits/types.h @@ -137,8 +137,11 @@ __STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */ __STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */ __STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */ __STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */ -__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ -__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +__STD_TYPE __TIME64_T_TYPE __time64_t; /* Seconds since the Epoch. */ +__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */ +__STD_TYPE __USECONDS64_T_TYPE __useconds64_t; /* Count of microseconds. */ +__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */ +__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t;/* Signed count of microseconds. */ __STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */ __STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */ @@ -188,6 +191,16 @@ __STD_TYPE __SWORD_TYPE __intptr_t; /* Duplicate info from sys/socket.h. */ __STD_TYPE __U32_TYPE __socklen_t; +/* Kernel time types. */ +#ifdef __KERNEL_TIME_T_MATCHES_TIME64_T +typedef __time64_t __ktime_t; +typedef __suseconds64_t __ksuseconds_t; +typedef __useconds64_t __kuseconds_t; +#else +typedef __time_t __ktime_t; +typedef __suseconds_t __ksuseconds_t; +typedef __useconds_t __kuseconds_t; +#endif #undef __STD_TYPE diff --git a/sysdeps/gnu/bits/utmp.h b/sysdeps/gnu/bits/utmp.h index 2a1ffcb..fae9126 100644 --- a/sysdeps/gnu/bits/utmp.h +++ b/sysdeps/gnu/bits/utmp.h @@ -38,7 +38,7 @@ struct lastlog #ifdef __WORDSIZE_TIME64_COMPAT32 int32_t ll_time; #else - __time_t ll_time; + __ktime_t ll_time; #endif char ll_line[UT_LINESIZE]; char ll_host[UT_HOSTSIZE]; @@ -76,8 +76,8 @@ struct utmp int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ + __ktime_t ut_session; /* Session ID, used for windowing. */ + struct __kernel_timeval ut_tv;/* Time entry was made. */ #endif int32_t ut_addr_v6[4]; /* Internet address of remote host. */ diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h index b41548b..58eeef4 100644 --- a/sysdeps/gnu/bits/utmpx.h +++ b/sysdeps/gnu/bits/utmpx.h @@ -74,8 +74,8 @@ struct utmpx __int32_t tv_usec; /* Microseconds. */ } ut_tv; /* Time entry was made. */ #else - long int ut_session; /* Session ID, used for windowing. */ - struct timeval ut_tv; /* Time entry was made. */ + __ktime_t ut_session; /* Session ID, used for windowing. */ + struct __kernel_timeval ut_tv;/* Time entry was made. */ #endif __int32_t ut_addr_v6[4]; /* Internet address of remote host. */ char __glibc_reserved[20]; /* Reserved for future use. */ diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h index 39c0c81..97ca37c 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/typesizes.h @@ -48,8 +48,11 @@ #define __ID_T_TYPE __U32_TYPE #define __CLOCK_T_TYPE __SLONGWORD_TYPE #define __TIME_T_TYPE __SLONGWORD_TYPE +#define __TIME64_T_TYPE __SQUAD_TYPE #define __USECONDS_T_TYPE __U32_TYPE +#define __USECONDS64_T_TYPE __UQUAD_TYPE #define __SUSECONDS_T_TYPE __SLONGWORD_TYPE +#define __SUSECONDS64_T_TYPE __SQUAD_TYPE #define __DADDR_T_TYPE __S32_TYPE #define __KEY_T_TYPE __S32_TYPE #define __CLOCKID_T_TYPE __S32_TYPE @@ -79,8 +82,10 @@ /* And for __fsbilcnt_t and __fsbilcnt64_t. */ # define __FSFILCNT_T_TYPE_MATCHES_FSFILCNT64_T_TYPE 1 +/* And for kernel time types. */ +#define __KERNEL_TIME_T_MATCHES_TIME64_T 1 + /* Number of descriptors that can fit in an `fd_set'. */ #define __FD_SETSIZE 1024 - #endif /* bits/typesizes.h */ diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index 87eb51f..d329ff4 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -32,6 +32,12 @@ struct timeval __time_t tv_sec; /* Seconds. */ __suseconds_t tv_usec; /* Microseconds. */ }; + +struct __kernel_timeval + { + __ktime_t tv_sec; /* Seconds. */ + __ksuseconds_t tv_usec; /* Microseconds. */ + }; # endif /* struct timeval */ #endif