Skip to content

Commit

Permalink
Unrolled build for rust-lang#121498
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#121498 - flba-eb:make_timespec_capping_public, r=Nilstrieb

Make QNX/NTO specific "timespec capping" public to crate::sys

It is used in:

- `library/std/src/sys/locks/condvar/pthread.rs`
- `library/std/src/sys/pal/unix/thread_parking/pthread.rs`

This is probably required due to introduction of `sys/pal` and rust-lang#121177

`@rustbot` label +O-neutrino
CC: `@jonathanpallant` `@japaric` `@gh-tr`
  • Loading branch information
rust-timer authored Feb 23, 2024
2 parents b6a23b8 + 4f66783 commit c7e6127
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/sys/pal/unix/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub const TIMESPEC_MAX: libc::timespec =
// This additional constant is only used when calling
// `libc::pthread_cond_timedwait`.
#[cfg(target_os = "nto")]
pub(super) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec {
pub(in crate::sys) const TIMESPEC_MAX_CAPPED: libc::timespec = libc::timespec {
tv_sec: (u64::MAX / NSEC_PER_SEC) as i64,
tv_nsec: (u64::MAX % NSEC_PER_SEC) as i64,
};
Expand Down Expand Up @@ -204,7 +204,7 @@ impl Timespec {
// On QNX Neutrino, the maximum timespec for e.g. pthread_cond_timedwait
// is 2^64 nanoseconds
#[cfg(target_os = "nto")]
pub(super) fn to_timespec_capped(&self) -> Option<libc::timespec> {
pub(in crate::sys) fn to_timespec_capped(&self) -> Option<libc::timespec> {
// Check if timeout in nanoseconds would fit into an u64
if (self.tv_nsec.0 as u64)
.checked_add((self.tv_sec as u64).checked_mul(NSEC_PER_SEC)?)
Expand Down

0 comments on commit c7e6127

Please sign in to comment.