- C 87.9%
- Meson 12.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| core | ||
| daemon | ||
| data | ||
| include | ||
| .gitignore | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| meson.build | ||
| meson_options.txt | ||
| README.md | ||
Sanar V9nd
Note
Repository Mirrors
- git.nuros.org (sanarde/v9nd): primary, self-hosted Forgejo instance, accounts restricted to the core team.
- GitHub (sanarde/v9nd): mirror for external contributors. Issues and Pull Requests opened here are welcome and are reviewed and processed by the core team.
About
System settings daemon of SanarDE, named after Väinämöinen. It does not apply any setting itself and loads the modules that do.
Dependencies
- C17 compiler
- Meson (>= 1.0) and Ninja
- libcfgd, the client library of cfgd
- dlopen from the C library
Build
meson setup build
meson compile -C build
meson test -C build
meson install -C build
The install step puts v9nd in bin, the header v9nd/module.h and v9nd.pc in the usual places, the cfgd schema in share/cfgd/schemas and the autostart entry in <sysconfdir>/xdg/autostart. Modules are searched in <libdir>/v9nd. Use -Dmodule_dir=PATH to change it.
Running
v9nd runs one event loop with one connection to cfgd. Only one instance can run per session. v9nd -m DIR reads the modules from DIR.
The key modules of the cfgd schema org.nuros.sanar.v9n, path /org/nuros/sanar/v9n/, lists the names of the modules to load. A change applies without a restart: new names are loaded, removed names are stopped and unloaded. A module that cannot be loaded or started is reported on the standard error output and skipped.
cfgd set /org/nuros/sanar/v9n/modules 'keyboard;fonts'
A name has up to 63 characters of a-z, 0-9 and -, and does not start with -.
Modules
A module is a shared object NAME.so in the module directory. It exports one object named v9nd_module of type struct v9nd_module, see module.h:
apiisV9ND_MODULE_APIandnameisNAME.start(host, &instance)returns zero on success.stop(instance)releases everything the module holds.v9nd_host_cfgd(host)returns the cfgd connection of the daemon, which the module uses to read its keys.v9nd_host_subscribe(host, prefix, fn, user)subscribes to changes andv9nd_host_unsubscribe(host, id)removes the subscription. The daemon callscfgd_dispatch().v9nd_host_watch(host, fd, events, fn, user)adds a descriptor to the event loop,v9nd_host_unwatch(host, fd)removes it.
A module removes its subscriptions and descriptors in stop(). The ones it leaves behind are removed by the daemon and reported on the standard error output. Modules run inside the daemon and in its single thread, so a callback must not block. The daemon blocks SIGTERM and SIGINT, and a module that starts a process must reset the signal mask in it. Modules ship their own cfgd schemas. Compile with pkg-config --cflags v9nd and install to pkg-config --variable=moduledir v9nd.
Links
License
GPL-3.0-only. See LICENSE.