From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14412 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: time_t progress/findings Date: Thu, 18 Jul 2019 11:41:32 -0400 Message-ID: <20190718154132.GR1506@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="181587"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14428-gllmg-musl=m.gmane.org@lists.openwall.com Thu Jul 18 17:41:50 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1ho8XV-000l9l-BB for gllmg-musl@m.gmane.org; Thu, 18 Jul 2019 17:41:49 +0200 Original-Received: (qmail 12160 invoked by uid 550); 18 Jul 2019 15:41:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 12125 invoked from network); 18 Jul 2019 15:41:45 -0000 Content-Disposition: inline Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14412 Archived-At: I've started on a sketch of the work needed for moving 32-bit archs to 64-bit time_t. First, one "good" thing: the sysvipc structs with times in them are only used with ioctl-eqsue command numbers, so rather than defining new functions, we can just define new command numbers. Of course that means we have to pick numbers, which is never fun. This is the same situation as sockopts and ioctls except that we define them rather than the kernel doing so. Now, for the proposed form for the legacy ABI functions, I'll show a few examples: time32_t __time32(time32_t *p) { time_t t = time(0); if (t < INT32_MIN || t > INT32_MAX) { errno = EOVERFLOW; return -1; } *p = t; return t; } struct tm *__gmtime32_r(time32_t *t, struct tm *tm) { return gmtime_r(&(time_t){*t}, tm); } double __difftime32(time32_t t1, time_t t2) { return difftime(t1, t2); } The naming is done such that, at the source level, the standard names are all the "real" functions that support 64-bit time_t. Public headers (also included internally, of course) would remap these names to the time64 symbol names (time->__time64, etc.) while private headers would remap the time32 names above to the ABI-compat symbol names (__time32->time). Note in particular that the names with 32 in them are purely source-level, not present in any symbols, so they could be renamed freely if the scheme is deemed ugly or anything. Not only is this approach fairly clean; if we ever do have cause to do a hard ABI break (".2 ABI"), just disabling/removing the above compat functions and the symbol name redirections gives it (with no redirections or tricks). Rich