nix-processmgmt/webapp
Sander van der Burg c69248bb7c Fix function pointer warning 2021-02-09 21:31:44 +01:00
..
Makefile Initial commit 2020-01-28 00:25:18 +01:00
README.md Initial commit 2020-01-28 00:25:18 +01:00
daemonize.c Add copyright headers 2020-05-05 23:45:20 +02:00
daemonize.h Add copyright headers 2020-05-05 23:45:20 +02:00
default.nix Initial commit 2020-01-28 00:25:18 +01:00
main.c Add copyright headers 2020-05-05 23:45:20 +02:00
service.c Fix function pointer warning 2021-02-09 21:31:44 +01:00
service.h Add copyright headers 2020-05-05 23:45:20 +02:00

README.md

Test web application

This is a very simple test web application that can run in foreground mode and daemon mode. Its only purpose is to return a very simple static HTML page.

The most interesting part of this example is probably the daemonize infrastructure (daemonize.h, daemonize.c) -- I have been trying to closely follow systemd's recommendations for implementing traditional SysV daemons (more info:man 7 daemon) sticking myself to POSIX standards as much as possible.

To keep the code as clear as possible, I have encapsulated each recommended step into a function abstraction, and every failure yields a distinct error code so that we can easily trace the origins of the error.

The daemonize infrastructure is very generic -- you only need to provide a pointer to a function that initializes the daemon's state and a pointer to a function that runs the main loop.