blob: c53af4c265cda78a046d2f1273950854ec692be4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# vigil
## Philosophy
- Never drop into an emergency shell for non-critical failures (e.g. non-root filesystem mount failure).
- All issues should be logged.
- Configuration via declarative TOML unit files. _(just like in systemd, but without the extra bloatware. Objectively, it is convenient to write services for systemd)_
## Implementation Roadmap
### Early system setup
- [x] Mount essential filesystems (`/proc`, `/sys`, `/dev` via `devtmpfs`).
- [x] Spawn `udev` (or compatible device manager) as child process.
- [x] Mount user-defined filesystems from `/etc/fstab` (non-fatal on failure = log & continue).
- [x] Activate `swap` (non-fatal on failure).
- [x] Set hostname, timezone, and locale from config.
- [x] 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)
|