finit2

Source files

Main code

The implementation of finit can be divided into two parts:

  1. The logic of calculating dependencies, starting and stopping units.
  2. The implementation of the units. Most of this is parsing the systemd-style service files (which is not as trivial as one might suspect), and also actually doing what needs to be done to start and stop the services.
The interface between these parts is fully defined in unit.h.

depend.[ch]A dependency set.
exec.[ch]Information about commands to be executed.
finit.cMain source file.
finit.fidlDescription of the communication between telfinit and finit. It is used for autogenerating the IPC code with fidl-codegen.
log.[ch]Logging to syslog, kmsg or the console.
notify.[ch]The systemd notification protocol.
runlevel.[ch]The main logic for finit. Calculate dependencies, start and stop units.
service.[ch]A systemd style service unit.
target.[ch]A target unit.
telfinit.cTelfinit is a tool for communicating with finit.
unit.[ch]Common unit code.
finit_code_overview depend depend arr arr depend->arr exec exec listif listif exec->listif str str exec->str timeutil timeutil exec->timeutil finit finit finit_fidl finit.fidl finit->finit_fidl runlevel runlevel finit->runlevel unit unit finit->unit loop_fipc loop-fipc finit->loop_fipc loop loop finit->loop log log log->timeutil strutil strutil log->strutil notify notify notify->loop hashmap hashmap notify->hashmap runlevel->unit service service service->exec service->notify loop_child loop-child service->loop_child inifile inifile service->inifile fileline fileline service->fileline target_ target target_->strutil target_->inifile telfinit telfinit telfinit->finit_fidl unit->depend unit->log unit->service unit->target_ dagif dagif unit->dagif loop_fipc->loop loop_child->loop

Utilities

These utility functions do not depend on anything specific to finit.

arr.[ch]Generic array.
dagif.[ch]Generic implementation of a Directed Acyclic Graph. Used here for calculating start and stop order of services.
debug.hSome macros for debugging.
fileline.[ch]Read a text file (or a memory chunk) line by line without copy.
hashmap.[ch]Generic hash map implementation.
heap.[ch]Generic heap (sorted queue) implementation.
inifile.[ch]Read an ini-style file without copy.
listif.[ch]Generic double linked list implementation.
loop.[ch]Main eventloop that handles file events, time and Unix signals.
loop-child.[ch]Adding child exit events to the main loop.
loop-fipc.[ch]Integrate auto-generated code for FIPC with the eventloop.
sig.[ch]Generic implementation of subscribable signals. In this case it happens to be used for Unix signals, but the two should otherwise not be confused.
str.[ch]String type that avoids copying data then possible.
strutil.[ch]A few string related utility functions.
timeutil.[ch]A few time related utility functions.
tokenize.[ch]A function for tokenizing a text string based several different sets of rules.
utf8.[ch]A few UTF8 related utility functions.
finit_code_overview arr arr dagif dagif dagif->arr fileline fileline hashmap hashmap heap heap inifile inifile inifile->fileline str str inifile->str strutil strutil inifile->strutil utf8 utf8 inifile->utf8 listif listif loop loop loop->heap sig sig loop->sig loop_child mainloop-child loop_child->loop loop_fipc eventloop-fipc loop_fipc->loop sig->listif tokenize tokenize tokenize->str tokenize->utf8