systemd-ml/README.md

48 lines
2.5 KiB
Markdown

# systemd-ml
`systemd-ml` provides `libsystemd`-like functionality for interacting with the systemd service
manager, in self-contained ocaml code (with a bit of C). `systemd-ml` is integrated with `eio`,
which provides for use in `eio`-based daemons
Unfortunately, `systemd-ml` currently assumes usage of the `eio_linux` backend. It's hard to make
code backend-agnostic because not enough functionality around Unix domain sockets is exposed by the
high-level `eio` APIs, necessitating use of the low-level backend APIs. Therefore, it does not
currently work on `eio_posix`, though future support is possible. Support for `eio_windows` is not
planned, since there is no systemd port for windows.
Additionally, some functionality that would be useful for systemd integration is currently not
possible without library patches. This currently includes functionality for responding to memory
pressure events.
- `systemd-ml` with entry module `Systemd` is the main library
- `systemd-ml.xlog` with entry module `Systemd_xlog` configures `xlog` to send log messages to
journald
- `systemd-ml.main` with entry module `Systemd_main` provdes a convenience function
`Systemd_main.run` which handles common boilerplate operations for `Type=notify` or
`Type=notify-reload` daemons with `xlog` output to journald
Also note that per the license field in the package info, this package is not currently open source.
If you have questions about this you should contact me
## Features
- detect
[systemd](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24SYSTEMD_EXEC_PID)
and
[journald](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24JOURNAL_STREAM)
presence
- [rich journald output](https://systemd.io/JOURNAL_NATIVE_PROTOCOL/) using `xlog`
- convenience functions to retrieve [directories passed by
systemd](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24RUNTIME_DIRECTORY)
- [service notifications](https://www.freedesktop.org/software/systemd/man/latest/sd_notify.html),
with wrapper functions for common notification types
- [fdstore](https://systemd.io/FILE_DESCRIPTOR_STORE/) functionality, and [socket
activation](https://www.freedesktop.org/software/systemd/man/latest/systemd.socket.html)
- [watchdog](https://www.freedesktop.org/software/systemd/man/latest/sd_watchdog_enabled.html)
notifications
features that would be nice to have but unfortunately require patches (eio does not currently
support polling for POLLPRI)
- [memory pressure](https://systemd.io/MEMORY_PRESSURE/)