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