]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/networkd/main.c
networkd: Tell systemd about the daemon status
[people/ms/network.git] / src / networkd / main.c
index 14aafdd3cc175fe0294ff47d0630b551f88dd315..2429ff5ec5f5d14d6b37f64ffc17d173e70155ad 100644 (file)
 #                                                                             #
 #############################################################################*/
 
+#include <errno.h>
+#include <stdlib.h>
+
+#include <systemd/sd-daemon.h>
+#include <systemd/sd-event.h>
+
 int main(int argc, char** argv) {
-       return 0;
+       // XXX Drop privileges
+
+       // We are now ready to process any requests
+       sd_notify(0, "READY=1\n" "STATUS=Processing requests...");
+
+       // Run event loop
+       // XXX TODO
+
+       // Let systemd know that we are shutting down
+       sd_notify(0, "STOPPING=1\n" "STATUS=Shutting down...");
+
+       return EXIT_SUCCESS;
+
+ERROR:
+       sd_notifyf(0, "ERRNO=%i", errno);
+
+       return EXIT_FAILURE;
 }