summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornamilsk <namilsk@namilsk.tech>2026-01-04 02:03:49 +0300
committernamilsk <namilsk@namilsk.tech>2026-01-04 02:05:54 +0300
commit2cad2077b647770aac103360cbd28b29c513db6c (patch)
treef4286bec364a815284f9d58ceb37e5d2ac8195a2
parent3d1d5c8857f852903434488036ccf5036893f881 (diff)
Removed unused code and written devplan in TODO.md
-rw-r--r--TODO.md53
-rw-r--r--init/src/mounts/fstab.rs6
-rw-r--r--init/src/mounts/rescue.rs1
3 files changed, 53 insertions, 7 deletions
diff --git a/TODO.md b/TODO.md
new file mode 100644
index 0000000..e64aff1
--- /dev/null
+++ b/TODO.md
@@ -0,0 +1,53 @@
+# vigil
+
+## Philosophy
+
+- Never drop into an emergency shell for non-critical failures (e.g. non-root filesystem mount failure).
+- Failures should be logged, not fatal.
+- Configuration via declarative TOML unit files. _(just like in systemd, but without the extra bloatware. Objectively, it is convenient to write services for systemd)_
+
+## Non-goals (explicitly out of scope)
+
+- Socket or bus activation (also like systemd).
+- Built-in cgroups, namespaces, or resource control.
+- D-Bus integration.
+- Dynamic dependency resolution beyond static unit deps.
+
+## Implementation Roadmap
+
+### Early system setup
+
+- [x] Mount essential filesystems (`/proc`, `/sys`, `/dev` via `devtmpfs`).
+- [ ] Spawn `udev` (or compatible device manager) as child process.
+- [x] Mount user-defined filesystems from `/etc/fstab` (non-fatal on failure = log & continue).
+- [ ] Activate `swap` (non-fatal on failure).
+- [ ] Set hostname, timezone, and locale from config.
+- [ ] Load kernel modules (via `modprobe` or direct `init_module` syscall).
+
+### Core runtime responsibilities
+
+- [ ] **Service management**
+ - Parse TOML unit files (`/etc/vigil/units/*.toml`)
+ - Start/stop/restart/status via `vigilctl`
+ - Handle `Wants=`, `After=`, `Before=` dependencies
+ - Auto-restart failed services (configurable: `restart = always|on-failure|never`)
+- [ ] **Child process reaping**
+ - Install `SIGCHLD` handler
+ - Call `waitpid(-1, ...)` in loop to reap zombies
+ - Log exit status, signal, and runtime duration per service
+- [ ] **TTY & login**
+ - Launch `getty` on configured TTYs (e.g. `tty1`–`tty6`)
+ - Support custom `getty` paths/args per TTY in config
+
+### System lifecycle control
+
+- [ ] Handle `reboot`, `halt`, `poweroff` via `vigilctl`
+- [ ] Properly terminate all services in reverse dependency order
+- [ ] Sync filesystems and unmount (best-effort)
+- [ ] Invoke `reboot(2)` / `halt(2)` syscalls directly
+
+### Signal handling
+
+- [ ] `SIGINT` / `SIGTERM` = graceful shutdown
+- [ ] `SIGUSR1` / `SIGUSR2` = reload config or trigger debug dump
+- [ ] Block all non-fatal signals during critical sections (e.g. mount)
diff --git a/init/src/mounts/fstab.rs b/init/src/mounts/fstab.rs
index 919607c..3ea62e5 100644
--- a/init/src/mounts/fstab.rs
+++ b/init/src/mounts/fstab.rs
@@ -163,10 +163,4 @@ impl FstabEntry {
Ok(())
}
- pub fn mount_from_fstab(entries: &[FstabEntry]) -> Result<(), Box<dyn std::error::Error>> {
- for entry in entries {
- entry.mount()?;
- }
- Ok(())
- }
} \ No newline at end of file
diff --git a/init/src/mounts/rescue.rs b/init/src/mounts/rescue.rs
index 11fa8fe..84517ed 100644
--- a/init/src/mounts/rescue.rs
+++ b/init/src/mounts/rescue.rs
@@ -1,4 +1,3 @@
-use libc::{self};
use std::ffi::CString;
use std::fs::create_dir;