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

Second bit of progress here: stat. First change can be done before any
actual time64 work is done or even decided upon: changing all the
stat-family functions to use fstatat (possibly with AT_EMPTY_PATH) as
their backend, and changing fstatat to do proper fallbacks if
SYS_fstatat is missing. Now there's a single point of potential stat
conversion rather than 4 functions.

Next, add an internal, arch-provided kstat type and make fstatat
translate from this to the public stat type. This eliminates the need
for all the mips*/syscall_arch.h hacks.

Third, add use of SYS_statx when it's available, and translate from it
to the public stat type. Only fallback to SYS_fstatat if SYS_statx is
missing.

At this point we have the kernel giving us 64-bit timespecs for stat,
even if we can't use them. The last step is just changing over the
public types for 32-bit archs (we get to define struct stat entirely,
since it's not filled in by the kernel at all anymore at this point).

The best part of all this is that none of the steps until the last
depend on choices of 64-bit time_t action to take, and all of them are
beneficial changes even without 64-bit time_t.

Final note: some attention may be needed to how O_PATH file
descriptors are handled in the fallback code paths, since this is
presently a delicate issue for fstat() due to old kernel bugs. I think
modern fstatat+AT_EMPTY_PATH and statx+AT_EMPTY_PATH get it right
though.

Rich


  reply	other threads:[~2019-07-18 16:37 UTC|newest]

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