diff --git a/Cargo.lock b/Cargo.lock index 339b977..d818ada 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -245,6 +245,22 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syslog_rpc" +version = "0.1.0" +dependencies = [ + "parking_lot", + "postcard", + "syslog_structs", +] + +[[package]] +name = "syslog_structs" +version = "0.1.0" +dependencies = [ + "serde", +] + [[package]] name = "tar" version = "0.4.41" @@ -259,6 +275,7 @@ dependencies = [ "file_rpc", "fs_rpc", "parking_lot", + "syslog_rpc", "tar", "vfs_rpc", ] diff --git a/Cargo.toml b/Cargo.toml index f1e5a28..8da3ca1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" file_rpc = { version = "0.1.0", path = "../file_rpc" } fs_rpc = { version = "0.1.0", path = "../fs_rpc" } parking_lot = "0.12.3" +syslog_rpc = { version = "0.1.0", path = "../syslog/syslog_rpc" } tar = { version = "0.4.41", default-features = false, path = "tar-0.4.41" } vfs_rpc = { version = "0.1.0", path = "../vfs/vfs_rpc" } diff --git a/src/main.rs b/src/main.rs index 6fbeade..40ab03c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use std::{fs::File, io::{Read, Seek}, os::mikros::{ipc, syscalls}, path::PathBuf, sync::Arc, usize}; use parking_lot::RwLock; +use syslog_rpc::{BinaryMessage, Message}; use tar::Archive; #[derive(Clone)] @@ -67,7 +68,6 @@ fn main() { }; fs_rpc::register_server(Box::new(serv.clone())); file_rpc::register_server(Box::new(serv)); - let vfs_pid; loop { if let Some(pid) = syscalls::try_get_registered(0) { @@ -76,6 +76,21 @@ fn main() { } } vfs_rpc::Client::new(vfs_pid).register_fs("tarfs").unwrap(); + let syslog_pid; + loop { + if let Some(pid) = syscalls::try_get_registered(2) { + syslog_pid = pid; + break; + } + } + syslog_rpc::Client::new(syslog_pid).send_message(Message { + from: "tarfs".to_string(), + text: Some("Tar archive fs initialized".to_string()), + binary: Some(BinaryMessage { + kind: 0, + data: vec![], + }), + }).unwrap(); loop { ipc::process_messages() }