mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: time_t progress/findings
Date: Thu, 18 Jul 2019 11:41:32 -0400	[thread overview]
Message-ID: <20190718154132.GR1506@brightrain.aerifal.cx> (raw)

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


             reply	other threads:[~2019-07-18 15:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18 15:41 Rich Felker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190718154132.GR1506@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).