Merge branch 'ch9' into main

This commit is contained in:
Yu Chen 2023-02-08 00:12:41 +08:00
commit 22178ba9b8
3 changed files with 9 additions and 1 deletions

View File

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

View File

@ -12,6 +12,7 @@ mod file;
mod task;
mod sync;
mod io;
mod net;
extern crate alloc;
#[macro_use]
@ -24,6 +25,7 @@ pub use file::*;
pub use task::*;
pub use sync::*;
pub use io::*;
pub use net::*;
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)
}