From: Goffredo Baroncelli Date: Mon, 10 Nov 2025 21:58:25 +0000 (+0100) Subject: libsystemd: add new type SD_PATH_SEARCH_SYSCTL for sd_path_lookup* X-Git-Tag: v259-rc1~94^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=457a39a866a765c9c0b1aef3279c1dfa5266bdcc;p=thirdparty%2Fsystemd.git libsystemd: add new type SD_PATH_SEARCH_SYSCTL for sd_path_lookup* Add the new type SD_PATH_SEARCH_SYSCTL to libsystemd. With this new type sd_path_lookup() and sd_path_lookup_strv() will return the paths used by systemd-sysctl(1) to search the .conf files: /etc/sysctl.d/ /run/sysctl.d/ /usr/local/lib/sysctl.d/ /usr/lib/sysctl.d/ Refer to sysctl.d(5) man page. Note: the old type SD_PATH_SYSCTL is still available, and returns the last path (/usr/lib/sysctl.d/). --- diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml index fc6bac640c9..8fe04ae8af8 100644 --- a/man/sd_path_lookup.xml +++ b/man/sd_path_lookup.xml @@ -76,6 +76,7 @@ SD_PATH_SEARCH_CONFIGURATION_FACTORY, SD_PATH_SEARCH_STATE_FACTORY, SD_PATH_SEARCH_CONFIGURATION, + SD_PATH_SEARCH_SYSCTL, SD_PATH_SYSTEMD_UTIL, SD_PATH_SYSTEMD_SYSTEM_UNIT, diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index 00969971353..e3877fff4a9 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -683,7 +683,11 @@ static int get_search(uint64_t type, char ***ret) { *ret = TAKE_PTR(l); return 0; - }} + } + + case SD_PATH_SEARCH_SYSCTL: + return strv_from_nulstr(ret, CONF_PATHS_NULSTR("sysctl.d")); + } return -EOPNOTSUPP; } diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h index eb42e31a689..3199996011a 100644 --- a/src/systemd/sd-path.h +++ b/src/systemd/sd-path.h @@ -129,6 +129,8 @@ __extension__ enum { SD_PATH_USER_CREDENTIAL_STORE_ENCRYPTED, SD_PATH_USER_SEARCH_CREDENTIAL_STORE_ENCRYPTED, + SD_PATH_SEARCH_SYSCTL, + _SD_PATH_MAX, _SD_PATH_INVALID = UINT64_MAX };