Re: [PATCH net-next v3 5/8] rust: time: Add wrapper for fsleep function
From: Miguel Ojeda
Date: Wed Oct 16 2024 - 05:42:59 EST
On Wed, Oct 16, 2024 at 10:29 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> You probably want this:
>
> delta.as_nanos().saturating_add(time::NSEC_PER_USEC - 1) / time::NSEC_PER_USEC
>
> This would avoid a crash if someone passes i64::MAX nanoseconds and
> CONFIG_RUST_OVERFLOW_CHECKS is enabled.
I think we should document whether `fsleep` is expected to be usable
for "forever" values.
It sounds like that, given "too large" values in `msecs_to_jiffies`
mean "infinite timeout".
Cheers,
Miguel