mailing list of musl libc
 help / color / mirror / code / Atom feed
* time_t progress/findings
@ 2019-07-18 15:41 Rich Felker
  2019-07-18 16:37 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2019-07-18 15:41 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-07-20 21:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18 15:41 time_t progress/findings Rich Felker
2019-07-18 16:37 ` Rich Felker
2019-07-18 20:52   ` Rich Felker
2019-07-20  4:48     ` Rich Felker
2019-07-20 21:46       ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).