Annouce initialization over syslog

This commit is contained in:
pjht 2024-06-23 14:56:04 -05:00
parent cfb3fb0aca
commit 6386665f34
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E
3 changed files with 34 additions and 1 deletions

17
Cargo.lock generated
View File

@ -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",
]

View File

@ -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" }

View File

@ -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()
}