mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-24 17:23:23 +00:00
实现gettimeofday()系统调用和clocksource+timekeeping子模块 (#278)
- 实现gettimeofday()系统调用 - 实现clocksource+timekeeping子模块部分功能 - 实现了timespec转换成日期时间
This commit is contained in:
@ -15,13 +15,16 @@ use super::socket::{SOCKET_SET, SOCKET_WAITQUEUE};
|
||||
/// The network poll function, which will be called by timer.
|
||||
///
|
||||
/// The main purpose of this function is to poll all network interfaces.
|
||||
struct NetWorkPollFunc();
|
||||
#[derive(Debug)]
|
||||
struct NetWorkPollFunc;
|
||||
|
||||
impl TimerFunction for NetWorkPollFunc {
|
||||
fn run(&mut self) {
|
||||
fn run(&mut self) -> Result<(), SystemError> {
|
||||
poll_ifaces_try_lock(10).ok();
|
||||
let next_time = next_n_ms_timer_jiffies(10);
|
||||
let timer = Timer::new(Box::new(NetWorkPollFunc()), next_time);
|
||||
let timer = Timer::new(Box::new(NetWorkPollFunc), next_time);
|
||||
timer.activate();
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +32,7 @@ pub fn net_init() -> Result<(), SystemError> {
|
||||
dhcp_query()?;
|
||||
// Init poll timer function
|
||||
let next_time = next_n_ms_timer_jiffies(5);
|
||||
let timer = Timer::new(Box::new(NetWorkPollFunc()), next_time);
|
||||
let timer = Timer::new(Box::new(NetWorkPollFunc), next_time);
|
||||
timer.activate();
|
||||
return Ok(());
|
||||
}
|
||||
|
Reference in New Issue
Block a user