init: replace .expect("TODO") on namespace registration with descriptive panic messages

The scheme-service boot path in service.rs used .expect("TODO") on two
boot-critical libredox calls:

  - libredox::call::getns() — gets a fd to the current namespace
  - libredox::call::register_scheme_to_ns() — registers the spawned
    scheme into that namespace

If either call fails the scheme is invisible, which is non-recoverable
for boot.  The placeholder "TODO" message gave no diagnostic value.

Replaced with descriptive messages:
  - getns:         .expect("init: failed to get current namespace fd; ...")
  - register_scheme: unwrap_or_else(|e| panic!(...)) including the
    scheme name and the error, matching the existing pattern at line 87
    (create_pipe unwrap_or_else).

No behaviour change — both paths still panic on failure.  The only
difference is that the panic message now identifies the failure and
includes the offending scheme name.
This commit is contained in:
Red Bear OS
2026-07-26 17:40:06 +09:00
parent 30819f87cf
commit 4c7656a5c3
+8 -2
View File
@@ -137,9 +137,15 @@ impl Service {
}
}
let current_namespace_fd = libredox::call::getns().expect("TODO");
let current_namespace_fd = libredox::call::getns()
.expect("init: failed to get current namespace fd; boot cannot continue");
libredox::call::register_scheme_to_ns(current_namespace_fd, scheme, new_fd)
.expect("TODO");
.unwrap_or_else(|e| {
panic!(
"init: failed to register scheme '{}' in namespace: {}; boot cannot continue",
scheme, e
)
});
}
ServiceType::Oneshot => {
drop(read_pipe);