From: Tom Hromatka Date: Mon, 8 Feb 2021 22:58:44 +0000 (-0700) Subject: api.c: Expose cgroup_fill_cgc() to users of libcgroup.la X-Git-Tag: v2.0.rc1~10^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2756943c673bd74a9d8ce8e3eaf8f244778cc67c;p=thirdparty%2Flibcgroup.git api.c: Expose cgroup_fill_cgc() to users of libcgroup.la Remove the static qualifier from cgroup_fill_cgc(). As part of the cgget refactor, cgget will utilize this function. Signed-off-by: Tom Hromatka --- diff --git a/src/api.c b/src/api.c index ac500861..bdb5b21d 100644 --- 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; diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h index c152b687..eef54442 100644 --- a/src/libcgroup-internal.h +++ b/src/libcgroup-internal.h @@ -19,6 +19,7 @@ __BEGIN_DECLS #include "config.h" +#include #include #include #include @@ -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 diff --git a/src/libcgroup.map b/src/libcgroup.map index fbb4530a..f7cc710a 100644 --- a/src/libcgroup.map +++ b/src/libcgroup.map @@ -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;