mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 01:16:26 +04:00
fix net support for user net app
This commit is contained in:
parent
bc3858bdb5
commit
532b24478c
@ -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!");
|
||||||
|
@ -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
5
user/src/net.rs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
use super::*;
|
||||||
|
|
||||||
|
pub fn connect(ip: u32, sport: u16, dport: u16) -> isize {
|
||||||
|
sys_connect(ip, sport, dport)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user