<
libpid0 index
/c/libpid0/

libpid0

libpid0 is a tiny Linux PID 1 helper for C programs that need to run as init inside a FROM scratch container or as PID 1 on a bare VM.

If the current process is not PID 1, pid0_run() just calls your submain with argc/argv and returns its exit code.

If the current process is PID 1, pid0_run():

Public ABI

#include <pid0/pid0.h>

static int submain(int argc, char **argv) {
  (void)argc;
  (void)argv;
  return 0;
}

int main(int argc, char **argv) {
  return pid0_run(submain, argc, argv);
}

You find the source code at https://github.com/sa6mwa/libpid0.

NameType
..parent
v0.1.0/directory
v0.3.0/directory