package devkit
Development kit - general purpose library
Install
Dune Dependency
Authors
Maintainers
Sources
devkit-1.3.tbz
sha256=dae965685dceed47ad8e9844f12fe707dafdf2c3bdd46d0431d5b4d1e7754b23
sha512=b94ade804d751db87434042bbaa821fa8e82e233820a76806f910e2da040094b137e88a3579911a1626930912622b064c776ddbcb6991fb7111021ebf6553fdc
doc/src/devkit.core/systemd.ml.html
Source file systemd.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
open ExtLib let log = Log.from "systemd" module Daemon = struct (* https://github.com/systemd/systemd/blob/cb3108669d623afe58a36077e36ae4c66ff7d1c3/src/systemd/sd-daemon.h#L56 *) (* The first passed file descriptor is fd 3. *) let sd_listen_fds_start = 3 let booted = (* https://github.com/systemd/systemd/blob/cb31086/src/libsystemd/sd-daemon/sd-daemon.c#L607 *) try Unix.access "/run/systemd/system/" Unix.[F_OK]; true with Unix.Unix_error _ -> false let listen_pid = Option.map int_of_string (Sys.getenv_opt "LISTEN_PID") let listen_fds () : Unix.file_descr list = (* https://github.com/systemd/systemd/blob/cb31086/src/libsystemd/sd-daemon/sd-daemon.c#L42-L90 *) match booted with | false -> log#debug "listen_fds: not booted with systemd"; [] | true -> match listen_pid with | None -> log#debug "listen_fds: no LISTEN_PID"; [] | Some listen_pid -> let self_pid = Unix.getpid () in match listen_pid = self_pid with | false -> log#warn "listen_fds: LISTEN_PID %d and process pid %d are not equal, ignoring" listen_pid self_pid; [] | true -> let listen_fds = Option.map int_of_string (Sys.getenv_opt "LISTEN_FDS") in match listen_fds with | None -> log#warn "listen_fds: LISTEN_PID, but no LISTEN_FDS"; [] | Some n when n <= 0 -> log#warn "listen_fds: LISTEN_FDS %d is not positive" n; [] | Some n -> let fds = List.init n (fun x -> ExtUnixAll.file_descr_of_int (x + sd_listen_fds_start)) in List.iter Unix.set_close_on_exec fds; fds let listen_fds_lwt () = List.map Lwt_unix.of_unix_file_descr (listen_fds ()) end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>