hwd: daemonize
This commit is contained in:
Generated
+1
@@ -641,6 +641,7 @@ dependencies = [
|
||||
"common",
|
||||
"fdt 0.1.5",
|
||||
"log",
|
||||
"redox-daemon",
|
||||
"ron",
|
||||
]
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
fdt = "0.1.5"
|
||||
log = "0.4"
|
||||
redox-daemon = "0.1"
|
||||
ron = "0.8.1"
|
||||
|
||||
amlserde = { path = "../amlserde" }
|
||||
|
||||
+13
-4
@@ -1,9 +1,9 @@
|
||||
use std::process::Command;
|
||||
use std::process;
|
||||
|
||||
mod backend;
|
||||
use self::backend::{AcpiBackend, Backend, DeviceTreeBackend, LegacyBackend};
|
||||
|
||||
fn main() {
|
||||
fn daemon(daemon: redox_daemon::Daemon) -> ! {
|
||||
common::setup_logging(
|
||||
"misc",
|
||||
"hwd",
|
||||
@@ -37,7 +37,7 @@ fn main() {
|
||||
|
||||
//TODO: launch pcid based on backend information?
|
||||
// Must launch after acpid but before probe calls /scheme/acpi/symbols
|
||||
match Command::new("pcid").spawn() {
|
||||
match process::Command::new("pcid").spawn() {
|
||||
Ok(mut child) => match child.wait() {
|
||||
Ok(status) => if !status.success() {
|
||||
log::error!("pcid exited with status {}", status);
|
||||
@@ -50,12 +50,21 @@ fn main() {
|
||||
log::error!("failed to spawn pcid: {}", err);
|
||||
}
|
||||
}
|
||||
|
||||
daemon.ready().expect("hwd: failed to notify parent");
|
||||
|
||||
//TODO: HWD is meant to locate PCI/XHCI/etc devices in ACPI and DeviceTree definitions and start their drivers
|
||||
match backend.probe() {
|
||||
Ok(()) => {}
|
||||
Ok(()) => {
|
||||
process::exit(0);
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to probe with error {}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
redox_daemon::Daemon::new(daemon).expect("hwd: failed to daemonize");
|
||||
}
|
||||
Reference in New Issue
Block a user