Finit was initially written by Claudio Matsuoka to act as a drop-in replacement for the Asus EeePC fastinit, “gaps filled with frog DNA” … Until I found Finit I had always been in awe of people venturing into the realm of PID 1, but learning from the simplicity of Claudio’s code I slowly began understanding what it was all about.
Finit is open sourced under the very liberal MIT/X11 license. Much of the code has proven extremely useful to me in other projects over the years. It takes a while to realize, but there are actually a lot of APIs missing in the C library and Finit has helped me bridge that gap in a lot of projects.
Recently I broke out the most generic pieces from Finit into a separate
library, which I call libite, (because it looks fun when linking
-lite), and complemented it with a few pieces of my own and
some from the OpenBSD project, most notably their famous string
functions: strlcpy(3) and strlcat(3). It also holds the
very useful *BSD linked list API sys/queue.h, which is a much more
up to date version than GLIBC carries! GLIBC does not have the
macros for traversing lists while deleting/freeing nodes.
To make use of
-lite and its APIs you can add
libite as a GIT
submodule to your project:
git submodule add https://github.com/troglobit/libite.git
You then need to add
#include "libite/lite.h" to the source and adapt
your Makefile slightly to call the
libite/Makefile before linking the
all: $(EXEC) libite/libite.a libite/libite.a: Makefile @$(MAKE) STATIC=1 -C libite $(EXEC): $(OBJS) libite/libite.a @gcc -o $@ $^