This commit is contained in:
pjht 2024-08-06 19:41:31 -05:00
parent 9f3136724a
commit 76afb94f63
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E
2 changed files with 18 additions and 9 deletions

View File

@ -1,7 +1,8 @@
#![allow(clippy::result_unit_err)]
use std::{
os::mikros::ipc::rpc::{self, IncomingCall}, path::Path,
os::mikros::ipc::rpc::{self, IncomingCall},
path::Path,
};
use parking_lot::RwLock;

View File

@ -1,4 +1,8 @@
use std::{collections::HashMap, os::mikros::{ipc, syscalls}, sync::Arc};
use std::{
collections::HashMap,
os::mikros::{ipc, syscalls},
sync::Arc,
};
use parking_lot::RwLock;
@ -24,12 +28,14 @@ impl fs_rpc::Server for Serv {
impl devfs_rpc::Server for Serv {
fn register_dev(&self, from: u64, name: &str) -> Result<(), ()> {
self.devices.write().insert(name.to_owned(), from);
self.syslog_client.send_text_binary_message(
self.syslog_client
.send_text_binary_message(
"devfs",
format!("PID {} registered device {}", from, name),
1,
name.as_bytes().to_vec()
).unwrap();
name.as_bytes().to_vec(),
)
.unwrap();
Ok(())
}
}
@ -58,7 +64,9 @@ fn main() {
}
vfs_rpc::Client::new(vfs_pid).register_fs("devfs").unwrap();
syscalls::register(1);
syslog_client.send_text_binary_message("devfs", "Devfs initialized", 0, &[]).unwrap();
syslog_client
.send_text_binary_message("devfs", "Devfs initialized", 0, [])
.unwrap();
loop {
ipc::process_messages()
}