From 28bd842d5d351fb45601a6e9b6d442548304d665 Mon Sep 17 00:00:00 2001 From: Xu Shaohua Date: Thu, 12 Oct 2023 11:52:47 +0800 Subject: [PATCH] util: Fix alarm() not found on riscv64 --- src/platform/linux-types/uapi/asm_generic/mod.rs | 16 ++++++++++++---- src/util.rs | 6 ++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/platform/linux-types/uapi/asm_generic/mod.rs b/src/platform/linux-types/uapi/asm_generic/mod.rs index fd82020a..099eea87 100644 --- a/src/platform/linux-types/uapi/asm_generic/mod.rs +++ b/src/platform/linux-types/uapi/asm_generic/mod.rs @@ -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; diff --git a/src/util.rs b/src/util.rs index bc8fbd93..8a3a8f53 100644 --- a/src/util.rs +++ b/src/util.rs @@ -153,7 +153,8 @@ pub fn alarm(seconds: u32) -> Result { #[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(); @@ -166,7 +167,8 @@ pub fn alarm(seconds: u32) -> Result { #[cfg(not(any( target_arch = "aarch64", target_arch = "arm", - target_arch = "loongarch64" + target_arch = "loongarch64", + target_arch = "riscv64", )))] let remaining = unsafe { crate::alarm(seconds) };