From 6e73b15b68d608ac79e2b822389e22532d3ff7b8 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 3 Nov 2024 11:03:36 -0600 Subject: [PATCH] Start and initialize proc_man before the VFS --- Cargo.lock | 17 +++++++++++++++++ Cargo.toml | 1 + src/main.rs | 13 +++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 19f1d9d..e6f10fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,6 +86,7 @@ dependencies = [ name = "init" version = "0.1.0" dependencies = [ + "proc_man_rpc", "syslog_msg_ipc", "syslog_rpc", "tar-no-std", @@ -174,6 +175,22 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proc_man_rpc" +version = "0.1.0" +dependencies = [ + "parking_lot", + "postcard", + "proc_man_structs", +] + +[[package]] +name = "proc_man_structs" +version = "0.1.0" +dependencies = [ + "serde", +] + [[package]] name = "quote" version = "1.0.37" diff --git a/Cargo.toml b/Cargo.toml index edac040..7a34618 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +proc_man_rpc = { version = "0.1.0", path = "../proc_man/proc_man_rpc" } syslog_msg_ipc = { version = "0.1.0", path = "../syslog/syslog_msg_ipc" } syslog_rpc = { version = "0.1.0", path = "../syslog/syslog_rpc" } tar-no-std = "0.3.1" diff --git a/src/main.rs b/src/main.rs index 54627a6..628215a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,9 +4,9 @@ use std::ffi::CString; use std::fs::File; use std::io::Write; -use std::os::mikros::{ipc, syscalls}; use std::os::mikros::loader::Loader; use std::os::mikros::syscalls::{get_initrd, new_process}; +use std::os::mikros::{ipc, syscalls}; use std::path::Path; use std::process::Command; use syslog_msg_ipc::Message; @@ -76,6 +76,11 @@ fn main() { syslog_client.subscribe_to_binary("devfs".to_string(), vec![0, 1]); syslog_client.subscribe_to_binary("tarfs".to_string(), vec![0]); let mut msg_handler = SyslogMessageHandler::new(); + let proc_man_pid = run_initrd_proc(&initrd, "bin/proc_man"); + let proc_man_client = proc_man_rpc::Client::new(proc_man_pid); + proc_man_client.new_proc(0, None).unwrap(); + proc_man_client.new_proc(1, Some(0)).unwrap(); + proc_man_client.new_proc(2, Some(0)).unwrap(); let vfs_pid = run_initrd_proc(&initrd, "bin/vfs"); let vfs_client = vfs_rpc::Client::new(vfs_pid); run_initrd_proc(&initrd, "bin/devfs"); @@ -96,11 +101,7 @@ fn main() { } } run_initrd_proc(&initrd, "bin/initrd_driver"); - while !msg_handler - .registered_devices - .iter() - .any(|x| x == "initrd") - { + while !msg_handler.registered_devices.iter().any(|x| x == "initrd") { msg_handler.process_messages(); } vfs_client