Skip to content

Commit

Permalink
util: Fix alarm() not found on riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
XuShaohua committed Oct 12, 2023
1 parent b14bf9c commit 28bd842
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 12 additions & 4 deletions src/platform/linux-types/uapi/asm_generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,22 @@
// Use of this source is governed by Apache-2.0 License that can be found
// in the LICENSE file.

#[cfg(any(target_arch = "aarch64", target_arch = "loongarch64"))]
#[cfg(any(
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "riscv64"
))]
mod signal;
#[cfg(any(target_arch = "aarch64", target_arch = "loongarch64"))]
#[cfg(any(
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "riscv64"
))]
pub use signal::*;

#[cfg(test_arch = "loongarch64")]
#[cfg(any(test_arch = "loongarch64", target_arch = "riscv64"))]
mod stat;
#[cfg(test_arch = "loongarch64")]
#[cfg(any(test_arch = "loongarch64", target_arch = "riscv64"))]
pub use stat::*;

mod fcntl;
Expand Down
6 changes: 4 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ pub fn alarm(seconds: u32) -> Result<u32, crate::Errno> {
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "loongarch64"
target_arch = "loongarch64",
target_arch = "riscv64",
))]
let remaining = {
let mut it = crate::itimerval_t::default();
Expand All @@ -166,7 +167,8 @@ pub fn alarm(seconds: u32) -> Result<u32, crate::Errno> {
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "arm",
target_arch = "loongarch64"
target_arch = "loongarch64",
target_arch = "riscv64",
)))]
let remaining = unsafe { crate::alarm(seconds) };

Expand Down

0 comments on commit 28bd842

Please sign in to comment.