25 lines
905 B
OCaml
25 lines
905 B
OCaml
include (val Xlog.logs __FUNCTION__)
|
|
|
|
open Eio.Std
|
|
|
|
let () = Eio_main.run @@ fun env ->
|
|
let clock = Eio.Stdenv.clock env in
|
|
Switch.run ~name:"main" @@ fun sw ->
|
|
if Systemd.is_journald_attached () then
|
|
Xlog.add_writer (Systemd_xlog.make_writer ~sw ~env) ~min_level:Xlog.DEBUG
|
|
else
|
|
Xlog.init_pretty_writer stdout ~min_level:Xlog.DEBUG;
|
|
|
|
info (fun m -> m "meow meow meow");
|
|
|
|
let fds = Systemd.Fdstore.listen_fds ~sw in
|
|
List.iter (fun (name, fd) -> Stdlib.Format.printf "got fd %a=%a\n%!" (Fmt.option ~none:(Fmt.any "<none>") Fmt.string) name Eio_unix.Fd.pp fd; Eio_linux.Low_level.writev fd [Cstruct.of_string "meow"]) fds;
|
|
|
|
let ctx = Systemd.Notify.make ~sw ~env in
|
|
info (fun m -> m "notifying!");
|
|
Systemd.Notify.ready ctx;
|
|
info (fun m -> m "performing barrier");
|
|
Systemd.Notify.barrier ctx;
|
|
info (fun m -> m "done");
|
|
Eio.Time.sleep clock 2.0
|