From: "A. Wilcox" <email@example.com>
Subject: Re: [musl] Prefer monotonic clock for DNS lookup timeouts
Date: Thu, 29 Dec 2022 21:20:34 -0600 [thread overview]
Message-ID: <0737A458-7E17-4C2C-B702-7A40FAA6151A@adelielinux.org> (raw)
On Dec 1, 2022, at 9:11 AM, Rich Felker <firstname.lastname@example.org> wrote:
>> Is this a bug or intentional?
> It was intentional, based on a belief that the monotonic clock might
> not be present on all kernels. That seems to be incorrect for the
> range of versions we "support" (>=2.6.0) but some archs unofficially
> work back to mid 2.4.x or earlier with limited functionality (no
> threads). Note for example that clock_gettime has fallback to the
> gettimeofday syscall despite all kernels >=2.6.0 having clock_gettime
> (though was it perhaps gated under some CONFIG_ for "realtime
> features" at some point? this probably calls for some research...)
> Switching to monotonic here has been on my radar for a while. I see
> two decent ways to do it without any possibility of regression:
> 1. Have the above mtime() function fall back to CLOCK_REALTIME on
> ENOSYS, or
> 2. Go through with integrating a fallback for CLOCK_MONOTONIC I've had
> in draft for a long time that works on ancient kernels. It works by
> combining the seconds-resolution time from SYS_sysinfo uptime with
> the finer-grained-but-wrapping jiffy count from SYS_times too get a
> monotonic jiffies-resolution uptime.
> The latter is cute/fun but a little bit of work to get right and I'm
> not sure it's sufficiently useful to justify doing it. Option 1 seems
> very reasonable.
clock_gettime was added in 2.5.63 and 2.6.0 and was always obj-y.
There is no CONFIG knob that controls it in early 2.6, though I stopped
my search at 2.6.16.
I have written this patch out, but I don’t have a box without monotonic
clock, so I can’t test the validity of the patch. I will send the patch
to the list for review.
next prev parent reply other threads:[~2022-12-30 3:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 11:24 Gregor Jasny
2022-12-01 15:11 ` Rich Felker
2022-12-30 3:20 ` A. Wilcox [this message]
2022-12-30 3:21 ` [musl] [PATCH] dns: " A. Wilcox
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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
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).