]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/libsystemd/sd-path/sd-path.c
path: show various systemd directories and search paths too
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 24 Mar 2020 15:04:50 +0000 (16:04 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Mar 2020 19:12:45 +0000 (20:12 +0100)
commit9c5bb2033db0c0927593b929ff760b69295a9f70
tree0580eaaf44600f2562bdabd53c8ee981879fef95
parentce7eb6aa84b24d411ede7ed570faba78ee084493
path: show various systemd directories and search paths too

So far we had various ad hoc APIs to query search paths:
systemd-analyze unit-paths, lookup_paths_log(), the pkgconfig file,
debug logs emitted by systemd-analyze cat-config.
But answering a simple question "what is the search path for tmpfiles,
sysusers, .network files, ..." is surprisingly hard.

I think we should have an api that makes it easy to query this. Pkgconfig is
not bad, but it is primarily a development tool, so it's not available in many
context. Also it can't provide support for paths which are influenced by
environment variables, and I'd like to be able to answer the question "what is
the search path for ..., assuming that VAR_FOO=... is set?".

Extending sd-path to support more of our internal paths seems to be most
flexible solution. We already have systemd-path which provides a nice
way to query, and we can add stuff like optional descriptions later on.
We we essentially get a nice programmatic and commmandline apis for the price
of one.
man/sd_path_lookup.xml
src/libsystemd/sd-path/sd-path.c
src/path/path.c
src/systemd/sd-path.h