]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libsystemd: add new type SD_PATH_SEARCH_SYSCTL for sd_path_lookup*
authorGoffredo Baroncelli <kreijack@inwind.it>
Mon, 10 Nov 2025 21:58:25 +0000 (22:58 +0100)
committerGoffredo Baroncelli <kreijack@inwind.it>
Mon, 10 Nov 2025 21:58:25 +0000 (22:58 +0100)
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/).

man/sd_path_lookup.xml
src/libsystemd/sd-path/sd-path.c
src/systemd/sd-path.h

index fc6bac640c9fcd17c7e1c1402151f09f6b860e50..8fe04ae8af84681f554b535010387ee4f1172591 100644 (file)
@@ -76,6 +76,7 @@
         <constant>SD_PATH_SEARCH_CONFIGURATION_FACTORY</constant>,
         <constant>SD_PATH_SEARCH_STATE_FACTORY</constant>,
         <constant>SD_PATH_SEARCH_CONFIGURATION</constant>,
+        <constant>SD_PATH_SEARCH_SYSCTL</constant>,
 
         <constant>SD_PATH_SYSTEMD_UTIL</constant>,
         <constant>SD_PATH_SYSTEMD_SYSTEM_UNIT</constant>,
index 0096997135357a6e55f0453cde88ae535e713151..e3877fff4a99f6406a34b7ddd54f8a3ed50f5b90 100644 (file)
@@ -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;
 }
index eb42e31a689ccf39bf6ed17ce16982d16cb29b8a..3199996011aa058a1b443f0b330bc6a9d1b12bf5 100644 (file)
@@ -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
 };