Skip to content

Commit

Permalink
fix: fixed some warning and error in compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
AuYang261 committed Sep 13, 2023
1 parent 3def120 commit 6c8361b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions api/arceos_posix_api/src/imp/fd_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use spin::RwLock;
use super::stdio::{stdin, stdout};
use crate::ctypes;

/// Maximum number of files per process
pub const AX_FILE_LIMIT: usize = 1024;

pub trait FileLike: Send + Sync {
Expand Down
2 changes: 1 addition & 1 deletion api/arceos_posix_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub use imp::task::{sys_exit, sys_getpid, sys_sched_yield};
pub use imp::time::{sys_clock_gettime, sys_nanosleep};

#[cfg(feature = "fd")]
pub use imp::fd_ops::{sys_close, sys_dup, sys_dup2, sys_fcntl};
pub use imp::fd_ops::{sys_close, sys_dup, sys_dup2, sys_fcntl, AX_FILE_LIMIT};
#[cfg(feature = "fs")]
pub use imp::fs::{sys_fstat, sys_getcwd, sys_lseek, sys_lstat, sys_open, sys_rename, sys_stat};
#[cfg(feature = "select")]
Expand Down
2 changes: 1 addition & 1 deletion modules/axruntime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ fn init_interrupt() {
fn update_timer() {
// Safety: we have disabled preemption in IRQ handler.
let mut deadline = unsafe { NEXT_DEADLINE.read_current_raw() };
deadline = deadline + PERIODIC_INTERVAL_NANOS;
deadline += PERIODIC_INTERVAL_NANOS;
unsafe { NEXT_DEADLINE.write_current_raw(deadline) };
axhal::time::set_oneshot_timer(deadline);
}
Expand Down
1 change: 1 addition & 0 deletions modules/axtask/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ cfg_if::cfg_if! {
mod task;
mod api;
mod wait_queue;
/// load average
pub mod loadavg;

#[cfg(feature = "irq")]
Expand Down
3 changes: 2 additions & 1 deletion modules/axtask/src/loadavg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static mut LAST_UPDATE: AtomicU64 = AtomicU64::new(0);
// TODO: if irq is disabled, what value should AVENRUN be?
static mut AVENRUN: [u64; 3] = [0, 0, 0];

/// Get the load average
pub fn get_avenrun(loads: &mut [u64; 3]) {
for i in 0..3 {
unsafe {
Expand All @@ -50,7 +51,7 @@ fn calc_load(load: u64, exp: u64, active: u64) -> u64 {
if active >= load {
newload += FIXED_1 - 1;
}
return newload / FIXED_1;
newload / FIXED_1
}

#[cfg(feature = "irq")]
Expand Down
2 changes: 1 addition & 1 deletion ulib/axlibc/src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub unsafe extern "C" fn sysconf(name: c_int) -> c_long {
ctypes::_SC_AVPHYS_PAGES => axalloc::global_allocator().available_pages(),
// Maximum number of files per process
#[cfg(feature = "fd")]
ctypes::_SC_OPEN_MAX => super::fd_ops::AX_FILE_LIMIT,
ctypes::_SC_OPEN_MAX => arceos_posix_api::AX_FILE_LIMIT.try_into().unwrap(),
_ => 0,
}
}

0 comments on commit 6c8361b

Please sign in to comment.