fix net support for user net app

This commit is contained in:
Yu Chen 2023-02-08 00:04:50 +08:00
parent bc3858bdb5
commit 532b24478c
3 changed files with 9 additions and 1 deletions

View File

@ -2,13 +2,14 @@
#![no_main] #![no_main]
use alloc::string::String; use alloc::string::String;
use user_lib::{connect, write, read};
#[macro_use] #[macro_use]
extern crate user_lib; extern crate user_lib;
#[macro_use] #[macro_use]
extern crate alloc; extern crate alloc;
use user_lib::{connect, write, read};
#[no_mangle] #[no_mangle]
pub fn main() -> i32 { pub fn main() -> i32 {
println!("udp test open!"); println!("udp test open!");

View File

@ -12,6 +12,7 @@ mod file;
mod task; mod task;
mod sync; mod sync;
mod io; mod io;
mod net;
extern crate alloc; extern crate alloc;
#[macro_use] #[macro_use]
@ -24,6 +25,7 @@ pub use file::*;
pub use task::*; pub use task::*;
pub use sync::*; pub use sync::*;
pub use io::*; pub use io::*;
pub use net::*;
const USER_HEAP_SIZE: usize = 32768; const USER_HEAP_SIZE: usize = 32768;

5
user/src/net.rs Normal file
View File

@ -0,0 +1,5 @@
use super::*;
pub fn connect(ip: u32, sport: u16, dport: u16) -> isize {
sys_connect(ip, sport, dport)
}