1 /*
2  * Copyright (C) 2014 Luis R. Rodriguez <mcgrof@suse.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation; version 2.1 only. with the special
7  * exception on linking described in file LICENSE.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Lesser General Public License for more details.
13  */
14 
15 #include <string.h>
16 #include <stdio.h>
17 #include <stdbool.h>
18 #include <errno.h>
19 #include <caml/mlvalues.h>
20 #include <caml/memory.h>
21 #include <caml/alloc.h>
22 #include <caml/custom.h>
23 #include <caml/signals.h>
24 #include <caml/fail.h>
25 
26 #if defined(HAVE_SYSTEMD)
27 
28 #include <systemd/sd-daemon.h>
29 
30 #include "_paths.h"
31 
ocaml_sd_notify_ready(value ignore)32 CAMLprim value ocaml_sd_notify_ready(value ignore)
33 {
34 	CAMLparam1(ignore);
35 
36 	sd_notify(1, "READY=1");
37 
38 	CAMLreturn(Val_unit);
39 }
40 
41 #else
42 
ocaml_sd_notify_ready(value ignore)43 CAMLprim value ocaml_sd_notify_ready(value ignore)
44 {
45 	CAMLparam1(ignore);
46 
47 	CAMLreturn(Val_unit);
48 }
49 #endif
50