b83d40a833
Rename batch de la Fase A del PLAN_MACRO: - 25 crates ente-* → arje-* (protocol/init/runtime/compat). El linaje arje (init Linux) queda con prefijo coherente. - vista → revista (revista-core + revista-web). - pluma → fana (fana-md + fana-md-reader-web). fana absorbe el linaje markdown de pluma; será el writer DAG editor (prioridad alta). Cambios: - git mv de 29 crate dirs + 2 SDDs - package/lib/bin names + path refs + imports .rs reescritos - workspace Cargo.toml + comentarios de sección - SDDs de init/runtime/compat/protocol actualizados a arje- - SDD de revista + SDD de fana (reescrito: writer DAG editor) - docs/STATUS.md, ROADMAP.md, PLAN_MACRO.md, arje-boot.md, arje-replace-systemd.md actualizados - docs/changelog/akasha.md → chasqui.md scripts/rename-fase-a.py idempotente (--dry-run soportado). cargo check --workspace verde. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.7 KiB
Rust
45 lines
1.7 KiB
Rust
//! `ente-soma` — wrapper histórico sobre [`arje_incarnate`].
|
|
//!
|
|
//! La rutina de namespacing fue extraída a `ente-incarnate` para que
|
|
//! shuma, exploradores y cualquier supervisor no-PID-1 puedan reusarla.
|
|
//! Este crate sobrevive como compat para `ente-zero` y otros que importan
|
|
//! `arje_soma::{set_bus_sock, incarnate}`.
|
|
//!
|
|
//! Semántica preservada:
|
|
//! - `BUS_SOCK_PATH` global vía `OnceLock` (init lo setea una vez).
|
|
//! - `NOTIFY_SOCKET=/run/systemd/notify` se inyecta automáticamente.
|
|
//! - `strict_caps = false` (errores no-fatales se loguean, encarnación sigue).
|
|
|
|
use arje_card::EntityCard;
|
|
use arje_incarnate::{Incarnator, IncarnatorConfig};
|
|
use nix::unistd::Pid;
|
|
use std::path::PathBuf;
|
|
use std::sync::OnceLock;
|
|
use tracing::warn;
|
|
|
|
static INCARNATOR: OnceLock<Incarnator> = OnceLock::new();
|
|
|
|
/// Establece el path del socket del bus interno. Se llama una sola vez al
|
|
/// arrancar PID 1 (después de que el listener bind exitoso). Cada hijo
|
|
/// encarnado recibirá este path en `ENTE_BUS_SOCK`.
|
|
pub fn set_bus_sock(path: String) {
|
|
let cfg = IncarnatorConfig {
|
|
bus_sock: Some(PathBuf::from(path)),
|
|
notify_socket: Some(PathBuf::from("/run/systemd/notify")),
|
|
extra_env: Vec::new(),
|
|
strict_caps: false,
|
|
};
|
|
let _ = INCARNATOR.set(Incarnator::new(cfg));
|
|
}
|
|
|
|
/// Encarna un EntityCard. Si `set_bus_sock` no fue invocado todavía,
|
|
/// usa un Incarnator default (sin bus, sin notify).
|
|
pub fn incarnate(card: &EntityCard) -> anyhow::Result<Pid> {
|
|
let inc = INCARNATOR.get_or_init(|| Incarnator::new(IncarnatorConfig::default()));
|
|
let out = inc.incarnate(card)?;
|
|
for d in &out.degradations {
|
|
warn!(?d, ?out.pid, "incarnation degradation");
|
|
}
|
|
Ok(out.pid)
|
|
}
|