Merge branch 'daemon_improvements' into 'main'

Move redox-daemon into this repo and improve it

See merge request redox-os/base!47
This commit is contained in:
Jeremy Soller
2025-12-03 15:11:45 -07:00
96 changed files with 327 additions and 1779 deletions
Generated
+45 -47
View File
@@ -8,10 +8,10 @@ version = "0.1.0"
dependencies = [
"bitflags 1.3.2",
"common",
"daemon",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox-scheme 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_event",
"redox_syscall",
@@ -39,13 +39,13 @@ dependencies = [
"amlserde",
"arrayvec",
"common",
"daemon",
"libredox",
"log",
"num-derive",
"num-traits",
"parking_lot 0.12.5",
"plain",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_event",
"redox_syscall",
@@ -62,11 +62,11 @@ dependencies = [
"bitflags 1.3.2",
"byteorder",
"common",
"daemon",
"driver-block",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -86,8 +86,8 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"libredox",
"redox-daemon",
"redox-scheme 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_event",
"redox_syscall",
@@ -209,10 +209,10 @@ name = "audiod"
version = "0.1.0"
dependencies = [
"anyhow",
"daemon",
"ioslice",
"libc",
"libredox",
"redox-daemon",
"redox-scheme 0.8.2 (git+https://gitlab.redox-os.org/redox-os/redox-scheme.git)",
"redox_syscall",
]
@@ -240,10 +240,10 @@ name = "bcm2835-sdhcid"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"driver-block",
"fdt 0.2.0-alpha1",
"libredox",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -253,12 +253,12 @@ name = "bgad"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"inputd",
"libredox",
"log",
"orbclient",
"pcid",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_syscall",
]
@@ -501,6 +501,13 @@ version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]]
name = "daemon"
version = "0.0.0"
dependencies = [
"libc",
]
[[package]]
name = "defmt"
version = "0.3.100"
@@ -555,12 +562,12 @@ dependencies = [
name = "driver-block"
version = "0.1.0"
dependencies = [
"daemon",
"executor",
"futures",
"libredox",
"log",
"partitionlib",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_syscall",
]
@@ -582,8 +589,8 @@ dependencies = [
name = "driver-network"
version = "0.1.0"
dependencies = [
"daemon",
"libredox",
"redox-daemon",
"redox-scheme 0.4.0",
"redox_syscall",
]
@@ -594,11 +601,11 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"driver-network",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -642,12 +649,12 @@ name = "fbbootlogd"
version = "0.1.0"
dependencies = [
"console-draw",
"daemon",
"graphics-ipc",
"inputd",
"libredox",
"orbclient",
"ransid",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_event",
"redox_syscall",
@@ -659,13 +666,13 @@ version = "0.1.0"
dependencies = [
"common",
"console-draw",
"daemon",
"graphics-ipc",
"inputd",
"libredox",
"log",
"orbclient",
"ransid",
"redox-daemon",
"redox-scheme 0.4.0",
"redox_event",
"redox_syscall",
@@ -906,9 +913,9 @@ version = "0.1.0"
dependencies = [
"amlserde",
"common",
"daemon",
"fdt 0.1.5",
"log",
"redox-daemon",
"ron",
]
@@ -941,11 +948,11 @@ name = "ided"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"driver-block",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -956,10 +963,10 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox-scheme 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_event",
"redox_syscall",
@@ -989,10 +996,10 @@ version = "0.1.0"
dependencies = [
"anyhow",
"common",
"daemon",
"libredox",
"log",
"orbclient",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_syscall",
]
@@ -1012,10 +1019,10 @@ name = "ipcd"
version = "0.1.0"
dependencies = [
"anyhow",
"daemon",
"libc",
"libredox",
"rand 0.8.5",
"redox-daemon",
"redox-rt",
"redox-scheme 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_event",
@@ -1040,10 +1047,10 @@ version = "1.0.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"driver-network",
"libredox",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -1086,9 +1093,9 @@ name = "lived"
version = "0.1.0"
dependencies = [
"anyhow",
"daemon",
"driver-block",
"libredox",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -1112,8 +1119,8 @@ checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
name = "logd"
version = "0.1.0"
dependencies = [
"daemon",
"libredox",
"redox-daemon",
"redox-scheme 0.5.0",
"redox_syscall",
]
@@ -1169,6 +1176,7 @@ dependencies = [
"arrayvec",
"bitflags 2.10.0",
"common",
"daemon",
"driver-block",
"executor",
"futures",
@@ -1177,7 +1185,6 @@ dependencies = [
"parking_lot 0.12.5",
"partitionlib",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
"smallvec 1.15.1",
@@ -1297,6 +1304,7 @@ version = "0.1.0"
dependencies = [
"bincode",
"common",
"daemon",
"fdt 0.1.5",
"libc",
"libredox",
@@ -1304,7 +1312,6 @@ dependencies = [
"pci_types",
"pico-args",
"plain",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_syscall",
"serde",
@@ -1394,11 +1401,11 @@ version = "0.1.0"
dependencies = [
"bitflags 1.3.2",
"common",
"daemon",
"inputd",
"libredox",
"log",
"orbclient",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_event",
"redox_syscall",
@@ -1408,8 +1415,8 @@ dependencies = [
name = "ptyd"
version = "0.1.0"
dependencies = [
"daemon",
"libredox",
"redox-daemon",
"redox-scheme 0.3.0",
"redox_event",
"redox_syscall",
@@ -1435,9 +1442,9 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
name = "ramfs"
version = "0.1.0"
dependencies = [
"daemon",
"indexmap",
"libredox",
"redox-daemon",
"redox-scheme 0.5.0",
"redox_syscall",
"slab",
@@ -1521,11 +1528,11 @@ dependencies = [
name = "randd"
version = "0.1.0"
dependencies = [
"daemon",
"libredox",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"raw-cpuid",
"redox-daemon",
"redox-scheme 0.2.4",
"redox_syscall",
"sha2",
@@ -1559,15 +1566,6 @@ dependencies = [
"rand_core 0.3.1",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "git+https://gitlab.redox-os.org/redox-os/redox-daemon.git#31ab115cf17d6fe333515bfe19ac477352a1dcc0"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-initfs"
version = "0.2.0"
@@ -1701,9 +1699,9 @@ name = "redox_netstack"
version = "0.1.0"
dependencies = [
"anyhow",
"daemon",
"libredox",
"log",
"redox-daemon",
"redox-log",
"redox-scheme 0.8.2 (git+https://gitlab.redox-os.org/redox-os/redox-scheme.git)",
"redox_event",
@@ -1790,11 +1788,11 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"driver-network",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -1805,11 +1803,11 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"driver-network",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -1838,9 +1836,9 @@ version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"common",
"daemon",
"libredox",
"log",
"redox-daemon",
"redox-scheme 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_event",
"redox_syscall",
@@ -2277,10 +2275,10 @@ name = "usbscsid"
version = "0.1.0"
dependencies = [
"base64 0.11.0",
"daemon",
"driver-block",
"libredox",
"plain",
"redox-daemon",
"redox_event",
"redox_syscall",
"thiserror 1.0.69",
@@ -2315,10 +2313,10 @@ name = "vboxd"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"libredox",
"orbclient",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -2340,13 +2338,13 @@ name = "vesad"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"driver-graphics",
"graphics-ipc",
"inputd",
"libredox",
"orbclient",
"ransid",
"redox-daemon",
"redox_event",
"redox_syscall",
]
@@ -2357,12 +2355,12 @@ version = "0.1.0"
dependencies = [
"anyhow",
"common",
"daemon",
"driver-block",
"futures",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
"spin 0.10.0",
@@ -2394,6 +2392,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"common",
"daemon",
"driver-graphics",
"futures",
"graphics-ipc",
@@ -2402,7 +2401,6 @@ dependencies = [
"log",
"orbclient",
"pcid",
"redox-daemon",
"redox_event",
"redox_syscall",
"spin 0.9.8",
@@ -2415,12 +2413,12 @@ name = "virtio-netd"
version = "0.1.0"
dependencies = [
"common",
"daemon",
"driver-network",
"futures",
"libredox",
"log",
"pcid",
"redox-daemon",
"redox_syscall",
"static_assertions",
"virtio-core",
@@ -2617,13 +2615,13 @@ dependencies = [
"chashmap",
"common",
"crossbeam-channel",
"daemon",
"futures",
"lazy_static",
"libredox",
"log",
"pcid",
"plain",
"redox-daemon",
"redox-scheme 0.6.2",
"redox_event",
"redox_syscall",
@@ -2659,8 +2657,8 @@ dependencies = [
name = "zerod"
version = "0.1.0"
dependencies = [
"daemon",
"libredox",
"redox-daemon",
"redox-scheme 0.2.4",
"redox_syscall",
]
+1 -1
View File
@@ -2,6 +2,7 @@
resolver = "2"
members = [
"audiod",
"daemon",
"init",
"initfs",
"initfs/archive-common",
@@ -72,4 +73,3 @@ exclude = ["bootstrap"]
# Needs libc 0.2 backport of https://github.com/rust-lang/libc/pull/4825
libc = { git = "https://gitlab.redox-os.org/redox-os/liblibc.git", branch = "redox-0.2" }
orbclient = { git = "https://gitlab.redox-os.org/redox-os/orbclient.git", version = "0.3.44" }
redox-daemon = { git = "https://gitlab.redox-os.org/redox-os/redox-daemon.git" }
-82
View File
@@ -1,82 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "audiod"
version = "0.1.0"
dependencies = [
"libc",
"libredox 0.0.3",
"redox-daemon",
"redox-scheme",
"redox_syscall",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "libc"
version = "0.2.150"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
[[package]]
name = "libredox"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [
"bitflags 2.4.1",
"libc",
"redox_syscall",
]
[[package]]
name = "libredox"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "962b650e6b934f95cec493e1464e0f5cba98dd9ba9ef2b1c42cdfdb7864cab5a"
dependencies = [
"bitflags 2.4.1",
"libc",
"redox_syscall",
]
[[package]]
name = "redox-daemon"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "353178b5771a301b9d2b318914ab5dfeb21dd6e65930faedde19248cfceca5a7"
dependencies = [
"libc",
"libredox 0.0.1",
]
[[package]]
name = "redox-scheme"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/redox-scheme.git#afd3fa573f0a7c03b762ac23daaf06966afecc75"
dependencies = [
"libredox 0.0.3",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags 1.3.2",
]
+1 -1
View File
@@ -5,7 +5,7 @@ authors = ["Jeremy Soller <jackpot51@gmail.com>"]
edition = "2021"
[dependencies]
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox_syscall = { version = "0.5", features = ["std"] }
libc = "0.2"
libredox = { version = "0.1", features = ["mkns"] }
+6 -8
View File
@@ -11,7 +11,7 @@ use libredox::{error::Result, Fd};
use redox_scheme::wrappers::ReadinessBased;
use redox_scheme::Socket;
use redox_daemon::Daemon;
use daemon::Daemon;
use self::scheme::AudioScheme;
@@ -50,7 +50,7 @@ fn daemon(daemon: Daemon) -> anyhow::Result<()> {
let socket = Socket::create("audio").context("failed to create scheme")?;
// The scheme is now ready to accept requests, notify the original process
daemon.ready().unwrap();
daemon.ready();
let hw_file = Fd::open("/scheme/audiohw", flag::O_WRONLY | flag::O_CLOEXEC, 0)?;
@@ -60,7 +60,8 @@ fn daemon(daemon: Daemon) -> anyhow::Result<()> {
let ns = libredox::call::mkns(&[
//IoSlice::new(b"memory"), TODO: already included, uncommenting gives EEXIST
IoSlice::new(b"rand"), // for HashMap
]).context("failed to make namespace")?;
])
.context("failed to make namespace")?;
libredox::call::setrens(ns, ns).context("failed to set namespace")?;
// Spawn a thread to mix and send audio data
@@ -86,8 +87,8 @@ fn daemon(daemon: Daemon) -> anyhow::Result<()> {
Ok(())
}
fn main() -> anyhow::Result<()> {
let Err(err) = Daemon::new(|x| match daemon(x) {
fn main() {
Daemon::new(|x| match daemon(x) {
Ok(()) => {
process::exit(0);
}
@@ -96,7 +97,4 @@ fn main() -> anyhow::Result<()> {
process::exit(1);
}
});
eprintln!("audiod: {}", err);
process::exit(1);
}
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "daemon"
version = "0.0.0"
edition = "2024"
[dependencies]
libc = "0.2.177"
+46
View File
@@ -0,0 +1,46 @@
#![feature(never_type)]
use std::io::{self, PipeWriter, Read, Write};
#[must_use = "Daemon::ready must be called"]
pub struct Daemon {
write_pipe: PipeWriter,
}
fn errno() -> io::Error {
io::Error::last_os_error()
}
impl Daemon {
pub fn new<F: FnOnce(Daemon) -> !>(f: F) -> ! {
let (mut read_pipe, write_pipe) = std::io::pipe().unwrap();
match unsafe { libc::fork() } {
0 => {
drop(read_pipe);
f(Daemon { write_pipe })
}
-1 => return Err(errno()).unwrap(),
_pid => {
drop(write_pipe);
let mut data = [0];
match read_pipe.read_exact(&mut data) {
Ok(()) => {}
Err(err) if err.kind() == io::ErrorKind::UnexpectedEof => {
unsafe { libc::_exit(101) };
}
Err(err) => return Err(err).unwrap(),
};
unsafe { libc::_exit(data[0].into()) };
}
}
}
pub fn ready(mut self) {
self.write_pipe.write_all(&[0]).unwrap();
}
}
+1 -1
View File
@@ -13,7 +13,6 @@ num-derive = "0.3"
num-traits = "0.2"
parking_lot = "0.12"
plain = "0.2.3"
redox-daemon = "0.1"
redox_syscall = "0.5.6"
redox_event = "0.4.1"
rustc-hash = "1.1.0"
@@ -22,6 +21,7 @@ ron = "0.8.1"
amlserde = { path = "../amlserde" }
common = { path = "../common" }
daemon = { path = "../../daemon" }
libredox = "0.1.3"
redox-scheme = "0.6.2"
arrayvec = "0.7.6"
+5 -2
View File
@@ -262,7 +262,8 @@ impl AmlSymbols {
let handler = AmlPhysMemHandler::new(Arc::clone(&self.page_cache));
//TODO: use these parsed tables for the rest of acpid
let rsdp_address = usize::from_str_radix(&std::env::var("RSDP_ADDR")?, 16)?;
let tables = unsafe { AcpiTables::from_rsdp(handler.clone(), rsdp_address).map_err(format_err)? };
let tables =
unsafe { AcpiTables::from_rsdp(handler.clone(), rsdp_address).map_err(format_err)? };
let platform = AcpiPlatform::new(tables, handler).map_err(format_err)?;
let interpreter = Interpreter::new_from_platform(&platform).map_err(format_err)?;
self.aml_context = Some(interpreter);
@@ -279,7 +280,9 @@ impl AmlSymbols {
}
}
}
self.aml_context.as_mut().expect("AML context not initialized")
self.aml_context
.as_mut()
.expect("AML context not initialized")
}
pub fn symbols_cache(&self) -> &FxHashMap<String, String> {
+14 -11
View File
@@ -152,14 +152,14 @@ impl AmlPhysMemHandler {
match libredox::Fd::open(
"/scheme/pci/access",
libredox::flag::O_RDWR | libredox::flag::O_CLOEXEC,
0
0,
) {
Ok(fd) => Some(fd),
Err(err) => {
log::error!("failed to open /scheme/pci/access: {}", err);
None
}
}
},
);
Self { page_cache, pci_fd }
}
@@ -172,11 +172,11 @@ impl AmlPhysMemHandler {
// Offset: u16, 12 bits, 4096 total, at 0 bits
[
kind.into(),
(u64::from(addr.segment()) << 28) |
(u64::from(addr.bus()) << 20) |
(u64::from(addr.device()) << 15) |
(u64::from(addr.function()) << 12) |
u64::from(off)
(u64::from(addr.segment()) << 28)
| (u64::from(addr.bus()) << 20)
| (u64::from(addr.device()) << 15)
| (u64::from(addr.function()) << 12)
| u64::from(off),
]
}
@@ -184,13 +184,16 @@ impl AmlPhysMemHandler {
let metadata = Self::pci_call_metadata(1, addr, off);
match &*self.pci_fd {
Some(pci_fd) => match pci_fd.call_ro(value, syscall::CallFlags::empty(), &metadata) {
Ok(_) => {},
Ok(_) => {}
Err(err) => {
log::error!("read pci {addr}@{off:04X}:{:02X}: {}", value.len(), err);
}
},
None => {
log::error!("read pci {addr}@{off:04X}:{:02X}: pci access not available", value.len());
log::error!(
"read pci {addr}@{off:04X}:{:02X}: pci access not available",
value.len()
);
}
}
}
@@ -199,11 +202,11 @@ impl AmlPhysMemHandler {
let metadata = Self::pci_call_metadata(2, addr, off);
match &*self.pci_fd {
Some(pci_fd) => match pci_fd.call_wo(value, syscall::CallFlags::empty(), &metadata) {
Ok(_) => {},
Ok(_) => {}
Err(err) => {
log::error!("write pci {addr}@{off:04X}={value:02X?}: {}", err);
}
}
},
None => {
log::error!("write pci {addr}@{off:04X}={value:02X?}: pci access not available");
}
+4 -4
View File
@@ -13,7 +13,7 @@ mod aml_physmem;
mod scheme;
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
common::setup_logging(
"misc",
"acpi",
@@ -28,7 +28,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
if rxsdt_raw_data.is_empty() {
log::info!("System doesn't use ACPI");
daemon.ready().expect("acpid: failed to notify parent");
daemon.ready();
std::process::exit(0);
}
@@ -73,7 +73,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
let mut event_queue = RawEventQueue::new().expect("acpid: failed to create event queue");
let socket = Socket::nonblock("acpi").expect("acpid: failed to create disk scheme");
daemon.ready().expect("acpid: failed to notify parent");
daemon.ready();
//TODO: needs to open /scheme/pci/access later! libredox::call::setrens(0, 0).expect("acpid: failed to enter null namespace");
@@ -144,5 +144,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("acpid: failed to daemonize");
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -8,10 +8,10 @@ bitflags = "1"
common = { path = "../../common" }
libredox = "0.1.3"
log = "0.4"
redox-daemon = "0.1"
redox_event = "0.4.1"
redox_syscall = "0.5"
spin = "0.9"
daemon = { path = "../../../daemon" }
pcid = { path = "../../pcid" }
redox-scheme = "0.8.2"
+3 -4
View File
@@ -35,7 +35,7 @@ fn main() {
println!(" + ac97 {}", pci_config.func.display());
// Daemonize
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
common::setup_logging(
"audio",
"pci",
@@ -79,7 +79,7 @@ fn main() {
)
.unwrap();
daemon.ready().expect("ac97d: failed to signal readiness");
daemon.ready();
libredox::call::setrens(0, 0).expect("ac97d: failed to enter null namespace");
@@ -135,6 +135,5 @@ fn main() {
}
std::process::exit(0);
})
.expect("ac97d: failed to daemonize");
});
}
+1 -1
View File
@@ -7,11 +7,11 @@ edition = "2021"
bitflags = "2"
libredox = "0.1.3"
log = "0.4"
redox-daemon = "0.1"
redox_event = "0.4.1"
redox_syscall = "0.5"
spin = "0.9"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
pcid = { path = "../../pcid" }
redox-scheme = "0.8.2"
+3 -3
View File
@@ -23,7 +23,7 @@ QEMU ICH9 8086:293E
82801H ICH8 8086:284B
*/
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
@@ -64,7 +64,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
let socket = Socket::nonblock("audiohw").expect("ihdad: failed to create socket");
let mut readiness_based = ReadinessBased::new(&socket, 16);
daemon.ready().expect("ihdad: failed to signal readiness");
daemon.ready();
event_queue
.subscribe(
@@ -141,5 +141,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn main() {
// Daemonize
redox_daemon::Daemon::new(daemon).expect("ihdad: failed to daemonize");
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -8,7 +8,7 @@ bitflags = "2"
common = { path = "../../common" }
libredox = "0.1.3"
log = "0.4"
redox-daemon = "0.1"
daemon = { path = "../../../daemon" }
redox_event = "0.4.1"
redox_syscall = "0.5"
spin = "0.9"
+3 -4
View File
@@ -19,7 +19,7 @@ fn main() {
println!(" + sb16 at 0x{:X}\n", addr);
// Daemonize
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
common::setup_logging(
"audio",
"pci",
@@ -62,7 +62,7 @@ fn main() {
)
.unwrap();
daemon.ready().expect("sb16d: failed to signal readiness");
daemon.ready();
libredox::call::setrens(0, 0).expect("sb16d: failed to enter null namespace");
@@ -112,6 +112,5 @@ fn main() {
}
std::process::exit(0);
})
.expect("sb16d: failed to daemonize");
});
}
+1 -1
View File
@@ -19,7 +19,7 @@ pub mod sgl;
/// Low latency timeout for driver loops
pub mod timeout;
pub use logger::{output_level, file_level, setup_logging};
pub use logger::{file_level, output_level, setup_logging};
/// Specifies the write behavior for a specific region of memory
///
+1 -1
View File
@@ -6,11 +6,11 @@ edition = "2021"
[dependencies]
orbclient = "0.3.47"
log = "0.4"
redox-daemon = "0.1"
redox-scheme = "0.6.2"
redox_syscall = "0.5"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
inputd = { path = "../../inputd" }
pcid = { path = "../../pcid" }
libredox = "0.1.3"
+3 -4
View File
@@ -29,7 +29,7 @@ fn main() {
log::info!("BGA {}", pci_config.func.display());
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let socket = Socket::create("bga").expect("bgad: failed to create bga scheme");
let bar = unsafe { pcid_handle.map_bar(2) }.ptr.as_ptr();
@@ -46,7 +46,7 @@ fn main() {
libredox::call::setrens(0, 0).expect("bgad: failed to enter null namespace");
daemon.ready().expect("bgad: failed to notify parent");
daemon.ready();
loop {
let Some(request) = socket
@@ -70,6 +70,5 @@ fn main() {
_ => (),
}
}
})
.expect("bgad: failed to daemonize");
});
}
+1 -1
View File
@@ -8,10 +8,10 @@ orbclient = "0.3.27"
ransid = "0.4"
redox_event = "0.4"
redox_syscall = "0.5"
redox-daemon = "0.1"
redox-scheme = "0.6.2"
console-draw = { path = "../console-draw" }
daemon = { path = "../../../daemon" }
graphics-ipc = { path = "../graphics-ipc" }
inputd = { path = "../../inputd" }
libredox = "0.1.3"
+3 -3
View File
@@ -21,9 +21,9 @@ use crate::scheme::FbbootlogScheme;
mod scheme;
fn main() {
redox_daemon::Daemon::new(|daemon| inner(daemon)).expect("failed to create daemon");
daemon::Daemon::new(|daemon| inner(daemon));
}
fn inner(daemon: redox_daemon::Daemon) -> ! {
fn inner(daemon: daemon::Daemon) -> ! {
let event_queue = EventQueue::new().expect("fbbootlogd: failed to create event queue");
event::user_data! {
@@ -67,7 +67,7 @@ fn inner(daemon: redox_daemon::Daemon) -> ! {
// driver handoff. In the future inputd may directly pass a handle to the display instead.
//libredox::call::setrens(0, 0).expect("fbbootlogd: failed to enter null namespace");
daemon.ready().expect("failed to notify parent");
daemon.ready();
for event in event_queue {
match event.expect("fbbootlogd: failed to get event").user_data {
+1 -1
View File
@@ -9,11 +9,11 @@ orbclient = "0.3.27"
ransid = "0.4"
redox_event = "0.4"
redox_syscall = "0.5"
redox-daemon = "0.1"
redox-scheme = "0.4"
common = { path = "../../common" }
console-draw = { path = "../console-draw" }
daemon = { path = "../../../daemon" }
graphics-ipc = { path = "../graphics-ipc" }
inputd = { path = "../../inputd" }
libredox = "0.1.3"
+4 -4
View File
@@ -23,12 +23,12 @@ fn main() {
"fbcond",
"fbcond",
common::output_level(),
common::file_level()
common::file_level(),
);
redox_daemon::Daemon::new(|daemon| inner(daemon, &vt_ids)).expect("failed to create daemon");
daemon::Daemon::new(|daemon| inner(daemon, &vt_ids));
}
fn inner(daemon: redox_daemon::Daemon, vt_ids: &[usize]) -> ! {
fn inner(daemon: daemon::Daemon, vt_ids: &[usize]) -> ! {
let mut event_queue = EventQueue::new().expect("fbcond: failed to create event queue");
// FIXME listen for resize events from inputd and handle them
@@ -48,7 +48,7 @@ fn inner(daemon: redox_daemon::Daemon, vt_ids: &[usize]) -> ! {
// driver handoff. In the future inputd may directly pass a handle to the display instead.
//libredox::call::setrens(0, 0).expect("fbcond: failed to enter null namespace");
daemon.ready().expect("failed to notify parent");
daemon.ready();
let mut blocked = Vec::new();
+1 -1
View File
@@ -7,10 +7,10 @@ edition = "2021"
orbclient = "0.3.27"
ransid = "0.4"
redox_syscall = "0.5"
redox-daemon = "0.1"
redox_event = "0.4.1"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-graphics = { path = "../driver-graphics" }
graphics-ipc = { path = "../graphics-ipc" }
inputd = { path = "../../inputd" }
+3 -4
View File
@@ -69,10 +69,9 @@ fn main() {
};
}
redox_daemon::Daemon::new(|daemon| inner(daemon, framebuffers))
.expect("failed to create daemon");
daemon::Daemon::new(|daemon| inner(daemon, framebuffers));
}
fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec<FrameBuffer>) -> ! {
fn inner(daemon: daemon::Daemon, framebuffers: Vec<FrameBuffer>) -> ! {
let mut inputd_display_handle = DisplayHandle::new_early("vesa").unwrap();
let mut scheme = GraphicsScheme::new(FbAdapter { framebuffers }, "display.vesa".to_owned());
@@ -103,7 +102,7 @@ fn inner(daemon: redox_daemon::Daemon, framebuffers: Vec<FrameBuffer>) -> ! {
libredox::call::setrens(0, 0).expect("vesad: failed to enter null namespace");
daemon.ready().expect("failed to notify parent");
daemon.ready();
let all = [Source::Input, Source::Scheme];
for event in all
+1 -1
View File
@@ -11,13 +11,13 @@ futures = { version = "0.3.28", features = ["executor"] }
anyhow = "1.0.71"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-graphics = { path = "../driver-graphics" }
graphics-ipc = { path = "../graphics-ipc" }
virtio-core = { path = "../../virtio-core" }
pcid = { path = "../../pcid" }
inputd = { path = "../../inputd" }
redox-daemon = "0.1"
redox_event = "0.4.1"
redox_syscall = "0.5"
orbclient = "0.3.27"
+5 -5
View File
@@ -430,7 +430,7 @@ impl MoveCursor {
static DEVICE: spin::Once<virtio_core::Device> = spin::Once::new();
fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> {
fn deamon(deamon: daemon::Daemon) -> anyhow::Result<()> {
let mut pcid_handle = PciFunctionHandle::connect_default();
// Double check that we have the right device.
@@ -460,7 +460,7 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> {
device.transport.setup_config_notify(MSIX_PRIMARY_VECTOR);
device.transport.run_device();
deamon.ready().unwrap();
deamon.ready();
let (mut scheme, mut inputd_handle) = futures::executor::block_on(scheme::GpuScheme::new(
config,
@@ -543,8 +543,8 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> {
std::process::exit(0);
}
fn daemon_runner(redox_daemon: redox_daemon::Daemon) -> ! {
deamon(redox_daemon).unwrap();
fn daemon_runner(daemon: daemon::Daemon) -> ! {
deamon(daemon).unwrap();
unreachable!();
}
@@ -556,5 +556,5 @@ pub fn main() {
common::output_level(),
common::file_level(),
);
redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize");
daemon::Daemon::new(daemon_runner);
}
+1 -1
View File
@@ -6,8 +6,8 @@ edition = "2018"
[dependencies]
fdt = "0.1.5"
log = "0.4"
redox-daemon = "0.1"
ron = "0.8.1"
amlserde = { path = "../amlserde" }
common = { path = "../common" }
daemon = { path = "../../daemon" }
+10 -8
View File
@@ -3,7 +3,7 @@ use std::process;
mod backend;
use self::backend::{AcpiBackend, Backend, DeviceTreeBackend, LegacyBackend};
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
common::setup_logging(
"misc",
"hwd",
@@ -39,9 +39,11 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
// Must launch after acpid but before probe calls /scheme/acpi/symbols
match process::Command::new("pcid").spawn() {
Ok(mut child) => match child.wait() {
Ok(status) => if !status.success() {
log::error!("pcid exited with status {}", status);
},
Ok(status) => {
if !status.success() {
log::error!("pcid exited with status {}", status);
}
}
Err(err) => {
log::error!("failed to wait for pcid: {}", err);
}
@@ -50,8 +52,8 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
log::error!("failed to spawn pcid: {}", err);
}
}
daemon.ready().expect("hwd: failed to notify parent");
daemon.ready();
//TODO: HWD is meant to locate PCI/XHCI/etc devices in ACPI and DeviceTree definitions and start their drivers
match backend.probe() {
@@ -66,5 +68,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("hwd: failed to daemonize");
}
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -9,9 +9,9 @@ log = "0.4"
orbclient = "0.3.27"
redox_event = "0.4.1"
redox_syscall = "0.5.10"
redox-daemon = "0.1"
redox-scheme = "0.6.2"
libredox = "0.1.3"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
inputd = { path = "../../inputd" }
+3 -5
View File
@@ -25,7 +25,7 @@ mod scheme;
mod state;
mod vm;
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
common::setup_logging(
"input",
"ps2",
@@ -104,9 +104,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
libredox::call::setrens(0, 0).expect("ps2d: failed to enter null namespace");
daemon
.ready()
.expect("ps2d: failed to mark daemon as ready");
daemon.ready();
let mut ps2d = Ps2d::new(input, keymap);
@@ -187,5 +185,5 @@ fn get_keymap_from_str(k: &str) -> (fn(u8, bool) -> char, &'static str) {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("ps2d: failed to create daemon");
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -182,7 +182,7 @@ fn main() {
.expect(USAGE)
.parse::<u8>()
.expect("Expected integer as input of interface");
let name = format!("{}_{}_{}_hid", scheme, port, interface_num);
common::setup_logging(
"usb",
+1 -1
View File
@@ -7,10 +7,10 @@ authors = ["Anhad Singh <andypython@protonmail.com>"]
[dependencies]
anyhow = "1.0.71"
log = "0.4.19"
redox-daemon = "0.1.2"
redox_syscall = { version = "0.5", features = ["std"] }
orbclient = "0.3.27"
libredox = "0.1.3"
common = { path = "../common" }
daemon = { path = "../../daemon" }
redox-scheme = "0.6.2"
+5 -5
View File
@@ -487,12 +487,12 @@ impl InputScheme {
}
}
fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> {
fn deamon(deamon: daemon::Daemon) -> anyhow::Result<()> {
// Create the ":input" scheme.
let socket_file = Socket::create("input")?;
let mut scheme = InputScheme::new();
deamon.ready().unwrap();
deamon.ready();
loop {
scheme.has_new_events = false;
@@ -566,8 +566,8 @@ fn deamon(deamon: redox_daemon::Daemon) -> anyhow::Result<()> {
}
}
fn daemon_runner(redox_daemon: redox_daemon::Daemon) -> ! {
deamon(redox_daemon).unwrap();
fn daemon_runner(daemon: daemon::Daemon) -> ! {
deamon(daemon).unwrap();
unreachable!();
}
@@ -598,6 +598,6 @@ fn main() {
_ => panic!("inputd: invalid argument: {}", val),
}
} else {
redox_daemon::Daemon::new(daemon_runner).expect("inputd: failed to daemonize");
daemon::Daemon::new(daemon_runner);
}
}
+1 -1
View File
@@ -7,8 +7,8 @@ edition = "2018"
bitflags = "2"
redox_event = "0.4.1"
redox_syscall = "0.5"
redox-daemon = "0.1"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
libredox = "0.1.3"
redox-scheme = "0.8.2"
+3 -4
View File
@@ -33,11 +33,11 @@ fn main() {
println!(" + ALX {} on: {:X}, IRQ: {}\n", name, bar, irq);
// Daemonize
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let socket = Socket::nonblock("network").expect("alxd: failed to create socket");
let mut readiness_based = ReadinessBased::new(&socket, 16);
daemon.ready().expect("alxd: failed to signal readiness");
daemon.ready();
let mut irq_file =
File::open(format!("/scheme/irq/{}", irq)).expect("alxd: failed to open IRQ file");
@@ -133,6 +133,5 @@ fn main() {
}
}
std::process::exit(0);
})
.expect("alxd: failed to daemonize");
});
}
+1 -1
View File
@@ -5,6 +5,6 @@ edition = "2021"
[dependencies]
libredox = "0.1.3"
redox-daemon = "0.1"
daemon = { path = "../../../daemon" }
redox-scheme = "0.4"
redox_syscall = { version = "0.5", features = ["std"] }
+2 -2
View File
@@ -47,12 +47,12 @@ enum Handle {
impl<T: NetworkAdapter> NetworkScheme<T> {
pub fn new(
adapter_fn: impl FnOnce() -> T,
daemon: redox_daemon::Daemon,
daemon: daemon::Daemon,
scheme_name: String,
) -> Self {
assert!(scheme_name.starts_with("network"));
let socket = Socket::nonblock(&scheme_name).expect("failed to create network scheme");
daemon.ready().expect("failed to mark daemon as ready");
daemon.ready();
let adapter = adapter_fn();
NetworkScheme {
adapter,
+1 -1
View File
@@ -6,11 +6,11 @@ edition = "2018"
[dependencies]
bitflags = "2"
log = "0.4"
redox-daemon = "0.1.2"
libredox = "0.1.3"
redox_event = "0.4.1"
redox_syscall = "0.5"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-network = { path = "../driver-network" }
pcid = { path = "../../pcid" }
+2 -3
View File
@@ -29,7 +29,7 @@ fn main() {
log::info!("E1000 {}", pci_config.func.display());
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let mut irq_file = irq.irq_handle("e1000d");
let address = unsafe { pcid_handle.map_bar(0) }.ptr.as_ptr() as usize;
@@ -86,6 +86,5 @@ fn main() {
}
}
unreachable!()
})
.expect("e1000d: failed to create daemon");
});
}
+1 -1
View File
@@ -8,8 +8,8 @@ bitflags = "2"
libredox = "0.1.3"
redox_event = "0.4.1"
redox_syscall = "0.5"
redox-daemon = "0.1"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-network = { path = "../driver-network" }
pcid = { path = "../../pcid" }
+2 -3
View File
@@ -23,7 +23,7 @@ fn main() {
println!(" + IXGBE {}", pci_config.func.display());
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let mut irq_file = irq.irq_handle("ixgbed");
let mapped_bar = unsafe { pcid_handle.map_bar(0) };
@@ -84,6 +84,5 @@ fn main() {
}
}
unreachable!()
})
.expect("ixgbed: failed to create daemon");
});
}
+1 -1
View File
@@ -9,8 +9,8 @@ libredox = "0.1.3"
log = "0.4"
redox_event = "0.4.1"
redox_syscall = "0.5"
redox-daemon = "0.1"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-network = { path = "../driver-network" }
pcid = { path = "../../pcid" }
+2 -2
View File
@@ -35,7 +35,7 @@ fn map_bar(pcid_handle: &mut PciFunctionHandle) -> *mut u8 {
panic!("rtl8139d: failed to find BAR");
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
@@ -113,5 +113,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("rtl8139d: failed to create daemon");
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -9,8 +9,8 @@ libredox = "0.1.3"
log = "0.4"
redox_event = "0.4.1"
redox_syscall = "0.5"
redox-daemon = "0.1"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-network = { path = "../driver-network" }
pcid = { path = "../../pcid" }
+2 -2
View File
@@ -35,7 +35,7 @@ fn map_bar(pcid_handle: &mut PciFunctionHandle) -> *mut u8 {
panic!("rtl8168d: failed to find BAR");
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
@@ -113,5 +113,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("rtl8168d: failed to create daemon");
daemon::Daemon::new(daemon);
}
+1 -1
View File
@@ -11,8 +11,8 @@ futures = { version = "0.3.28", features = ["executor"] }
virtio-core = { path = "../../virtio-core" }
pcid = { path = "../../pcid" }
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-network = { path = "../driver-network" }
redox-daemon = "0.1"
redox_syscall = "0.5"
libredox = "0.1.3"
+4 -4
View File
@@ -27,7 +27,7 @@ static_assertions::const_assert_eq!(core::mem::size_of::<VirtHeader>(), 12);
const MAX_BUFFER_LEN: usize = 65535;
fn deamon(daemon: redox_daemon::Daemon) -> Result<(), Box<dyn std::error::Error>> {
fn deamon(daemon: daemon::Daemon) -> Result<(), Box<dyn std::error::Error>> {
let mut pcid_handle = PciFunctionHandle::connect_default();
// Double check that we have the right device.
@@ -119,8 +119,8 @@ fn deamon(daemon: redox_daemon::Daemon) -> Result<(), Box<dyn std::error::Error>
}
}
fn daemon_runner(redox_daemon: redox_daemon::Daemon) -> ! {
deamon(redox_daemon).unwrap();
fn daemon_runner(daemon: daemon::Daemon) -> ! {
deamon(daemon).unwrap();
unreachable!();
}
@@ -132,5 +132,5 @@ pub fn main() {
common::output_level(),
common::file_level(),
);
redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize");
daemon::Daemon::new(daemon_runner);
}
+1 -1
View File
@@ -19,10 +19,10 @@ log = "0.4"
pci_types = "0.10"
pico-args = { version = "0.5", features = ["combined-flags"] }
plain = "0.2"
redox-daemon = "0.1"
redox-scheme = "0.6.2"
redox_syscall = "0.5.9"
serde = { version = "1", features = ["derive"] }
common = { path = "../common" }
daemon = { path = "../../daemon" }
libredox = "0.1.3"
+2 -2
View File
@@ -197,10 +197,10 @@ fn main() {
common::setup_logging("bus", "pci", "pcid", log_level, log::LevelFilter::Info);
redox_daemon::Daemon::new(move |daemon| main_inner(daemon)).unwrap();
daemon::Daemon::new(move |daemon| main_inner(daemon));
}
fn main_inner(daemon: redox_daemon::Daemon) -> ! {
fn main_inner(daemon: daemon::Daemon) -> ! {
let pcie = Pcie::new();
let mut tree = BTreeMap::new();
+5 -3
View File
@@ -134,7 +134,7 @@ impl SchemeSync for PciScheme {
addr: _,
ref mut st,
} => Self::read_channel(st, buf),
_ => Err(Error::new(EBADF))
_ => Err(Error::new(EBADF)),
}
}
fn getdents<'buf>(
@@ -232,7 +232,7 @@ impl SchemeSync for PciScheme {
((value >> 15) & 0x1F) as u8,
((value >> 12) & 0x7) as u8,
),
(value & 0xFFF) as u16
(value & 0xFFF) as u16,
)
}
None => return Err(Error::new(EINVAL)),
@@ -259,7 +259,9 @@ impl SchemeSync for PciScheme {
}
if write {
let value = u32::from_le_bytes(bytes);
unsafe { self.pcie.write(addr, start + i, value); }
unsafe {
self.pcie.write(addr, start + i, value);
}
}
}
Ok(payload.len())
+1 -1
View File
@@ -7,10 +7,10 @@ edition = "2021"
bitflags = "1.2"
byteorder = "1.2"
log = "0.4"
redox-daemon = "0.1"
redox_syscall = { version = "0.5", features = ["std"] }
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-block = { path = "../driver-block" }
pcid = { path = "../../pcid" }
libredox = "0.1.3"
+2 -2
View File
@@ -14,10 +14,10 @@ use log::{error, info};
pub mod ahci;
fn main() {
redox_daemon::Daemon::new(daemon).expect("ahcid: failed to daemonize");
daemon::Daemon::new(daemon);
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
+1 -1
View File
@@ -8,9 +8,9 @@ edition = "2021"
[dependencies]
fdt = { git = "https://github.com/repnop/fdt.git" }
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-block = { path = "../driver-block" }
redox-daemon = "0.1"
libredox = "0.1.3"
redox_syscall = { version = "0.5", features = ["std"] }
redox_event = "0.4"
+2 -2
View File
@@ -22,10 +22,10 @@ fn get_dtb() -> Vec<u8> {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("mmc:failed to daemonize");
daemon::Daemon::new(daemon);
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let dtb_data = get_dtb();
println!("read from OS, len = {}", dtb_data.len());
if dtb_data.len() == 0 {
+1 -1
View File
@@ -4,6 +4,7 @@ version = "0.1.0"
edition = "2021"
[dependencies]
daemon = { path = "../../../daemon" }
executor = { path = "../../executor" }
partitionlib = { path = "../partitionlib" }
@@ -13,6 +14,5 @@ log = "0.4"
# TODO: migrate virtio to our executor
futures = { version = "0.3.28", features = ["executor"] }
redox-daemon = "0.1"
redox_syscall = { version = "0.5", features = ["std"] }
redox-scheme = "0.6.2"
+2 -2
View File
@@ -304,7 +304,7 @@ impl ExecutorTrait for TrivialExecutor {
impl<T: Disk> DiskScheme<T> {
pub fn new(
daemon: Option<redox_daemon::Daemon>,
daemon: Option<daemon::Daemon>,
scheme_name: String,
disks: BTreeMap<u32, T>,
executor: &impl ExecutorTrait,
@@ -313,7 +313,7 @@ impl<T: Disk> DiskScheme<T> {
let socket = Socket::nonblock(&scheme_name).expect("failed to create disk scheme");
if let Some(daemon) = daemon {
daemon.ready().expect("failed to signal readiness");
daemon.ready();
}
Self {
+1 -1
View File
@@ -9,6 +9,6 @@ driver-block = { path = "../driver-block" }
libredox = "0.1.3"
log = "0.4"
pcid = { path = "../../pcid" }
redox-daemon = "0.1"
daemon = { path = "../../../daemon" }
redox_syscall = { version = "0.5", features = ["std"] }
redox_event = "0.4"
+2 -2
View File
@@ -18,10 +18,10 @@ use crate::ide::{AtaCommand, AtaDisk, Channel};
pub mod ide;
fn main() {
redox_daemon::Daemon::new(daemon).expect("ided: failed to daemonize");
daemon::Daemon::new(daemon);
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
+1 -1
View File
@@ -10,7 +10,7 @@ license = "MIT"
[dependencies]
anyhow = "1"
libredox = "0.1.3"
redox-daemon = "0.1"
daemon = { path = "../../../daemon" }
redox_syscall = { version = "0.5", features = ["std"] }
redox_event = "0.4"
driver-block = { path = "../driver-block" }
+2 -3
View File
@@ -130,7 +130,7 @@ fn main() -> anyhow::Result<()> {
std::process::exit(0);
}
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let event_queue = event::EventQueue::new().unwrap();
event::user_data! {
@@ -169,6 +169,5 @@ fn main() -> anyhow::Result<()> {
}
std::process::exit(0);
})
.map_err(|err| anyhow!("failed to start daemon: {}", err))?;
});
}
+1 -1
View File
@@ -10,13 +10,13 @@ futures = "0.3"
libredox = "0.1.3"
log = "0.4"
parking_lot = "0.12.1"
redox-daemon = "0.1"
redox_event = "0.4.1"
redox_syscall = { version = "0.5", features = ["std"] }
smallvec = "1"
executor = { path = "../../executor" }
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-block = { path = "../driver-block" }
partitionlib = { path = "../partitionlib" }
pcid = { path = "../../pcid" }
+2 -2
View File
@@ -57,9 +57,9 @@ fn time_arm(time_handle: &mut File, secs: i64) -> io::Result<()> {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("nvmed: failed to daemonize");
daemon::Daemon::new(daemon);
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let pci_config = pcid_handle.config();
+1 -1
View File
@@ -12,7 +12,7 @@ base64 = "0.11" # Only for debugging
libredox = "0.1.3"
plain = "0.2"
driver-block = { path = "../driver-block" }
redox-daemon = "0.1"
daemon = { path = "../../../daemon" }
redox_event = "0.4"
redox_syscall = { version = "0.5", features = ["std"] }
thiserror = "1"
+3 -4
View File
@@ -33,17 +33,16 @@ fn main() {
scheme, port, protocol
);
redox_daemon::Daemon::new(move |d| daemon(d, scheme, port, protocol))
.expect("usbscsid: failed to daemonize");
daemon::Daemon::new(move |d| daemon(d, scheme, port, protocol));
}
fn daemon(daemon: redox_daemon::Daemon, scheme: String, port: PortId, protocol: u8) -> ! {
fn daemon(daemon: daemon::Daemon, scheme: String, port: PortId, protocol: u8) -> ! {
let disk_scheme_name = format!("disk.usb-{scheme}+{port}-scsi");
// TODO: Use eventfds.
let handle = XhciClientHandle::new(scheme.to_owned(), port);
// FIXME should this wait notifying readiness until the disk scheme is created?
daemon.ready().expect("usbscsid: failed to signal rediness");
daemon.ready();
let desc = handle
.get_standard_descs()
+1 -1
View File
@@ -12,11 +12,11 @@ static_assertions = "1.1.0"
futures = { version = "0.3.28", features = ["executor"] }
spin = "*"
redox-daemon = "0.1"
redox_event = "0.4"
redox_syscall = { version = "0.5", features = ["std"] }
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
driver-block = { path = "../driver-block" }
pcid = { path = "../../pcid" }
virtio-core = { path = "../../virtio-core" }
+4 -4
View File
@@ -30,7 +30,7 @@ pub enum Error {
SyscallError(syscall::Error),
}
pub fn main() -> anyhow::Result<()> {
pub fn main() {
common::setup_logging(
"disk",
"pci",
@@ -38,7 +38,7 @@ pub fn main() -> anyhow::Result<()> {
common::output_level(),
common::file_level(),
);
redox_daemon::Daemon::new(daemon_runner).expect("virtio-core: failed to daemonize");
daemon::Daemon::new(daemon_runner);
}
#[repr(C)]
@@ -109,7 +109,7 @@ pub struct BlockVirtRequest {
const_assert_eq!(core::mem::size_of::<BlockVirtRequest>(), 16);
fn daemon(daemon: redox_daemon::Daemon) -> anyhow::Result<()> {
fn daemon(daemon: daemon::Daemon) -> anyhow::Result<()> {
let mut pcid_handle = PciFunctionHandle::connect_default();
// Double check that we have the right device.
@@ -177,7 +177,7 @@ fn daemon(daemon: redox_daemon::Daemon) -> anyhow::Result<()> {
Ok(())
}
fn daemon_runner(redox_daemon: redox_daemon::Daemon) -> ! {
fn daemon_runner(redox_daemon: daemon::Daemon) -> ! {
daemon(redox_daemon).unwrap();
unreachable!();
}
+1 -1
View File
@@ -19,7 +19,6 @@ futures = "0.3"
plain = "0.2"
lazy_static = "1.4"
log = "0.4"
redox-daemon = "0.1"
redox_event = "0.4.1"
redox-scheme = "0.6.2"
redox_syscall = "0.5"
@@ -30,6 +29,7 @@ thiserror = "1"
toml = "0.5"
common = { path = "../../common" }
daemon = { path = "../../../daemon" }
pcid = { path = "../../pcid" }
libredox = "0.1.3"
regex = "1.10.6"
+4 -4
View File
@@ -116,12 +116,12 @@ fn get_int_method(pcid_handle: &mut PciFunctionHandle) -> (Option<File>, Interru
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("xhcid: failed to daemonize");
daemon::Daemon::new(daemon);
}
//TODO: cleanup CSZ support
fn daemon_with_context_size<const N: usize>(
daemon: redox_daemon::Daemon,
daemon: daemon::Daemon,
mut pcid_handle: PciFunctionHandle,
) -> ! {
let pci_config = pcid_handle.config();
@@ -149,7 +149,7 @@ fn daemon_with_context_size<const N: usize>(
let scheme_name = format!("usb.{}", name);
let socket = Socket::create(scheme_name.clone()).expect("xhcid: failed to create usb scheme");
daemon.ready().expect("xhcid: failed to notify parent");
daemon.ready();
let hci = Arc::new(
Xhci::<N>::new(scheme_name, address, interrupt_method, pcid_handle)
@@ -185,7 +185,7 @@ fn daemon_with_context_size<const N: usize>(
}
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let mut pcid_handle = PciFunctionHandle::connect_default();
let address = unsafe { pcid_handle.map_bar(0) }.ptr.as_ptr() as usize;
let cap = unsafe { &mut *(address as *mut xhci::CapabilityRegs) };
+1 -1
View File
@@ -8,7 +8,7 @@ libredox = "0.1.3"
orbclient = "0.3.47"
redox_event = "0.4.1"
redox_syscall = "0.5"
redox-daemon = "0.1"
common = { path = "../common" }
daemon = { path = "../../daemon" }
pcid = { path = "../pcid" }
+3 -4
View File
@@ -207,7 +207,7 @@ fn main() {
println!(" + VirtualBox {}", pci_config.func.display());
// Daemonize
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
common::acquire_port_io_rights().expect("vboxd: failed to get I/O permission");
let mut width = 0;
@@ -273,7 +273,7 @@ fn main() {
)
.unwrap();
daemon.ready().expect("failed to signal readiness");
daemon.ready();
libredox::call::setrens(0, 0).expect("vboxd: failed to enter null namespace");
@@ -330,6 +330,5 @@ fn main() {
}
std::process::exit(0);
})
.expect("vboxd: failed to daemonize");
});
}
-42
View File
@@ -1,42 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "init"
version = "0.1.0"
dependencies = [
"libredox",
]
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
-76
View File
@@ -1,76 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "ipcd"
version = "0.1.0"
dependencies = [
"libredox",
"redox-daemon",
"redox-scheme",
"redox_event",
"redox_syscall",
]
[[package]]
name = "libc"
version = "0.2.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95624e20d2c1808f7ca0820720d30aad9f5d2fc404e1ef379431ad7a790c3f7e"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_event"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69609faa5d5992247a4ef379917bb3e39be281405d6a0ccd4f942429400b956f"
dependencies = [
"bitflags",
"libredox",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
+1 -1
View File
@@ -5,7 +5,7 @@ version = "0.1.0"
[dependencies]
libredox = { version = "0.1.8", features = ["call"]}
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox_syscall = "0.5.17"
redox-scheme = "0.8.0"
redox-rt = { git = "https://gitlab.redox-os.org/redox-os/relibc.git", default-features = false }
+4 -5
View File
@@ -14,7 +14,7 @@ use self::uds::dgram::UdsDgramScheme;
use self::uds::stream::UdsStreamScheme;
fn main() {
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
// TODO: Better error handling
match inner(daemon) {
Ok(()) => std::process::exit(0),
@@ -23,11 +23,10 @@ fn main() {
std::process::exit(1);
}
}
})
.expect("ipcd: failed to daemonize");
});
}
fn inner(daemon: redox_daemon::Daemon) -> anyhow::Result<()> {
fn inner(daemon: daemon::Daemon) -> anyhow::Result<()> {
event::user_data! {
enum EventSource {
ChanSocket,
@@ -67,7 +66,7 @@ fn inner(daemon: redox_daemon::Daemon) -> anyhow::Result<()> {
);
let mut uds_dgram_handler = ReadinessBased::new(&uds_dgram_socket, 16);
daemon.ready().unwrap();
daemon.ready();
// Create event listener for both files
let mut event_queue = EventQueue::<EventSource>::new()
-65
View File
@@ -1,65 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "logd"
version = "0.1.0"
dependencies = [
"libredox",
"redox-daemon",
"redox-scheme",
"redox_syscall",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98d040cfa6370d9c6b1a5987247272f19ea4722f1064e66ad2e077c152b82ea3"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
+1 -1
View File
@@ -6,6 +6,6 @@ edition = "2021"
[dependencies]
redox_syscall = "0.5"
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
libredox = "0.1.3"
redox-scheme = "0.5"
+3 -3
View File
@@ -5,10 +5,10 @@ use crate::scheme::LogScheme;
mod scheme;
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let socket = Socket::create("log").expect("logd: failed to create log scheme");
daemon.ready().expect("logd: failed to notify parent");
daemon.ready();
let mut scheme = LogScheme::new();
@@ -34,5 +34,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("logd: failed to daemonize");
daemon::Daemon::new(daemon);
}
-765
View File
@@ -1,765 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "android-tzdata"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0"
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "anyhow"
version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
[[package]]
name = "arg_parser"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/arg-parser.git#1c434b55f3e1a0375ebcca85b3e88db7378e82fa"
[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "bumpalo"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byteorder"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cc"
version = "1.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945"
dependencies = [
"shlex",
]
[[package]]
name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
"android-tzdata",
"iana-time-zone",
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
]
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "crossbeam-channel"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "defmt"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a99dd22262668b887121d4672af5a64b238f026099f1a2a1b322066c9ecfe9e0"
dependencies = [
"bitflags 1.3.2",
"defmt-macros",
]
[[package]]
name = "defmt-macros"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3a9f309eff1f79b3ebdf252954d90ae440599c26c2c553fe87a2d17195f2dcb"
dependencies = [
"defmt-parser",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.79",
]
[[package]]
name = "defmt-parser"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff4a5fefe330e8d7f31b16a318f9ce81000d8e35e69b93eae154d16d2278f70f"
dependencies = [
"thiserror",
]
[[package]]
name = "dns-parser"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7020f6760aea312d43d23cb83bf6c0c49f162541db8b02bf95209ac51dc253d"
dependencies = [
"byteorder 1.5.0",
"quick-error",
]
[[package]]
name = "hash32"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
dependencies = [
"byteorder 1.5.0",
]
[[package]]
name = "heapless"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
dependencies = [
"hash32",
"stable_deref_trait",
]
[[package]]
name = "iana-time-zone"
version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"iana-time-zone-haiku",
"js-sys",
"wasm-bindgen",
"windows-core",
]
[[package]]
name = "iana-time-zone-haiku"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"
dependencies = [
"cc",
]
[[package]]
name = "idna"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "ioslice"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e571352c8a3b89074d12e3ee5173ffe162159105352aaaf1fc5764da747e31b"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "js-sys"
version = "0.3.72"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "libc"
version = "0.2.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags 2.6.0",
"ioslice",
"libc",
"redox_syscall",
]
[[package]]
name = "log"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "managed"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d"
[[package]]
name = "matches"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
[[package]]
name = "net2"
version = "0.2.37"
source = "git+https://gitlab.redox-os.org/redox-os/net2-rs.git?branch=master#db0604dcb0a355e6b2fa5bcaad8f175bd6aeb5aa"
dependencies = [
"cfg-if 0.1.10",
"libc",
"winapi",
]
[[package]]
name = "netutils"
version = "0.1.0"
source = "git+https://gitlab.redox-os.org/redox-os/netutils.git#197e0ed0a0ce637653b33f6076c08afeac8cda16"
dependencies = [
"anyhow",
"arg_parser",
"libc",
"libredox",
"net2",
"ntpclient",
"pbr",
"redox-daemon",
"redox_event",
"redox_termios",
"termion",
"url",
]
[[package]]
name = "ntpclient"
version = "0.0.1"
source = "git+https://github.com/willem66745/ntpclient-rust#7e3bdf60eb940825789a8da5181025320e3050b0"
dependencies = [
"byteorder 0.5.3",
"time",
]
[[package]]
name = "num-traits"
version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
]
[[package]]
name = "numtoa"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aa2c4e539b869820a2b82e1aef6ff40aa85e65decdd5185e83fb4b1249cd00f"
[[package]]
name = "once_cell"
version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]]
name = "pbr"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed5827dfa0d69b6c92493d6c38e633bbaa5937c153d0d7c28bf12313f8c6d514"
dependencies = [
"crossbeam-channel",
"libc",
"winapi",
]
[[package]]
name = "percent-encoding"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-error"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-log"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81460b1526438123d16f0c968dbe42ba7f61e99645109b70e57864a8b66710fb"
dependencies = [
"chrono",
"log",
"smallvec",
"termion",
]
[[package]]
name = "redox_event"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69609faa5d5992247a4ef379917bb3e39be281405d6a0ccd4f942429400b956f"
dependencies = [
"bitflags 2.6.0",
"libredox",
]
[[package]]
name = "redox_netstack"
version = "0.1.0"
dependencies = [
"anyhow",
"dns-parser",
"ioslice",
"libredox",
"log",
"netutils",
"redox-daemon",
"redox-log",
"redox_event",
"redox_syscall",
"smoltcp",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags 2.6.0",
]
[[package]]
name = "redox_termios"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20145670ba436b55d91fc92d25e71160fbfbdd57831631c8d7d36377a476f1cb"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "smoltcp"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dad095989c1533c1c266d9b1e8d70a1329dd3723c3edac6d03bbd67e7bf6f4bb"
dependencies = [
"bitflags 1.3.2",
"byteorder 1.5.0",
"cfg-if 1.0.0",
"defmt",
"heapless",
"log",
"managed",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"unicode-ident",
]
[[package]]
name = "syn"
version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "termion"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7eaa98560e51a2cf4f0bb884d8b2098a9ea11ecf3b7078e9c68242c74cc923a7"
dependencies = [
"libc",
"libredox",
"numtoa",
"redox_termios",
]
[[package]]
name = "thiserror"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
]
[[package]]
name = "time"
version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
dependencies = [
"libc",
"wasi",
"winapi",
]
[[package]]
name = "tinyvec"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
dependencies = [
"tinyvec_macros",
]
[[package]]
name = "tinyvec_macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "unicode-bidi"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893"
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "unicode-normalization"
version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956"
dependencies = [
"tinyvec",
]
[[package]]
name = "url"
version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
dependencies = [
"idna",
"matches",
"percent-encoding",
]
[[package]]
name = "version_check"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
dependencies = [
"cfg-if 1.0.0",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
"syn 2.0.79",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.79",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.95"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-core"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+1 -1
View File
@@ -9,7 +9,7 @@ path = "src/main.rs"
[dependencies]
redox_event = "0.4.1"
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox_syscall = { version = "0.5", features = ["std"] }
redox-log = "0.1"
libredox = { version = "0.1.3", features = ["mkns"] }
+4 -5
View File
@@ -51,7 +51,7 @@ fn get_network_adapter() -> Result<String> {
}
}
fn run(daemon: redox_daemon::Daemon) -> Result<()> {
fn run(daemon: daemon::Daemon) -> Result<()> {
let adapter = get_network_adapter()?;
trace!("opening {adapter}:");
let network_fd = Fd::open(&format!("/scheme/{adapter}"), O_RDWR | O_NONBLOCK, 0)
@@ -97,7 +97,7 @@ fn run(daemon: redox_daemon::Daemon) -> Result<()> {
let event_queue = EventQueue::<EventSource>::new().context("failed to create event queue")?;
daemon.ready().expect("smolnetd: failed to notify parent");
daemon.ready();
event_queue
.subscribe(network_fd.raw(), EventSource::Network, EventFlags::READ)
@@ -164,7 +164,7 @@ fn run(daemon: redox_daemon::Daemon) -> Result<()> {
}
fn main() {
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
logger::init_logger("smolnetd");
if let Err(err) = run(daemon) {
@@ -172,6 +172,5 @@ fn main() {
process::exit(1);
}
process::exit(0);
})
.expect("smoltcp: failed to daemonize");
});
}
-83
View File
@@ -1,83 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "ptyd"
version = "0.1.0"
dependencies = [
"libredox",
"redox-daemon",
"redox-scheme",
"redox_event",
"redox_syscall",
"redox_termios",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63e7f06e1b19d8143043e959fbd7b76a37e759e3e9c6bbfc9c91c496b0b44d20"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_event"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69609faa5d5992247a4ef379917bb3e39be281405d6a0ccd4f942429400b956f"
dependencies = [
"bitflags",
"libredox",
]
[[package]]
name = "redox_syscall"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_termios"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20145670ba436b55d91fc92d25e71160fbfbdd57831631c8d7d36377a476f1cb"
+1 -1
View File
@@ -5,7 +5,7 @@ edition = "2021"
[dependencies]
libredox = "0.1.3"
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox-scheme = "0.3.0"
redox_event = "0.4.0"
redox_syscall = "0.5.0"
+17 -8
View File
@@ -4,8 +4,8 @@ use libredox::error::Error;
use libredox::{flag, Fd};
use redox_scheme::{CallRequest, RequestKind, Response, SignalBehavior, Socket};
use syscall::EINTR;
use syscall::data::TimeSpec;
use syscall::EINTR;
mod controlterm;
mod pgrp;
@@ -19,7 +19,7 @@ mod winsize;
use scheme::PtyScheme;
fn main() {
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
user_data! {
enum EventSource {
Socket,
@@ -45,7 +45,7 @@ fn main() {
.subscribe(time_file.raw(), EventSource::Time, EventFlags::READ)
.expect("pty: failed to watch events on time:");
daemon.ready().expect("pty: failed to notify parent");
daemon.ready();
//TODO: do not set timeout if not necessary
timeout(&mut time_file).expect("pty: failed to set timeout");
@@ -83,8 +83,7 @@ fn main() {
}
std::process::exit(0);
})
.expect("pty: failed to daemonize");
});
}
struct Todo {
@@ -107,7 +106,10 @@ fn scan_requests(
match request.kind() {
RequestKind::Cancellation(req) => {
if let Some(idx) = todo.iter().position(|t| t.request.request().request_id() == req.id) {
if let Some(idx) = todo
.iter()
.position(|t| t.request.request().request_id() == req.id)
{
todo[idx].cancelling = true;
}
}
@@ -117,7 +119,10 @@ fn scan_requests(
.write_response(response, SignalBehavior::Restart)
.expect("pty: failed to write responses to pty scheme");
} else {
todo.push(Todo { request, cancelling: false });
todo.push(Todo {
request,
cancelling: false,
});
}
}
_ => (),
@@ -135,7 +140,11 @@ fn do_todos(socket: &Socket, scheme: &mut PtyScheme, todo: &mut Vec<Todo>) {
.write_response(response, SignalBehavior::Restart)
.expect("pty: failed to write responses to pty scheme");
} else if todo[i].cancelling {
socket.write_response(Response::new(&todo[i].request, Err(Error::new(EINTR).into())), SignalBehavior::Restart)
socket
.write_response(
Response::new(&todo[i].request, Err(Error::new(EINTR).into())),
SignalBehavior::Restart,
)
.expect("pty: failed to write responses to pty scheme");
todo.remove(i);
} else {
+9 -2
View File
@@ -44,7 +44,10 @@ impl Resource for PtyPgrp {
let pty = pty_lock.borrow();
//println!("READ PGRP {}: {}", pty.id, pty.pgrp);
let dst_buf = buf.get_mut(..4).and_then(|b| <&mut [u8; 4]>::try_from(b).ok()).ok_or(Error::new(EBADF))?;
let dst_buf = buf
.get_mut(..4)
.and_then(|b| <&mut [u8; 4]>::try_from(b).ok())
.ok_or(Error::new(EBADF))?;
*dst_buf = (pty.pgrp as u32).to_ne_bytes();
Ok(Some(4))
@@ -57,7 +60,11 @@ impl Resource for PtyPgrp {
if let Some(pty_lock) = self.pty.upgrade() {
let mut pty = pty_lock.borrow_mut();
let new_pgrp = u32::from_ne_bytes(buf.get(..4).and_then(|b| <[u8; 4]>::try_from(b).ok()).ok_or(Error::new(EBADF))?);
let new_pgrp = u32::from_ne_bytes(
buf.get(..4)
.and_then(|b| <[u8; 4]>::try_from(b).ok())
.ok_or(Error::new(EBADF))?,
);
pty.pgrp = new_pgrp as usize;
//println!("WRITE PGRP {}: {} => {}", pty.id, pty.pgrp, new_pgrp);
+18 -3
View File
@@ -46,7 +46,10 @@ impl SchemeBlock for PtyScheme {
} else {
let control_term_id = path.parse::<usize>().or(Err(Error::new(EINVAL)))?;
let pty = {
let handle = self.handles.get(&control_term_id).ok_or(Error::new(ENOENT))?;
let handle = self
.handles
.get(&control_term_id)
.ok_or(Error::new(ENOENT))?;
handle.pty()
};
@@ -82,12 +85,24 @@ impl SchemeBlock for PtyScheme {
Ok(Some(id))
}
fn read(&mut self, id: usize, buf: &mut [u8], _offset: u64, _fcntl_flags: u32) -> Result<Option<usize>> {
fn read(
&mut self,
id: usize,
buf: &mut [u8],
_offset: u64,
_fcntl_flags: u32,
) -> Result<Option<usize>> {
let handle = self.handles.get_mut(&id).ok_or(Error::new(EBADF))?;
handle.read(buf)
}
fn write(&mut self, id: usize, buf: &[u8], _offset: u64, _fcntl_flags: u32) -> Result<Option<usize>> {
fn write(
&mut self,
id: usize,
buf: &[u8],
_offset: u64,
_fcntl_flags: u32,
) -> Result<Option<usize>> {
let handle = self.handles.get_mut(&id).ok_or(Error::new(EBADF))?;
handle.write(buf)
}
-104
View File
@@ -1,104 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "hashbrown"
version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb"
[[package]]
name = "indexmap"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "libc"
version = "0.2.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "ramfs"
version = "0.1.0"
dependencies = [
"indexmap",
"libredox",
"redox-daemon",
"redox-scheme",
"redox_syscall",
"slab",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95624e20d2c1808f7ca0820720d30aad9f5d2fc404e1ef379431ad7a790c3f7e"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
[[package]]
name = "slab"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
dependencies = [
"autocfg",
]
+1 -1
View File
@@ -9,7 +9,7 @@ description = "In-memory filesystem for Redox, which is useful for early logging
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox_syscall = "0.5.10"
redox-scheme = "0.5"
libredox = "0.1.3"
+3 -6
View File
@@ -10,7 +10,7 @@ use self::scheme::Scheme;
fn main() {
let scheme_name = env::args().nth(1).expect("Usage:\n\tramfs SCHEME_NAME");
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let socket =
redox_scheme::Socket::create(&scheme_name).expect("ramfs: failed to create socket");
@@ -18,9 +18,7 @@ fn main() {
libredox::call::setrens(0, 0).expect("ramfs: failed to enter null namespace");
daemon
.ready()
.expect("ramfs: failed to mark daemon as ready");
daemon.ready();
loop {
let Some(request) = socket
@@ -45,6 +43,5 @@ fn main() {
}
process::exit(0);
})
.expect("ramfs: failed to create daemon");
});
}
-240
View File
@@ -1,240 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "block-buffer"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b"
dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
]
[[package]]
name = "block-padding"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5"
dependencies = [
"byte-tools",
]
[[package]]
name = "byte-tools"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "digest"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
]
[[package]]
name = "fake-simd"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
[[package]]
name = "generic-array"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd"
dependencies = [
"typenum",
]
[[package]]
name = "libc"
version = "0.2.160"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "opaque-debug"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "ppv-lite86"
version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
dependencies = [
"zerocopy",
]
[[package]]
name = "proc-macro2"
version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
[[package]]
name = "randd"
version = "0.1.0"
dependencies = [
"libredox",
"rand_chacha",
"rand_core",
"raw-cpuid",
"redox-daemon",
"redox-scheme",
"redox_syscall",
"sha2",
]
[[package]]
name = "raw-cpuid"
version = "11.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0"
dependencies = [
"bitflags",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95624e20d2c1808f7ca0820720d30aad9f5d2fc404e1ef379431ad7a790c3f7e"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
[[package]]
name = "sha2"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69"
dependencies = [
"block-buffer",
"digest",
"fake-simd",
"opaque-debug",
]
[[package]]
name = "syn"
version = "2.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "typenum"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "unicode-ident"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
[[package]]
name = "zerocopy"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
"byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
+1 -1
View File
@@ -6,7 +6,7 @@ edition = "2021"
[dependencies]
rand_chacha = "0.2"
rand_core = "0.5"
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
redox_syscall = "0.5"
libredox = "0.1.3"
sha2 = "0.8"
+3 -5
View File
@@ -360,14 +360,12 @@ impl SchemeMut for RandScheme {
}
}
fn daemon(daemon: redox_daemon::Daemon) -> ! {
fn daemon(daemon: daemon::Daemon) -> ! {
let socket = Socket::<V2>::create("rand").expect("randd: failed to create rand scheme");
let mut scheme = RandScheme::new();
daemon
.ready()
.expect("randd: failed to mark daemon as ready");
daemon.ready();
libredox::call::setrens(0, 0).expect("randd: failed to enter null namespace");
@@ -388,5 +386,5 @@ fn daemon(daemon: redox_daemon::Daemon) -> ! {
}
fn main() {
redox_daemon::Daemon::new(daemon).expect("randd: failed to daemonize");
daemon::Daemon::new(daemon);
}
-65
View File
@@ -1,65 +0,0 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
[[package]]
name = "libc"
version = "0.2.159"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
[[package]]
name = "libredox"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
dependencies = [
"bitflags",
"libc",
"redox_syscall",
]
[[package]]
name = "redox-daemon"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbdeffdb03cf2961b211a2023e683d71f2c225ea93404da5dc34b0dc94f0341"
dependencies = [
"libc",
"libredox",
]
[[package]]
name = "redox-scheme"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98d040cfa6370d9c6b1a5987247272f19ea4722f1064e66ad2e077c152b82ea3"
dependencies = [
"libredox",
"redox_syscall",
]
[[package]]
name = "redox_syscall"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f"
dependencies = [
"bitflags",
]
[[package]]
name = "zerod"
version = "0.1.0"
dependencies = [
"libredox",
"redox-daemon",
"redox-scheme",
"redox_syscall",
]
+1 -1
View File
@@ -7,5 +7,5 @@ edition = "2021"
[dependencies]
redox_syscall = "0.5"
redox-scheme = "0.2.1"
redox-daemon = "0.1.2"
daemon = { path = "../daemon" }
libredox = "0.1.3"
+3 -4
View File
@@ -16,7 +16,7 @@ fn main() {
_ => panic!("needs to be called as either nulld or zerod"),
};
redox_daemon::Daemon::new(move |daemon| {
daemon::Daemon::new(move |daemon| {
let name = match ty {
Ty::Null => "null",
Ty::Zero => "zero",
@@ -26,7 +26,7 @@ fn main() {
libredox::call::setrens(0, 0).expect("zerod: failed to enter null namespace");
daemon.ready().expect("zerod: failed to notify parent");
daemon.ready();
loop {
let Some(request) = socket
@@ -46,6 +46,5 @@ fn main() {
_ => (),
}
}
})
.expect("zerod: failed to daemonize");
});
}