Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190718154132.GR1506@brightrain.aerifal.cx>
Date: Thu, 18 Jul 2019 11:41:32 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: time_t progress/findings

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.