mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gaelan Steele <gbs@canishe.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Josh Stone" <jistone@redhat.com>,
	"Asahi Lina" <lina@asahilina.net>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"John Stultz" <jstultz@google.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	asahi@lists.linux.dev
Subject: Re: [PATCH] rust: time: New module for timekeeping functions
Date: Wed, 22 Feb 2023 09:43:39 +0000	[thread overview]
Message-ID: <EE0C3422-B908-4263-B0E8-27B6DFFCF306@canishe.com> (raw)
In-Reply-To: <87zg96n12k.ffs@tglx>



> On Feb 21, 2023, at 9:46 PM, Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> On Tue, Feb 21 2023 at 09:13, Josh Stone wrote:
> 
>> On 2/21/23 4:32 AM, Thomas Gleixner wrote:
>>> Now the problem is that 'Instant' in it's specification is bound to
>>> CLOCK_MONOTONIC and there is no way to express CLOCK_BOOTTIME, but
>>> that's a shortcoming of the spec which ignores CLOCK_BOOTTIME
>>> completely. IOW, that's also a problem for user space.
>> 
>> That's not exactly *specified* -- it's meant to be opaque time. It is
>> documented that this currently uses clock_gettime monotonic on unix
>> targets, but "Disclaimer: These system calls might change over time."
>> CLOCK_MONOTONIC isn't even consistent across unix targets whether that
>> counts suspended time. It's been debated if we should switch to
>> CLOCK_BOOTTIME on Linux, but for now we're sticking to monotonic:
> 
> You'll need both when you want to implement substantial parts of the low
> level user space stack in Rust. Same for CLOCK_TAI.
> 
> Thanks,
> 
>        tglx

std isn’t really designed to provide full coverage of any particular OS
interface - it has to provide concepts that map cleanly onto Windows and
every flavor of Unix.[1] Low-level Unix Rust code typically uses the libc
crate, which just exports everything from libc as an unsafe function, or
one of several safe wrappers (nix is the most popular one, I’m partial to
rustix), alongside std.

[1]: std does in cases provide OS-specific functions - for example,
std::fs::Metadata (~= struct stat) has Unix-specific ways to get the
mode - but again, the goal here is to be broadly useful, not full
coverage.

Best wishes,
Gaelan



      reply	other threads:[~2023-02-22  9:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  7:06 Asahi Lina
2023-02-21  7:25 ` Eric Curtin
2023-02-21 11:23 ` Björn Roy Baron
2023-02-21 12:32 ` Thomas Gleixner
2023-02-21 14:06   ` Boqun Feng
2023-02-21 16:02     ` Thomas Gleixner
2023-02-21 16:31       ` Asahi Lina
2023-02-21 18:45         ` Thomas Gleixner
2023-02-21 21:33           ` Heghedus Razvan
2023-02-22  0:01             ` Thomas Gleixner
2023-02-22 19:55             ` Gary Guo
2023-02-21 22:29           ` Miguel Ojeda
2023-02-22  0:24             ` Thomas Gleixner
2023-02-22  2:54               ` Boqun Feng
2023-02-22  4:45                 ` Asahi Lina
2023-02-22  5:20                   ` Boqun Feng
2023-02-22  6:52                   ` Heghedus Razvan
2023-02-22 12:29                   ` Miguel Ojeda
2023-02-22 12:28               ` Miguel Ojeda
2023-02-21 16:27     ` Asahi Lina
2023-02-21 16:37       ` Asahi Lina
2023-02-21 19:00       ` Thomas Gleixner
2023-02-21 19:49         ` Boqun Feng
2023-02-22  4:56         ` Asahi Lina
2023-02-22  8:33           ` Thomas Gleixner
2023-02-21 17:13   ` Josh Stone
2023-02-21 21:46     ` Thomas Gleixner
2023-02-22  9:43       ` Gaelan Steele [this message]

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=EE0C3422-B908-4263-B0E8-27B6DFFCF306@canishe.com \
    --to=gbs@canishe.com \
    --cc=alex.gaynor@gmail.com \
    --cc=asahi@lists.linux.dev \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=jistone@redhat.com \
    --cc=jstultz@google.com \
    --cc=lina@asahilina.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wedsonaf@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®