*)
external sd_listen_fds: string -> Unix.file_descr = "ocaml_sd_listen_fds"
-external sd_booted: unit -> bool = "ocaml_sd_booted"
+external launched_by_systemd: unit -> bool = "ocaml_launched_by_systemd"
external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
* us do sanity checks on the expected sockets *)
val sd_listen_fds: string -> Unix.file_descr
-(** Tells us whether or not systemd support was compiled in *)
-val sd_booted: unit -> bool
+(** Tells us whether the process is launched by systemd *)
+val launched_by_systemd: unit -> bool
(** Tells systemd we're ready *)
external sd_notify_ready: unit -> unit = "ocaml_sd_notify_ready"
CAMLreturn(sock_ret);
}
-CAMLprim value ocaml_sd_booted(value ignore)
+CAMLprim value ocaml_launched_by_systemd(value ignore)
{
CAMLparam1(ignore);
CAMLlocal1(ret);
ret = Val_false;
- if (sd_booted())
+ if (sd_listen_fds(0) > 0)
ret = Val_true;
CAMLreturn(ret);
CAMLreturn(sock_ret);
}
-CAMLprim value ocaml_sd_booted(value ignore)
+CAMLprim value ocaml_launched_by_systemd(value ignore)
{
CAMLparam1(ignore);
CAMLlocal1(ret);
sock
let create_unix_socket name =
- if Systemd.sd_booted() then
+ if Systemd.launched_by_systemd() then
Systemd.sd_listen_fds name
else
create_regular_unix_socket name
while not !quit
do
try
- if Systemd.sd_booted() then
+ if Systemd.launched_by_systemd() then
Systemd.sd_notify_ready ();
main_loop ()
with exc ->