Add systemd notify support
[src/drm-lease-manager.git] / drm-lease-manager / main.c
index b4ad379..5ac3600 100644 (file)
@@ -13,6 +13,7 @@
  * limitations under the License.
  */
 
+#include "config.h"
 #include "lease-config.h"
 #include "lease-manager.h"
 #include "lease-server.h"
 #include <stdlib.h>
 #include <unistd.h>
 
+#ifdef HAVE_SYSTEMD_DAEMON
+#include <systemd/sd-daemon.h>
+#endif
+
 static void usage(const char *progname)
 {
        printf("Usage: %s [OPTIONS] [<DRM device>]\n\n"
@@ -107,6 +112,10 @@ int main(int argc, char **argv)
                return EXIT_FAILURE;
        }
 
+#ifdef HAVE_SYSTEMD_DAEMON
+       sd_notify(1, "READY=1");
+#endif
+
        struct ls_req req;
        while (ls_get_request(ls, &req)) {
                switch (req.type) {