Fix waiting for /dev/initrd discarding log messages

This commit is contained in:
pjht 2024-09-23 15:14:58 -05:00
parent 4ca8c95474
commit 2f78df693c
Signed by: pjht
GPG Key ID: CA239FC6934E6F3A

View File

@ -86,7 +86,6 @@ fn main() {
syslog_client
.send_text_message("init", "Started the devfs")
.unwrap();
syslog_msg_ipc::get_syslog_msg();
let vfs_client = vfs_rpc::Client::new(vfs_pid);
vfs_client
.mount(Path::new("/dummy"), "devfs", Path::new("/dev"))
@ -111,17 +110,12 @@ fn main() {
syslog_client
.send_text_message("init", "Started the initrd pseudodevice driver")
.unwrap();
loop {
let msg = syslog_msg_ipc::get_syslog_msg();
if msg.from == "devfs" {
if let Some(binary) = msg.binary {
if binary.kind == 1
&& std::str::from_utf8(binary.data.as_slice()).unwrap() == "initrd"
{
break;
}
}
}
while !msg_handler
.registered_devices
.iter()
.any(|x| x == "initrd")
{
msg_handler.process_messages();
}
vfs_client
.mount(Path::new("/dev/initrd"), "tarfs", Path::new("/"))
@ -178,6 +172,6 @@ fn run_initrd_proc(initrd: &TarArchiveRef, path: &str) -> u64 {
let (space, entry) = Loader::load(proc);
let path_arg = CString::new(path).unwrap();
let pid = new_process(entry as _, space, &[path_arg.as_bytes_with_nul()]).unwrap();
syscalls::wake_new(pid);
syscalls::wake_new(pid).unwrap();
pid
}