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 bccb528 commit c9b9c8a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 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
2 changes: 1 addition & 1 deletion modules/axtask/src/loadavg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,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
12 changes: 10 additions & 2 deletions ulib/axlibc/c/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A
* PARTICULAR PURPOSE. See the Mulan PSL v2 for more details.
*/

#include <errno.h>
Expand Down Expand Up @@ -183,6 +184,13 @@ void tzset()
return;
}

// TODO
int getitimer(int, struct itimerval *curr_value)
{
unimplemented();
return 0;
}

// TODO
int setitimer(int _which, const struct itimerval *restrict _new, struct itimerval *restrict _old)
{
Expand Down

0 comments on commit c9b9c8a

Please sign in to comment.