From: Tom Hromatka Date: Thu, 17 Dec 2020 18:38:52 +0000 (-0700) Subject: api.c: Export cgroup_build_tasks_procs_path() X-Git-Tag: v2.0.rc1~14^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f4e01062a9f22ea960fb7a7c650f9fbfcc51624;p=thirdparty%2Flibcgroup.git api.c: Export cgroup_build_tasks_procs_path() Make cgroup_build_tasks_procs_path() available to libcgroup.la library users (i.e. the libcgroup tools). This change will be used in the next commit so that cgsnapshot can properly read the tasks/procs file. Signed-off-by: Tom Hromatka Reviewed-by: Dhaval Giani --- diff --git a/src/api.c b/src/api.c index c1ffdf57..11855be2 100644 --- a/src/api.c +++ b/src/api.c @@ -1501,18 +1501,9 @@ char *cg_build_path(const char *name, char *path, const char *type) return path; } -/** - * Build the path to the tasks or cgroup.procs file - * - * @param path Output variable that will contain the path. Must be - of size FILENAME_MAX or larger - * @param path_sz Size of the path string - * @param cg_name Cgroup name - * @param ctrl_name Controller name - */ -STATIC int cgroup_build_tasks_procs_path(char * const path, - size_t path_sz, const char * const cg_name, - const char * const ctrl_name) +int cgroup_build_tasks_procs_path(char * const path, + size_t path_sz, const char * const cg_name, + const char * const ctrl_name) { enum cg_version_t version; int err = ECGOTHER; diff --git a/src/libcgroup-internal.h b/src/libcgroup-internal.h index 5dcf7ee0..800227c0 100644 --- a/src/libcgroup-internal.h +++ b/src/libcgroup-internal.h @@ -307,6 +307,20 @@ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask); */ int cgroup_get_controller_version(const char * const controller, enum cg_version_t * const version); + +/** + * Build the path to the tasks or cgroup.procs file + * + * @param path Output variable that will contain the path. Must be + of size FILENAME_MAX or larger + * @param path_sz Size of the path string + * @param cg_name Cgroup name + * @param ctrl_name Controller name + */ +int cgroup_build_tasks_procs_path(char * const path, + size_t path_sz, const char * const cg_name, + const char * const ctrl_name); + /** * 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 @@ -343,10 +357,6 @@ int cgroup_chown_chmod_tasks(const char * const cg_path, int cgroupv2_subtree_control(const char *path, const char *ctrl_name, bool enable); -int cgroup_build_tasks_procs_path(char * const path, - size_t path_sz, const char * const cg_name, - const char * const ctrl_name); - int cgroupv2_get_subtree_control(const char *path, const char *ctrl_name, bool * const enabled); diff --git a/src/libcgroup.map b/src/libcgroup.map index 8fe19905..8b7fd6ad 100644 --- a/src/libcgroup.map +++ b/src/libcgroup.map @@ -129,3 +129,7 @@ CGROUP_0.41 { CGROUP_0.42 { cgroup_add_all_controllers; } CGROUP_0.41; + +CGROUP_0.43 { + cgroup_build_tasks_procs_path; +} CGROUP_0.42;