Refactorings.
[oweals/dinit.git] / TODO
1 * CPBuffer: cleanup methods a bit (fix API)
2 * When a PROCESS service process dies, and smooth_recovery is false, probably
3   need to force-stop dependents even if the process itself was stopped
4   deliberately.
5 * Complete control socket handling and protocol
6   - support for pinned-start and pinned-stop
7   - support for listing all services
8 * Implement a control utility to start/stop services after dinit has started
9   - very basic version exists, needs thorough cleanup
10 * We've replaced libev, so that we don't abort on failure. But now exceptions
11   can be thrown when we register an event watch - need to handle these.
12
13 For version 1.0:
14 ----------------
15 * Log messages need to be duplicated to file (or to a logging process) once the
16   file system comes up read/write.
17 * Log messages are completely prevented from going to the console if the console
18   is being held by a service, meaning some can get lost. It would be better if
19   there was a (limited) buffer.
20 * Perhaps need a way to prevent script services from re-starting.
21   (eg there's no need to mount filesystems twice; there might be various other
22    system initialisations that can't or shouldn't really be "undone" and so do
23    not need to be re-done).
24 * Documentation including sample service definitions
25 * Better error handling, logging of errors (largely done, still some patches
26   of code where it may be missing).
27 * Write wtmp entry on startup (see simpleinit)
28 * Allow running services as a different UID
29 * On linux when running with PID != 1, write PID to /proc/sys/kernel/cad_pid so
30   that we still receive SIGINT from ctrl+alt+del (must be done after /proc is
31   mounted, possibly could be left to a service script)
32
33 For later:
34 * Internationalisation
35 * A service can prevent shutdown/reboot by failing to stop. Maybe make
36   multiple CTRL-ALT-DEL presses (or ^C since that's more portable) commence
37   immediate shutdown (or launch a simple control interface).
38 * Interruptible scripted services - where it's ok to terminate the start
39   script with a signal (and return the service to the STOPPED state). So a long-
40   running filesystem check, for instance, need not hold up shutdown.
41 * When we take down a service or tty session, it would be ideal if we could kill
42   the whole process tree, not just the leader process.
43 * Investigate using cn_proc netlink connector (cn_proc.h) to receive process
44   termination events even when running with PID != 1 (Linux only).
45   Also, there is the possibility of having a small, simple PID-1 init which
46   sends terminated process IDs over a pipe to Dinit. Finally, it may be possible
47   to run dinit (and subprocesses) in a new PID namespace (again linux-only).
48 * Allow logging tasks to memory (growing or circular buffer) and later
49   switching to disk logging (allows for filesystem mounted readonly on boot).
50   But perhaps this really the responsibility of another daemon.
51 * Rate control on process respawn
52 * Allow running services with different resource limits, chroot, cgroups,
53   namespaces (pid/fs/uid), etc
54 * Make default control socket location build-time configurable
55 * Allow specifying a timeout for killing services; if they don't die within
56   the timeout (after a TERM) then hit them with a KILL.
57
58 Even later / Maybe never:
59 * Support recognising /etc/init.d services automatically (as script services, with
60   no dependency management - or upstart compatible dependency management)
61   Also BSD's rc.d style scripts (PROVIDE, REQUIRE).
62 * Place some reasonable, soft limit on the number of services to be started
63   simultaneously, to prevent thrashing. Services that are taking a long time
64   to start don't count to the limit. Maybe use CPU/IO usage as a controlling
65   factor.
66 * Cron-like tasks (if started, they run a sub-task periodically. Stopping the
67   task will wait until the sub-task is complete). 
68 * Allow to run services attached to virtual tty, allow connection to that tty (ala "screen").
69 * SystemD-like handling of filesystem mounts (see autofs documentation in kernel)
70   i.e. a mount point gets an autofs attached, and lazily gets mounted when accessed
71   (or is mounted in parallel). Probably put the functionality in a separate daemon.
72
73
74 Documentation:
75 * Design philosophy/rationale document
76 * Coding style guidelines
77
78 * What's the best TERM setting? gogetty gives me "linux" but I think other variants may be
79   better (eg "linux-c").
80
81 * Figure out the ConsoleKit/logind / PolicyKit mess & how dinit needs to fit into it.
82   * Consolekit/logind tracks "sessions". Provides a mechanism to mark a session starting,
83     associates processes with sessions, provides calls to terminate sessions etc (why?!!)
84     Can use environment variable or cgroups to track processes in a session.
85     A PAM module exists to create/destroy sessions.
86   * Consolekit/logind also allows for requesting shutdown, reboot, and inhibiting reboot
87     (via dbus API).
88   * "seats" are a set of input/output hardware (mouse/keyboard/monitor) on which a session
89     can be run. You can have multiple sessions on a seat - one is in the foreground
90     (eg linux virtual ttys implement multiple sessions on a single seat).
91     Sessions can run without a seat (eg ssh session).