Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable clock_getres on redox #1327

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -102,9 +102,10 @@ matrix:
name: redox
script:
- curl --proto '=https' --tlsv1.2 -sSf --output rustup.sh https://sh.rustup.rs
- sh rustup.sh -y --profile=minimal --default-toolchain 1.36.0 --target x86_64-unknown-redox
# if stuff breaks, change nightly to the date in the toolchain_* directory at https://static.redox-os.org
- sh rustup.sh -y --profile=minimal --default-toolchain nightly-2020-08-04 --target x86_64-unknown-redox
- . $HOME/.cargo/env
- cargo build --all-targets
- cargo build --target x86_64-unknown-redox --all-targets

before_install: set -e

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Added `mremap` (#[1306](https://github.com/nix-rust/nix/pull/1306))

### Fixed
- Fixed compilation on Redox
(#[1327](https://github.com/nix-rust/nix/pull/1327))
### Changed
### Removed

Expand Down
2 changes: 2 additions & 0 deletions src/time.rs
Expand Up @@ -37,6 +37,7 @@ impl ClockId {
}

/// Returns resolution of the clock id
#[cfg(not(target_os = "redox"))]
pub fn res(self) -> Result<TimeSpec> {
clock_getres(self)
}
Expand Down Expand Up @@ -204,6 +205,7 @@ impl std::fmt::Display for ClockId {

/// Get the resolution of the specified clock, (see
/// [clock_getres(2)](https://pubs.opengroup.org/onlinepubs/7908799/xsh/clock_getres.html)).
#[cfg(not(target_os = "redox"))]
pub fn clock_getres(clock_id: ClockId) -> Result<TimeSpec> {
let mut c_time: MaybeUninit<libc::timespec> = MaybeUninit::uninit();
let ret = unsafe { libc::clock_getres(clock_id.as_raw(), c_time.as_mut_ptr()) };
Expand Down