compat-systemd1, NOTIFY_SOCKET, binfmt y timer

- ente-systemd1-compat: org.freedesktop.systemd1.Manager. Cada Ente vivo
  del fractal aparece como `<label>.service`. ListUnits/GetUnit/
  GetUnitByPID consultan al bus interno (BusRequest::ListEntes). Start/
  Stop/Restart son stubs que loguen — Cards ya están en el grafo, no se
  inician/paran on-demand. Reload/ListUnitFiles/ListJobs vacíos.
  Properties: Version, Architecture, Features, Environment.

- ente-notify-compat: listener en /run/systemd/notify para sd_notify.
  Decodifica KEY=value lines (READY/STATUS/MAINPID/WATCHDOG/STOPPING)
  y log estructurado. Permisos 0666 para que cualquier proceso escriba.
- ente-soma inyecta NOTIFY_SOCKET=/run/systemd/notify en cada Ente
  encarnado (junto a ENTE_BUS_SOCK + ENTE_ID).

- ente-binfmt-compat: lee /usr/lib/binfmt.d, /etc/binfmt.d, /run/binfmt.d
  en orden. Cada línea no-comment se escribe a /proc/sys/fs/binfmt_misc/
  register. EEXIST silencioso (handler ya registrado por boot anterior).
  OneShot pattern.

- ente-timer-compat: scheduler cron 5-field UTC (min hour dom mon dow).
  Soporta `*`, `N`, `*/N` por field. Lee /etc/ente/timers.json. Tick
  alineado al próximo minuto exacto, evalúa todos los timers cada
  60s. Decompose epoch via Howard Hinnant Civil from days. fire() loguea
  por ahora — spawn real requiere SpawnRequest via bus.

3 shims añadidos: 0xa6 systemd1, 0xa7 notify, 0xa8 timer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sergio
2026-05-04 10:43:39 +00:00
parent 883c14dade
commit 227715a464
12 changed files with 915 additions and 0 deletions
+5
View File
@@ -57,6 +57,11 @@ fn build_env(card: &EntityCard, base_envp: &[(String, String)]) -> Vec<(String,
}
env.retain(|(k, _)| k != ente_bus::ENV_ENTE_ID);
env.push((ente_bus::ENV_ENTE_ID.into(), card.id.to_string()));
// Apps `Type=notify` (sd_notify) leen NOTIFY_SOCKET. Apuntamos al path
// canónico de systemd; si ente-notify-compat no está corriendo, apps
// sólo verán que sd_notify falla y siguen sin "ready" signal — no es fatal.
env.retain(|(k, _)| k != "NOTIFY_SOCKET");
env.push(("NOTIFY_SOCKET".into(), "/run/systemd/notify".into()));
env
}