]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
api.c: Expose cgroup_fill_cgc() to users of libcgroup.la
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 8 Feb 2021 22:58:44 +0000 (15:58 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 1 Mar 2021 17:32:46 +0000 (10:32 -0700)
Remove the static qualifier from cgroup_fill_cgc().  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 ac500861bd72a62191404c68bec02093ad472cf9..bdb5b21da1df946f3b9871ee3513369bed034789 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -2965,8 +2965,8 @@ static int cg_rd_ctrl_file(const char *subsys, const char *cgroup,
 /*
  * Call this function with required locks taken.
  */
-static int cgroup_fill_cgc(struct dirent *ctrl_dir, struct cgroup *cgroup,
-                       struct cgroup_controller *cgc, int cg_index)
+int cgroup_fill_cgc(struct dirent *ctrl_dir, struct cgroup *cgroup,
+                   struct cgroup_controller *cgc, int cg_index)
 {
        char *ctrl_name = NULL;
        char *ctrl_file = NULL;
index c152b6872c23993af179d40c13036fe07f1583ef..eef54442674b28e977c900f52456ce907c187249 100644 (file)
@@ -19,6 +19,7 @@
 __BEGIN_DECLS
 
 #include "config.h"
+#include <dirent.h>
 #include <fts.h>
 #include <libcgroup.h>
 #include <limits.h>
@@ -335,6 +336,20 @@ int cgroup_build_tasks_procs_path(char * const path,
 char *cg_build_path_locked(const char *setting, char *path,
                           const char *controller);
 
+/**
+ * Given a cgroup controller and a setting within it, populate the setting's
+ * value
+ *
+ * @param ctrl_dir dirent representation of the setting, e.g. memory.stat
+ * @param cgroup current cgroup
+ * @param cgc current cgroup controller
+ * @param cg_index Index into the cg_mount_table of the cgroup
+ *
+ * @note The cg_mount_table_lock must be held prior to calling this function
+ */
+int cgroup_fill_cgc(struct dirent *ctrl_dir, struct cgroup *cgroup,
+                   struct cgroup_controller *cgc, int cg_index);
+
 /**
  * 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 fbb4530a6a04e8d80b130ad16e0178b14db0b5d9..f7cc710a27a30b3ed4c38186998a0b831099d4a7 100644 (file)
@@ -133,4 +133,5 @@ CGROUP_0.42 {
 CGROUP_0.43 {
        cgroup_build_tasks_procs_path;
        cg_build_path_locked;
+       cgroup_fill_cgc;
 } CGROUP_0.42;