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)32CAMLprim value ocaml_sd_notify_ready(value ignore) 33 { 34 CAMLparam1(ignore); 35 CAMLlocal1(ret); 36 37 ret = Val_int(0); 38 39 sd_notify(1, "READY=1"); 40 41 CAMLreturn(ret); 42 } 43 44 #else 45 ocaml_sd_notify_ready(value ignore)46CAMLprim value ocaml_sd_notify_ready(value ignore) 47 { 48 CAMLparam1(ignore); 49 CAMLlocal1(ret); 50 51 ret = Val_int(-1U); 52 53 CAMLreturn(ret); 54 } 55 #endif 56