Add syscall getrandom

This commit is contained in:
Jianfeng Jiang
2023-06-12 17:12:15 +08:00
committed by Tate, Hongliang Tian
parent 3600a3a439
commit 5815f248fc
7 changed files with 136 additions and 3 deletions

View File

@ -1,9 +1,13 @@
mod null;
mod random;
pub mod tty;
mod urandom;
mod zero;
use crate::fs::device::{add_node, Device, DeviceId, DeviceType};
use crate::prelude::*;
pub use random::Random;
pub use urandom::Urandom;
/// Init the device node in fs, must be called after mounting rootfs.
pub fn init() -> Result<()> {
@ -14,5 +18,9 @@ pub fn init() -> Result<()> {
tty::init();
let tty = tty::get_n_tty().clone();
add_node(tty, "tty")?;
let random = Arc::new(random::Random);
add_node(random, "random")?;
let urandom = Arc::new(urandom::Urandom);
add_node(urandom, "urandom")?;
Ok(())
}