]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api: Expose cg_build_path_locked() to users of libcgroup.la
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 8 Feb 2021 22:48:54 +0000 (15:48 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 1 Mar 2021 17:32:39 +0000 (10:32 -0700)
Remove the static qualifier from cg_build_path_locked().  As part
of the cgget refactor, cgget will utilize this function.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/api.c
src/libcgroup-internal.h
src/libcgroup.map

index 51f9075f75954594a0aabd1c0a7216509d0cf828..ac500861bd72a62191404c68bec02093ad472cf9 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -1460,8 +1460,8 @@ static char *cg_concat_path(const char *pref, const char *suf, char *path)
 
 /* Call with cg_mount_table_lock taken */
 /* path value have to have size at least FILENAME_MAX */
-static char *cg_build_path_locked(const char *name, char *path,
-                                               const char *type)
+char *cg_build_path_locked(const char *name, char *path,
+                          const char *type)
 {
        int i;
        for (i = 0; cg_mount_table[i].name[0] != '\0'; i++) {
index 800227c0c86cdd1616e875d09651ffe66b01236c..c152b6872c23993af179d40c13036fe07f1583ef 100644 (file)
@@ -321,6 +321,20 @@ int cgroup_build_tasks_procs_path(char * const path,
                                  size_t path_sz, const char * const cg_name,
                                  const char * const ctrl_name);
 
+/**
+ * Build the full path to the controller/setting
+ *
+ * @param setting Cgroup virtual filename/setting (optional)
+ * @param path Output variable to contain the concatenated path
+ * @param controller Cgroup controller name
+ *
+ * @return If successful, a valid pointer to the concatenated path
+ *
+ * @note The cg_mount_table_lock must be held prior to calling this function
+ */
+char *cg_build_path_locked(const char *setting, char *path,
+                          const char *controller);
+
 /**
  * Functions that are defined as STATIC can be placed within the UNIT_TEST
  * ifdef.  This will allow them to be included in the unit tests while
index 8b7fd6ad13c8883a2ee31e467f4b88b71e8e4a8b..fbb4530a6a04e8d80b130ad16e0178b14db0b5d9 100644 (file)
@@ -132,4 +132,5 @@ CGROUP_0.42 {
 
 CGROUP_0.43 {
        cgroup_build_tasks_procs_path;
+       cg_build_path_locked;
 } CGROUP_0.42;