From: drakenclimber Date: Tue, 22 Oct 2024 16:27:26 +0000 (+0000) Subject: deploy: 60fa9374b69a82465c01c518cb465ea8fc7d8ea4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c838ce466cd93c2b49f766c20e23dd4663e3b660;p=thirdparty%2Flibcgroup.git deploy: 60fa9374b69a82465c01c518cb465ea8fc7d8ea4 --- diff --git a/config_8h_source.html b/config_8h_source.html index c1b1f333..5259226d 100644 --- a/config_8h_source.html +++ b/config_8h_source.html @@ -112,21 +112,18 @@ $(document).ready(function() { init_codefold(0); });
95int cgroup_load_templates_cache_from_files(int *file_index);
96
102struct cgroup_string_list;
-
103void cgroup_templates_cache_set_source_files(
-
104 struct cgroup_string_list *tmpl_files);
-
105
-
126int cgroup_config_create_template_group(
-
127 struct cgroup *cgroup, char *template_name,
-
128 int flags);
-
129
-
134#ifdef __cplusplus
-
135} /* extern "C" */
-
136#endif
-
137
-
138#endif /*_LIBCGROUP_CONFIG_H*/
+
103void cgroup_templates_cache_set_source_files(struct cgroup_string_list *tmpl_files);
+
104
+
125int cgroup_config_create_template_group(struct cgroup *cgrp, char *template_name, int flags);
+
126
+
131#ifdef __cplusplus
+
132} /* extern "C" */
+
133#endif
+
134
+
135#endif /*_LIBCGROUP_CONFIG_H*/
int cgroup_config_set_default(struct cgroup *new_default)
Definition config.c:1590
+
int cgroup_config_create_template_group(struct cgroup *cgrp, char *template_name, int flags)
Definition config.c:1862
int cgroup_init_templates_cache(char *pathname)
Definition config.c:1668
-
int cgroup_config_create_template_group(struct cgroup *cgroup, char *template_name, int flags)
Definition config.c:1862
int cgroup_unload_cgroups(void)
Definition config.c:1503
int cgroup_reload_cached_templates(char *pathname)
Definition config.c:1613
int cgroup_config_load_config(const char *pathname)
Definition config.c:1217
diff --git a/error_8h_source.html b/error_8h_source.html index eac0e701..bc65d191 100644 --- a/error_8h_source.html +++ b/error_8h_source.html @@ -143,8 +143,8 @@ $(document).ready(function() { init_codefold(0); });
109#endif
110
111#endif /* _LIBCGROUP_INIT_H */
-
int cgroup_get_last_errno(void)
Definition api.c:5182
-
const char * cgroup_strerror(int code)
Definition api.c:5161
+
int cgroup_get_last_errno(void)
Definition api.c:5168
+
const char * cgroup_strerror(int code)
Definition api.c:5147
@ ECGROUPMULTIMOUNTED
Definition error.h:40
@ ECGEOF
Definition error.h:68
@ ECGNOVERSIONCONVERT
Definition error.h:79
diff --git a/group__group__config.html b/group__group__config.html index d5286d77..eda626f6 100644 --- a/group__group__config.html +++ b/group__group__config.html @@ -93,13 +93,13 @@ $(function() {   void cgroup_templates_cache_set_source_files (struct cgroup_string_list *tmpl_files)   -int cgroup_config_create_template_group (struct cgroup *cgroup, char *template_name, int flags) -  +int cgroup_config_create_template_group (struct cgroup *cgrp, char *template_name, int flags) + 

Detailed Description

Function Documentation

- -

◆ cgroup_config_create_template_group()

+ +

◆ cgroup_config_create_template_group()

@@ -108,7 +108,7 @@ $(function() { int cgroup_config_create_template_group ( struct cgroup *  - cgroup, + cgrp, @@ -129,7 +129,7 @@ $(function() {
-

Physically create a new control group in kernel, based on given control group template and configuration file. If given template is not set in configuration file, then the procedure works create the control group using cgroup_create_cgroup() function

+

Physically create a new control group in kernel, based on given control group template and configuration file. If given template is not set in configuration file, then the procedure works create the control group using cgroup_create_cgroup() function

Templates are loaded using cgroup_load_templates_cache_from_files function, which must be preceded by cgroup_templates_cache_set_source_files call.

The flags can alter the behavior of this function: CGFLAG_USE_TEMPLATE_CACHE: Use cached templates instead of parsing the config file

Parameters
@@ -184,7 +184,7 @@ $(function() {

Sets default permissions of groups created by subsequent cgroup_config_load_config() calls. If a config file contains a 'default {}' section, the default permissions from the config file is then used.

-

Use cgroup_new_cgroup() to create a dummy group and cgroup_set_uid_gid() and cgroup_set_permissions() to set its permissions. Use NO_UID_GID instead of GID/UID and NO_PERMS instead of file/directory permissions to let kernel decide the default permissions where you don't want specific user and/or permissions. Kernel then uses current user/group and permissions from umask then.

+

Use cgroup_new_cgroup() to create a dummy group and cgroup_set_uid_gid() and cgroup_set_permissions() to set its permissions. Use NO_UID_GID instead of GID/UID and NO_PERMS instead of file/directory permissions to let kernel decide the default permissions where you don't want specific user and/or permissions. Kernel then uses current user/group and permissions from umask then.

Parameters
diff --git a/group__group__groups.html b/group__group__groups.html index 51909f33..0517c04d 100644 --- a/group__group__groups.html +++ b/group__group__groups.html @@ -84,7 +84,7 @@ Data Structures
new_defaultNew default permissions from this group are copied to libcgroup internal structures. I.e., this group can be freed immediately after this function returns.
freezer:/foo
I.e. there is cpu and cpuacct controller mounted together in one hierarchy, with foo and bar groups. In addition, freezer is mounted as separate hierarchy, with only one foo group.
Following code creates struct cgroup* structure, which represents one group cpu,cpuacct:/foo:
struct cgroup *foo = cgroup_new_cgroup("foo");
- -
struct cgroup_controller * cgroup_add_controller(struct cgroup *cgroup, const char *name)
Definition wrapper.c:61
+ +
struct cgroup_controller * cgroup_add_controller(struct cgroup *cgrp, const char *name)
Definition wrapper.c:61
struct cgroup * cgroup_new_cgroup(const char *name)
Definition wrapper.c:43
Definition libcgroup-internal.h:121
-
Now, you can call e.g. cgroup_delete_cgroup() and the group is deleted from the hierarchy. You can note that it's enough to add only one controller to the group to fully identify a group in cpu,cpuacct hierarchy.
+ Now, you can call e.g. cgroup_delete_cgroup() and the group is deleted from the hierarchy. You can note that it's enough to add only one controller to the group to fully identify a group in cpu,cpuacct hierarchy.
Following code creates struct cgroup* structure, which represents two groups, cpu,cpuacct:/foo and freezer:/foo:
struct cgroup *foo = cgroup_new_cgroup("foo");
- -
cgroup_add_controller(foo, "freezer");
-
Now, if you call e.g. cgroup_delete_cgroup(), the group gets deleted from both hierarchies.
+ +
cgroup_add_controller(foo, "freezer");
+ Now, if you call e.g. cgroup_delete_cgroup(), the group gets deleted from both hierarchies.
Todo:
add some propaganda what's so great on this approach... I personally think it is broken and confusing (see TODOs below).

Following functions are provided to create/destroy various libcgroup structures. Please note that none of these functions actually create or delete a cgroup in kernel!

- - - - - - - - - - + + + + + + + + + + @@ -125,37 +125,37 @@ Data Structures - - - - - - - - - - + + + + + + + + + +

Basic infrastructure

struct cgroup* is the heart of libcgroup API. The structure is opaque to applications, all access to the structure is through appropriate functions.

-

The most important information is that one struct cgroup* can represent zero, one or more real control groups in kernel. The struct cgroup* is identified by name of the group, which must be set by cgroup_new_cgroup(). Multiple controllers (aka subsystems) can be attached to one struct cgroup* using cgroup_add_controller(). These controllers can belong to different hierarchies.

+

The most important information is that one struct cgroup* can represent zero, one or more real control groups in kernel. The struct cgroup* is identified by name of the group, which must be set by cgroup_new_cgroup(). Multiple controllers (aka subsystems) can be attached to one struct cgroup* using cgroup_add_controller(). These controllers can belong to different hierarchies.

This approach is different to the one in the Linux kernel - a control group must be part of exactly one hierarchy there. In libcgroup, a group can be part of multiple hierarchies, as long as the group name is the same.

Example:
Let there be following control groups:
cpu,cpuacct:/
cpu,cpuacct:/foo
@@ -93,30 +93,30 @@ Data Structures
struct cgroupcgroup_new_cgroup (const char *name)
 
struct cgroup_controllercgroup_add_controller (struct cgroup *cgroup, const char *name)
 
int cgroup_add_all_controllers (struct cgroup *cgroup)
 
struct cgroup_controllercgroup_get_controller (struct cgroup *cgroup, const char *name)
 
void cgroup_free (struct cgroup **cgroup)
 
void cgroup_free_controllers (struct cgroup *cgroup)
 
struct cgroup_controllercgroup_add_controller (struct cgroup *cgrp, const char *name)
 
int cgroup_add_all_controllers (struct cgroup *cgrp)
 
struct cgroup_controllercgroup_get_controller (struct cgroup *cgrp, const char *name)
 
void cgroup_free (struct cgroup **cgrp)
 
void cgroup_free_controllers (struct cgroup *cgrp)
 
#define NO_PERMS   (-1U)
 
#define NO_UID_GID   (-1U)

Group manipulation API

Using following functions you can create and remove control groups and change their parameters.

Note
All access to kernel is through previously mounted cgroup filesystems. libcgroup does not mount/unmount anything for you.
int cgroup_create_cgroup (struct cgroup *cgroup, int ignore_ownership)
 
int cgroup_create_cgroup_from_parent (struct cgroup *cgroup, int ignore_ownership)
 
int cgroup_modify_cgroup (struct cgroup *cgroup)
 
int cgroup_delete_cgroup (struct cgroup *cgroup, int ignore_migration)
 
int cgroup_delete_cgroup_ext (struct cgroup *cgroup, int flags)
 
int cgroup_create_cgroup (struct cgroup *cgrp, int ignore_ownership)
 
int cgroup_create_cgroup_from_parent (struct cgroup *cgrp, int ignore_ownership)
 
int cgroup_modify_cgroup (struct cgroup *cgrp)
 
int cgroup_delete_cgroup (struct cgroup *cgrp, int ignore_migration)
 
int cgroup_delete_cgroup_ext (struct cgroup *cgrp, int flags)
 
- - + + - - + + - - - - - - + + + + + +

Other functions

Helper functions to manipulate with control groups.

int cgroup_get_cgroup (struct cgroup *cgroup)
 
int cgroup_get_cgroup (struct cgroup *cgrp)
 
int cgroup_copy_cgroup (struct cgroup *dst, struct cgroup *src)
 
int cgroup_compare_cgroup (struct cgroup *cgroup_a, struct cgroup *cgroup_b)
 
int cgroup_compare_cgroup (struct cgroup *cgrp_a, struct cgroup *cgrp_b)
 
int cgroup_compare_controllers (struct cgroup_controller *cgca, struct cgroup_controller *cgcb)
 
int cgroup_set_uid_gid (struct cgroup *cgroup, uid_t tasks_uid, gid_t tasks_gid, uid_t control_uid, gid_t control_gid)
 
int cgroup_get_uid_gid (struct cgroup *cgroup, uid_t *tasks_uid, gid_t *tasks_gid, uid_t *control_uid, gid_t *control_gid)
 
void cgroup_set_permissions (struct cgroup *cgroup, mode_t control_dperm, mode_t control_fperm, mode_t task_fperm)
 
int cgroup_set_uid_gid (struct cgroup *cgrp, uid_t tasks_uid, gid_t tasks_gid, uid_t control_uid, gid_t control_gid)
 
int cgroup_get_uid_gid (struct cgroup *cgrp, uid_t *tasks_uid, gid_t *tasks_gid, uid_t *control_uid, gid_t *control_gid)
 
void cgroup_set_permissions (struct cgroup *cgrp, mode_t control_dperm, mode_t control_fperm, mode_t task_fperm)
 
- @@ -189,23 +189,23 @@ Data Structures - - - - - - + + + + + + - - - - + + + + @@ -248,8 +248,8 @@ int  - + @@ -293,7 +293,7 @@ int  - + @@ -358,7 +358,7 @@ int 

Group parameters

These are functions can read or modify parameter of a group.

Note
All these functions read/write parameters to libcgorup internal structures. Use cgroup_get_cgroup() to load parameters from kernel to these internal structures and cgroup_modify_cgroup() or cgroup_create_cgroup() to write changes to kernel.
+

These are functions can read or modify parameter of a group.

Note
All these functions read/write parameters to libcgorup internal structures. Use cgroup_get_cgroup() to load parameters from kernel to these internal structures and cgroup_modify_cgroup() or cgroup_create_cgroup() to write changes to kernel.
int cgroup_add_value_string (struct cgroup_controller *controller, const char *name, const char *value)
 
 
int cgroup_get_threads (const char *name, const char *controller, pid_t **pids, int *size)
 
int cg_chmod_recursive (struct cgroup *cgroup, mode_t dir_mode, int dirm_change, mode_t file_mode, int filem_change)
 
char * cgroup_get_cgroup_name (struct cgroup *cgroup)
 
-int cgroup_convert_cgroup (struct cgroup *const out_cgroup, enum cg_version_t out_version, const struct cgroup *const in_cgroup, enum cg_version_t in_version)
 
int cg_chmod_recursive (struct cgroup *cgrp, mode_t dir_mode, int dirm_change, mode_t file_mode, int filem_change)
 
char * cgroup_get_cgroup_name (struct cgroup *cgrp)
 
+int cgroup_convert_cgroup (struct cgroup *const out_cgrp, enum cg_version_t out_version, const struct cgroup *const in_cgrp, enum cg_version_t in_version)
 
int cgroup_list_mount_points (const enum cg_version_t cgrp_version, char ***mount_paths)
 
int cgroup_get_controller_version (const char *const controller, enum cg_version_t *const version)
 
enum cg_setup_mode_t cgroup_setup_mode (void)
 
int cgroup_get_controller_count (struct cgroup *cgroup)
 
struct cgroup_controllercgroup_get_controller_by_index (struct cgroup *cgroup, int index)
 
int cgroup_get_controller_count (struct cgroup *cgrp)
 
struct cgroup_controllercgroup_get_controller_by_index (struct cgroup *cgrp, int index)
 
char * cgroup_get_controller_name (struct cgroup_controller *controller)
 
bool is_cgroup_mode_legacy (void)
cgroup_convert_cgroup<

Function Documentation

- -

◆ cg_chmod_recursive()

+ +

◆ cg_chmod_recursive()

@@ -258,7 +258,7 @@ int 
cgroup_convert_cgroup< int cg_chmod_recursive ( struct cgroupcgroup, cgrp,
cgroup_convert_cgroup<

Change permission of files and directories of given group

Parameters
- + @@ -304,8 +304,8 @@ int  - +
cgroupThe cgroup which permissions should be changed
cgrpThe cgroup which permissions should be changed
dir_modeThe permission mode of group directory
dirm_changeDenotes whether the directory change should be done
file_modeThe permission mode of group files
cgroup_convert_cgroup< - -

◆ cgroup_add_all_controllers()

+ +

◆ cgroup_add_all_controllers()

@@ -314,7 +314,7 @@ int 
cgroup_convert_cgroup< int cgroup_add_all_controllers ( struct cgroupcgroup)cgrp)
@@ -322,7 +322,7 @@ int 
cgroup_convert_cgroup<

Attach all mounted controllers to given cgroup. This function just modifies internal libcgroup structure, not the kernel control group.

Parameters
- +
cgroup
cgrp
@@ -330,8 +330,8 @@ int 
cgroup_convert_cgroup< - -

◆ cgroup_add_controller()

+ +

◆ cgroup_add_controller()

@@ -340,7 +340,7 @@ int 
cgroup_convert_cgroup< struct cgroup_controller * cgroup_add_controller ( struct cgroupcgroup, cgrp,
cgroup_convert_cgroup<

Attach new controller to cgroup. This function just modifies internal libcgroup structure, not the kernel control group.

Parameters
- +
cgroup
cgrp
nameThe name of the controller, e.g. "freezer".
@@ -398,7 +398,7 @@ int 
cgroup_convert_cgroup<
-

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
@@ -441,7 +441,7 @@ int 
controller
cgroup_convert_cgroup<
-

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel. Content of the value is copied to internal structures and is not needed after return from the function.

+

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel. Content of the value is copied to internal structures and is not needed after return from the function.

Parameters
@@ -484,7 +484,7 @@ int 
controller
cgroup_convert_cgroup<
-

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
@@ -527,7 +527,7 @@ int 
controller
cgroup_convert_cgroup<
-

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Add parameter and its value to internal libcgroup structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
@@ -539,8 +539,8 @@ int  - + - + @@ -567,8 +567,8 @@ int  - + @@ -689,9 +689,9 @@ int 
controller
cgroup_convert_cgroup< - -

◆ cgroup_compare_cgroup()

+ +

◆ cgroup_compare_cgroup()

@@ -549,13 +549,13 @@ int 
cgroup_convert_cgroup< int cgroup_compare_cgroup ( struct cgroupcgroup_a, cgrp_a,
struct cgroupcgroup_b cgrp_b 
cgroup_convert_cgroup<

Compare names, owners, controllers, parameters and values of two groups.

Parameters
- - + +
cgroup_a
cgroup_b
cgrp_a
cgrp_b
@@ -664,8 +664,8 @@ int 
cgroup_convert_cgroup< - -

◆ cgroup_create_cgroup()

+ +

◆ cgroup_create_cgroup()

@@ -674,7 +674,7 @@ int 
cgroup_convert_cgroup< int cgroup_create_cgroup ( struct cgroupcgroup, cgrp,
cgroup_convert_cgroup<
-

Physically create a control group in kernel. The group is created in all hierarchies, which cover controllers added by cgroup_add_controller(). All parameters set by cgroup_add_value_* functions are written. The created groups has owner which was set by cgroup_set_uid_gid() and permissions set by cgroup_set_permissions.

Parameters
+

Physically create a control group in kernel. The group is created in all hierarchies, which cover controllers added by cgroup_add_controller(). All parameters set by cgroup_add_value_* functions are written. The created groups has owner which was set by cgroup_set_uid_gid() and permissions set by cgroup_set_permissions.

Parameters
- +
cgroup
cgrp
ignore_ownershipWhen nozero, all errors are ignored when setting owner of the group and/or its tasks file.
@@ -703,13 +703,13 @@ int cgroup_convert_cgroup<
-

cgroup_create_cgroup creates a new control group. struct cgroup *cgroup: The control group to be created

+

cgroup_create_cgroup creates a new control group. struct cgroup *cgrp: The control group to be created

returns 0 on success. We recommend calling cg_delete_cgroup if this routine fails. That should do the cleanup operation. If ECGCANTSETVALUE is returned, the group was created successfully but not all controller parameters were successfully set.

- -

◆ cgroup_create_cgroup_from_parent()

+ +

◆ cgroup_create_cgroup_from_parent()

@@ -718,7 +718,7 @@ int cgroup_convert_cgroup< int cgroup_create_cgroup_from_parent ( struct cgroup *  - cgroup, + cgrp, @@ -734,12 +734,12 @@ int cgroup_convert_cgroup<

Physically create new control group in kernel, with all parameters and values copied from its parent group. The group is created in all hierarchies, where the parent group exists. I.e. following code creates subgroup in all hierarchies, because all of them have root (=parent) group.

struct cgroup *foo = cgroup_new_cgroup("foo");
- -
int cgroup_create_cgroup_from_parent(struct cgroup *cgroup, int ignore_ownership)
Definition api.c:3239
-
Todo:
what is this good for? Why the list of controllers added by cgroup_add_controller() is not used, like in cgroup_create_cgroup()? I can't create subgroup of root group in just one hierarchy with this function!
+ +
int cgroup_create_cgroup_from_parent(struct cgroup *cgrp, int ignore_ownership)
Definition api.c:3233
+
Todo:
what is this good for? Why the list of controllers added by cgroup_add_controller() is not used, like in cgroup_create_cgroup()? I can't create subgroup of root group in just one hierarchy with this function!
Parameters
- +
cgroupThe cgroup to create. Only it's name is used, everything else is discarded.
cgrpThe cgroup to create. Only it's name is used, everything else is discarded.
ignore_ownershipWhen nozero, all errors are ignored when setting owner of the group and/or its tasks file.
@@ -751,12 +751,12 @@ int cgroup_convert_cgroup<
-

@cgroup: cgroup data structure to be filled with parent values and then passed down for creation @ignore_ownership: Ignore doing a chown on the newly created cgroup

Returns
0 on success, > 0 on failure. If ECGCANTSETVALUE is returned, the group was created successfully, but not all controller parameters were copied from the parent successfully; unfortunately, this is expected...
+

@cgrp: cgroup data structure to be filled with parent values and then passed down for creation @ignore_ownership: Ignore doing a chown on the newly created cgroup

Returns
0 on success, > 0 on failure. If ECGCANTSETVALUE is returned, the group was created successfully, but not all controller parameters were copied from the parent successfully; unfortunately, this is expected...
- -

◆ cgroup_delete_cgroup()

+ +

◆ cgroup_delete_cgroup()

@@ -765,7 +765,7 @@ int cgroup_convert_cgroup< int cgroup_delete_cgroup ( struct cgroup *  - cgroup, + cgrp, @@ -780,23 +780,23 @@ int cgroup_convert_cgroup<
-

Physically remove a control group from kernel. The group is removed from all hierarchies, which cover controllers added by cgroup_add_controller() or cgroup_get_cgroup(). All tasks inside the group are automatically moved to parent group.

-

The group being removed must be empty, i.e. without subgroups. Use cgroup_delete_cgroup_ext() for recursive delete.

+

Physically remove a control group from kernel. The group is removed from all hierarchies, which cover controllers added by cgroup_add_controller() or cgroup_get_cgroup(). All tasks inside the group are automatically moved to parent group.

+

The group being removed must be empty, i.e. without subgroups. Use cgroup_delete_cgroup_ext() for recursive delete.

Parameters
- +
cgroup
cgrp
ignore_migrationWhen nozero, all errors are ignored when migrating tasks from the group to the parent group.
Todo:
what is ignore_migration good for? rmdir() will fail if tasks were not moved.
-

cgroup_delete cgroup deletes a control group. struct cgroup *cgroup takes the group which is to be deleted.

+

cgroup_delete cgroup deletes a control group. struct cgroup *cgrp takes the group which is to be deleted.

returns 0 on success.

- -

◆ cgroup_delete_cgroup_ext()

+ +

◆ cgroup_delete_cgroup_ext()

@@ -805,7 +805,7 @@ int cgroup_convert_cgroup< int cgroup_delete_cgroup_ext ( struct cgroup *  - cgroup, + cgrp, @@ -823,7 +823,7 @@ int cgroup_convert_cgroup<

Physically remove a control group from kernel. All tasks are automatically moved to parent group. If CGFLAG_DELETE_IGNORE_MIGRATION flag is used, the errors that occurred during the task movement are ignored. CGFLAG_DELETE_RECURSIVE flag specifies that all subgroups should be removed too. If root group is being removed with this flag specified, all subgroups are removed but the root group itself is left undeleted.

See also
cgroup_delete_flag.
Parameters
- +
cgroup
cgrp
flagsCombination of CGFLAG_DELETE_* flags, which indicate what and how to delete.
@@ -831,8 +831,8 @@ int cgroup_convert_cgroup<
- -

◆ cgroup_free()

+ +

◆ cgroup_free()

@@ -841,22 +841,22 @@ int cgroup_convert_cgroup< void cgroup_free ( struct cgroup **  - cgroup) + cgrp)

Free internal cgroup structure. This function frees also all controllers attached to the cgroup, including all parameters and their values.

Parameters
- +
cgroup
cgrp
- -

◆ cgroup_free_controllers()

+ +

◆ cgroup_free_controllers()

@@ -865,7 +865,7 @@ int cgroup_convert_cgroup< void cgroup_free_controllers ( struct cgroup *  - cgroup) + cgrp) @@ -873,15 +873,15 @@ int cgroup_convert_cgroup<

Free internal list of controllers from the group.

Todo:
should this function be public???
Parameters
- +
cgroup
cgrp
- -

◆ cgroup_get_cgroup()

+ +

◆ cgroup_get_cgroup()

@@ -890,26 +890,26 @@ int cgroup_convert_cgroup< int cgroup_get_cgroup ( struct cgroup *  - cgroup) + cgrp)

Read all information regarding the group from kernel. Based on name of the group, list of controllers and all parameters and their values are read from all hierarchies, where a group with given name exists. All existing controllers are replaced. I.e. following code will fill root with controllers from all hierarchies, because the root group is available in all of them.

struct cgroup *root = cgroup_new_cgroup("/");
- -
int cgroup_get_cgroup(struct cgroup *cgroup)
Definition api.c:3779
-
Todo:
what is this function good for? Why is not considered only the list of controllers attached by cgroup_add_controller()? What owners will return cgroup_get_uid_gid() if the group is in multiple hierarchies, each with different owner of tasks file?
+ +
int cgroup_get_cgroup(struct cgroup *cgrp)
Definition api.c:3767
+
Todo:
what is this function good for? Why is not considered only the list of controllers attached by cgroup_add_controller()? What owners will return cgroup_get_uid_gid() if the group is in multiple hierarchies, each with different owner of tasks file?
Parameters
- +
cgroupThe cgroup to load. Only it's name is used, everything else is replaced.
cgrpThe cgroup to load. Only it's name is used, everything else is replaced.
- -

◆ cgroup_get_cgroup_name()

+ +

◆ cgroup_get_cgroup_name()

@@ -918,22 +918,22 @@ int cgroup_convert_cgroup< char * cgroup_get_cgroup_name ( struct cgroup *  - cgroup) + cgrp)

Get the name of the cgroup from a given cgroup

Parameters
- +
cgroupThe cgroup whose name is needed
cgrpThe cgroup whose name is needed
- -

◆ cgroup_get_controller()

+ +

◆ cgroup_get_controller()

@@ -942,7 +942,7 @@ int cgroup_convert_cgroup< struct cgroup_controller * cgroup_get_controller ( struct cgroup *  - cgroup, + cgrp, @@ -957,9 +957,9 @@ int cgroup_convert_cgroup<
-

Return appropriate controller from given group. The controller must be added before using cgroup_add_controller() or loaded from kernel using cgroup_get_cgroup().

Parameters
+

Return appropriate controller from given group. The controller must be added before using cgroup_add_controller() or loaded from kernel using cgroup_get_cgroup().

Parameters
- +
cgroup
cgrp
nameThe name of the controller, e.g. "freezer".
@@ -967,8 +967,8 @@ int cgroup_convert_cgroup<
- -

◆ cgroup_get_controller_by_index()

+ +

◆ cgroup_get_controller_by_index()

@@ -977,7 +977,7 @@ int cgroup_convert_cgroup< struct cgroup_controller * cgroup_get_controller_by_index ( struct cgroup *  - cgroup, + cgrp, @@ -995,7 +995,7 @@ int cgroup_convert_cgroup<

Return requested controller from given group

Parameters
- +
cgroup
cgrp
indexThe index into the cgroup controller list
@@ -1003,8 +1003,8 @@ int cgroup_convert_cgroup<
- -

◆ cgroup_get_controller_count()

+ +

◆ cgroup_get_controller_count()

@@ -1013,7 +1013,7 @@ int cgroup_convert_cgroup< int cgroup_get_controller_count ( struct cgroup *  - cgroup) + cgrp) @@ -1021,7 +1021,7 @@ int cgroup_convert_cgroup<

Return the number of controllers for the specified cgroup in libcgroup internal structures.

Parameters
- +
cgroup
cgrp
@@ -1189,8 +1189,8 @@ int cgroup_convert_cgroup<
- -

◆ cgroup_get_uid_gid()

+ +

◆ cgroup_get_uid_gid()

@@ -1199,7 +1199,7 @@ int cgroup_convert_cgroup< int cgroup_get_uid_gid ( struct cgroup *  - cgroup, + cgrp, @@ -1232,7 +1232,7 @@ int cgroup_convert_cgroup<
-

Return owners of the group's tasks file and control files. The data is read from libcgroup internal cgroup structure, use cgroup_set_uid_gid() or cgroup_get_cgroup() to fill it.

+

Return owners of the group's tasks file and control files. The data is read from libcgroup internal cgroup structure, use cgroup_set_uid_gid() or cgroup_get_cgroup() to fill it.

@@ -1267,7 +1267,7 @@ int cgroup_convert_cgroup<
-

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

+

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

Parameters
@@ -1310,7 +1310,7 @@ int 
controller
cgroup_convert_cgroup<
-

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

+

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

Parameters
@@ -1375,7 +1375,7 @@ int 
controller
cgroup_convert_cgroup<
-

Return the number of variables for the specified controller in libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel. Use this function together with cgroup_get_value_name() to list all parameters of a group.

+

Return the number of variables for the specified controller in libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel. Use this function together with cgroup_get_value_name() to list all parameters of a group.

Parameters
@@ -1417,7 +1417,7 @@ int 
controller
cgroup_convert_cgroup<
-

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel. It's up to the caller to free returned value.

+

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel. It's up to the caller to free returned value.

This function works only for 'short' parameters. Use cgroup_read_stats_begin(), cgroup_read_stats_next() and cgroup_read_stats_end() to read stats parameter, which can be longer than libcgroup's internal buffers.

Todo:
rephrase, it's too vague... How big is the buffer actually?
Parameters
@@ -1461,7 +1461,7 @@ int 
cgroup_convert_cgroup<
-

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

+

Read a parameter value from libcgroup internal structures. Use cgroup_get_cgroup() to fill these structures with data from kernel.

Parameters
@@ -1510,8 +1510,8 @@ int  - +
controller
cgroup_convert_cgroup< - -

◆ cgroup_modify_cgroup()

+ +

◆ cgroup_modify_cgroup()

@@ -1520,7 +1520,7 @@ int 
cgroup_convert_cgroup< int cgroup_modify_cgroup ( struct cgroupcgroup)cgrp)
@@ -1528,11 +1528,11 @@ int cgroup_convert_cgroup<

Physically modify a control group in kernel. All parameters added by cgroup_add_value_ or cgroup_set_value_ are written. Currently it's not possible to change and owner of a group.

Parameters
- +
cgroup
cgrp
-

cgroup_modify_cgroup modifies the cgroup control files. struct cgroup *cgroup: The name will be the cgroup to be modified. The values will be the values to be modified, those not mentioned in the structure will not be modified.

+

cgroup_modify_cgroup modifies the cgroup control files. struct cgroup *cgrp: The name will be the cgroup to be modified. The values will be the values to be modified, those not mentioned in the structure will not be modified.

The uids cannot be modified yet.

returns 0 on success.

@@ -1565,8 +1565,8 @@ int cgroup_convert_cgroup<
- -

◆ cgroup_set_permissions()

+ +

◆ cgroup_set_permissions()

@@ -1575,7 +1575,7 @@ int cgroup_convert_cgroup< void cgroup_set_permissions ( struct cgroup *  - cgroup, + cgrp, @@ -1604,7 +1604,7 @@ int cgroup_convert_cgroup<

Stores given file permissions of the group's control and tasks files into the cgroup data structure. Use NO_PERMS if permissions shouldn't be changed or a value which applicable to chmod(2). Please note that the given permissions are masked with the file owner's permissions. For example if a control file has permissions 640 and control_fperm is 471 the result will be 460.

Parameters
- + @@ -1614,8 +1614,8 @@ int  - + @@ -1657,10 +1657,10 @@ int 
cgroup
cgrp
control_dpermDirectory permission for the group.
control_fpermFile permission for the control files.
task_fpermFile permissions for task file.
cgroup_convert_cgroup< - -

◆ cgroup_set_uid_gid()

+ +

◆ cgroup_set_uid_gid()

@@ -1624,7 +1624,7 @@ int 
cgroup_convert_cgroup< int cgroup_set_uid_gid ( struct cgroupcgroup, cgrp,
cgroup_convert_cgroup<
-

Set owner of the group control files and the tasks file. This function modifies only libcgroup internal cgroup structure, use cgroup_create_cgroup() afterwards to create the group with given owners.

+

Set owner of the group control files and the tasks file. This function modifies only libcgroup internal cgroup structure, use cgroup_create_cgroup() afterwards to create the group with given owners.

Parameters
- + @@ -1702,7 +1702,7 @@ int 
cgroup
cgrp
tasks_uidUID of the owner of group's tasks file.
tasks_gidGID of the owner of group's tasks file.
control_uidUID of the owner of group's control files (i.e. parameters).
cgroup_convert_cgroup<
-

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
@@ -1745,7 +1745,7 @@ int 
controller
cgroup_convert_cgroup<
-

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel. Content of the value is copied to internal structures and is not needed after return from the function.

+

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel. Content of the value is copied to internal structures and is not needed after return from the function.

Parameters
@@ -1788,7 +1788,7 @@ int 
controller
cgroup_convert_cgroup<
-

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
@@ -1831,7 +1831,7 @@ int 
controller
cgroup_convert_cgroup<
-

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

+

Set a parameter value in libcgroup internal structures. Use cgroup_modify_cgroup() or cgroup_create_cgroup() to write it to kernel.

Parameters
diff --git a/group__group__iterators.html b/group__group__iterators.html index 7ac9cc7a..bd0823bc 100644 --- a/group__group__iterators.html +++ b/group__group__iterators.html @@ -128,8 +128,8 @@ Data Structures - - + + @@ -548,8 +548,8 @@ Data Structures - -

◆ cgroup_get_task_begin()

+ +

◆ cgroup_get_task_begin()

@@ -558,7 +558,7 @@ Data Structures
- + @@ -587,7 +587,7 @@ Data Structures

Read the tasks file to get the list of tasks in a cgroup.

Parameters
controller

List all tasks in a group

Use following functions to read tasks file of a group.

int cgroup_get_task_begin (const char *cgroup, const char *controller, void **handle, pid_t *pid)
 
int cgroup_get_task_begin (const char *cgrp, const char *controller, void **handle, pid_t *pid)
 
int cgroup_get_task_next (void **handle, pid_t *pid)
 
int cgroup_get_task_end (void **handle)
int cgroup_get_task_begin ( const char * cgroup, cgrp,
- + diff --git a/group__group__tasks.html b/group__group__tasks.html index 1a59cc7b..135312b5 100644 --- a/group__group__tasks.html +++ b/group__group__tasks.html @@ -76,10 +76,10 @@ $(function() { - - - - + + + + @@ -117,8 +117,8 @@ $(function() {
cgroupName of the cgroup.
cgrpName of the cgroup.
controllerName of the cgroup subsystem.
handleThe handle to be used in the iteration.
pidThe pid read from the tasks file.

Simple task assignment

Applications can use following functions to simply put a task into given control group and find a groups where given tasks is.

int cgroup_attach_task (struct cgroup *cgroup)
 
int cgroup_attach_task_pid (struct cgroup *cgroup, pid_t tid)
 
int cgroup_attach_task (struct cgroup *cgrp)
 
int cgroup_attach_task_pid (struct cgroup *cgrp, pid_t tid)
 
int cgroup_change_cgroup_path (const char *path, pid_t pid, const char *const controllers[])
 
int cgroup_get_current_controller_path (pid_t pid, const char *controller, char **current_path)

Detailed Description

Function Documentation

- -

◆ cgroup_attach_task()

+ +

◆ cgroup_attach_task()

@@ -134,7 +134,7 @@ $(function() {

Move current task (=thread) to given control group.

Parameters
- +
cgroupDestination control group.
cgrpDestination control group.
@@ -143,8 +143,8 @@ $(function() {
- -

◆ cgroup_attach_task_pid()

+ +

◆ cgroup_attach_task_pid()

@@ -170,7 +170,7 @@ $(function() {

Move given task (=thread) to given control group.

Parameters
- +
cgroupDestination control group.
cgrpDestination control group.
tidThe task to move.
diff --git a/groups_8h_source.html b/groups_8h_source.html index 0f1600e4..29d3a538 100644 --- a/groups_8h_source.html +++ b/groups_8h_source.html @@ -131,185 +131,173 @@ $(document).ready(function() { init_codefold(0); });
145
156struct cgroup *cgroup_new_cgroup(const char *name);
157
- -
167 const char *name);
-
168
- +
166struct cgroup_controller *cgroup_add_controller(struct cgroup *cgrp, const char *name);
+
167
+
175int cgroup_add_all_controllers(struct cgroup *cgrp);
+
176
177
-
178
- -
187 const char *name);
-
188
-
194void cgroup_free(struct cgroup **cgroup);
-
195
- -
202
-
226int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership);
-
227
- -
250 int ignore_ownership);
-
251
- -
260
-
275int cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration);
-
276
-
291int cgroup_delete_cgroup_ext(struct cgroup *cgroup, int flags);
-
292
-
320int cgroup_get_cgroup(struct cgroup *cgroup);
-
321
-
330int cgroup_copy_cgroup(struct cgroup *dst, struct cgroup *src);
-
331
-
343int cgroup_compare_cgroup(struct cgroup *cgroup_a, struct cgroup *cgroup_b);
-
344
-
345
- -
356 struct cgroup_controller *cgcb);
-
357
-
371int cgroup_set_uid_gid(struct cgroup *cgroup, uid_t tasks_uid, gid_t tasks_gid,
-
372 uid_t control_uid, gid_t control_gid);
-
373
-
379int cgroup_get_uid_gid(struct cgroup *cgroup, uid_t *tasks_uid,
-
380 gid_t *tasks_gid, uid_t *control_uid,
-
381 gid_t *control_gid);
-
382
- -
396 mode_t control_dperm, mode_t control_fperm,
-
397 mode_t task_fperm);
-
398
-
419int cgroup_add_value_string(struct cgroup_controller *controller,
-
420 const char *name, const char *value);
-
421
-
433int cgroup_add_value_int64(struct cgroup_controller *controller,
-
434 const char *name, int64_t value);
-
435
-
445int cgroup_add_value_uint64(struct cgroup_controller *controller,
-
446 const char *name, u_int64_t value);
-
447
-
457int cgroup_add_value_bool(struct cgroup_controller *controller,
-
458 const char *name, bool value);
-
459
-
475int cgroup_get_value_string(struct cgroup_controller *controller,
-
476 const char *name, char **value);
-
485int cgroup_get_value_int64(struct cgroup_controller *controller,
-
486 const char *name, int64_t *value);
-
487
-
496int cgroup_get_value_uint64(struct cgroup_controller *controller,
-
497 const char *name, u_int64_t *value);
-
498
-
507int cgroup_get_value_bool(struct cgroup_controller *controller,
-
508 const char *name, bool *value);
-
509
-
518int cgroup_set_value_string(struct cgroup_controller *controller,
-
519 const char *name, const char *value);
-
520
-
531int cgroup_set_value_int64(struct cgroup_controller *controller,
-
532 const char *name, int64_t value);
-
541int cgroup_set_value_uint64(struct cgroup_controller *controller,
-
542 const char *name, u_int64_t value);
-
543
-
552int cgroup_set_value_bool(struct cgroup_controller *controller,
-
553 const char *name, bool value);
-
554
-
564int cgroup_get_value_name_count(struct cgroup_controller *controller);
-
565
-
578char *cgroup_get_value_name(struct cgroup_controller *controller, int index);
-
579
-
589int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size);
-
590
-
600int cgroup_get_threads(const char *name, const char *controller, pid_t **pids, int *size);
-
601
-
610int cg_chmod_recursive(struct cgroup *cgroup, mode_t dir_mode,
-
611 int dirm_change, mode_t file_mode, int filem_change);
-
612
- -
618
-
619/*
-
620 * Convert from one cgroup version to another version
-
621 *
-
622 * @param out_cgroup Destination cgroup
-
623 * @param out_version Destination cgroup version
-
624 * @param in_cgroup Source cgroup
-
625 * @param in_version Source cgroup version, only used if set to v1 or v2
-
626 *
-
627 * @return 0 on success
-
628 * ECGFAIL conversion failed
-
629 * ECGCONTROLLERNOTEQUAL incorrect controller version provided
-
630 */
-
631int cgroup_convert_cgroup(struct cgroup * const out_cgroup,
-
632 enum cg_version_t out_version,
-
633 const struct cgroup * const in_cgroup,
-
634 enum cg_version_t in_version);
+
185struct cgroup_controller *cgroup_get_controller(struct cgroup *cgrp, const char *name);
+
186
+
192void cgroup_free(struct cgroup **cgrp);
+
193
+
199void cgroup_free_controllers(struct cgroup *cgrp);
+
200
+
224int cgroup_create_cgroup(struct cgroup *cgrp, int ignore_ownership);
+
225
+
247int cgroup_create_cgroup_from_parent(struct cgroup *cgrp, int ignore_ownership);
+
248
+
256int cgroup_modify_cgroup(struct cgroup *cgrp);
+
257
+
272int cgroup_delete_cgroup(struct cgroup *cgrp, int ignore_migration);
+
273
+
288int cgroup_delete_cgroup_ext(struct cgroup *cgrp, int flags);
+
289
+
317int cgroup_get_cgroup(struct cgroup *cgrp);
+
318
+
327int cgroup_copy_cgroup(struct cgroup *dst, struct cgroup *src);
+
328
+
340int cgroup_compare_cgroup(struct cgroup *cgrp_a, struct cgroup *cgrp_b);
+
341
+
342
+ +
353
+
367int cgroup_set_uid_gid(struct cgroup *cgrp, uid_t tasks_uid, gid_t tasks_gid,
+
368 uid_t control_uid, gid_t control_gid);
+
369
+
375int cgroup_get_uid_gid(struct cgroup *cgrp, uid_t *tasks_uid,
+
376 gid_t *tasks_gid, uid_t *control_uid,
+
377 gid_t *control_gid);
+
378
+
391void cgroup_set_permissions(struct cgroup *cgrp,
+
392 mode_t control_dperm, mode_t control_fperm,
+
393 mode_t task_fperm);
+
394
+
415int cgroup_add_value_string(struct cgroup_controller *controller,
+
416 const char *name, const char *value);
+
417
+
429int cgroup_add_value_int64(struct cgroup_controller *controller, const char *name, int64_t value);
+
430
+
440int cgroup_add_value_uint64(struct cgroup_controller *controller,
+
441 const char *name, u_int64_t value);
+
442
+
452int cgroup_add_value_bool(struct cgroup_controller *controller, const char *name, bool value);
+
453
+
469int cgroup_get_value_string(struct cgroup_controller *controller, const char *name, char **value);
+
478int cgroup_get_value_int64(struct cgroup_controller *controller, const char *name, int64_t *value);
+
479
+
488int cgroup_get_value_uint64(struct cgroup_controller *controller,
+
489 const char *name, u_int64_t *value);
+
490
+
499int cgroup_get_value_bool(struct cgroup_controller *controller, const char *name, bool *value);
+
500
+
509int cgroup_set_value_string(struct cgroup_controller *controller,
+
510 const char *name, const char *value);
+
511
+
522int cgroup_set_value_int64(struct cgroup_controller *controller,
+
523 const char *name, int64_t value);
+
532int cgroup_set_value_uint64(struct cgroup_controller *controller,
+
533 const char *name, u_int64_t value);
+
534
+
543int cgroup_set_value_bool(struct cgroup_controller *controller, const char *name, bool value);
+
544
+
554int cgroup_get_value_name_count(struct cgroup_controller *controller);
+
555
+
568char *cgroup_get_value_name(struct cgroup_controller *controller, int index);
+
569
+
579int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size);
+
580
+
590int cgroup_get_threads(const char *name, const char *controller, pid_t **pids, int *size);
+
591
+
600int cg_chmod_recursive(struct cgroup *cgrp, mode_t dir_mode,
+
601 int dirm_change, mode_t file_mode, int filem_change);
+
602
+
607char *cgroup_get_cgroup_name(struct cgroup *cgrp);
+
608
+
609/*
+
610 * Convert from one cgroup version to another version
+
611 *
+
612 * @param out_cgroup Destination cgroup
+
613 * @param out_version Destination cgroup version
+
614 * @param in_cgroup Source cgroup
+
615 * @param in_version Source cgroup version, only used if set to v1 or v2
+
616 *
+
617 * @return 0 on success
+
618 * ECGFAIL conversion failed
+
619 * ECGCONTROLLERNOTEQUAL incorrect controller version provided
+
620 */
+
621int cgroup_convert_cgroup(struct cgroup * const out_cgrp,
+
622 enum cg_version_t out_version,
+
623 const struct cgroup * const in_cgrp,
+
624 enum cg_version_t in_version);
+
625
+
634int cgroup_list_mount_points(const enum cg_version_t cgrp_version, char ***mount_paths);
635
-
644int cgroup_list_mount_points(const enum cg_version_t cgrp_version,
-
645 char ***mount_paths);
-
646
-
654int cgroup_get_controller_version(const char * const controller,
-
655 enum cg_version_t * const version);
-
656
-
662enum cg_setup_mode_t cgroup_setup_mode(void);
-
663
- -
672
- -
680
-
687char *cgroup_get_controller_name(struct cgroup_controller *controller);
+
643int cgroup_get_controller_version(const char * const controller, enum cg_version_t * const version);
+
644
+
650enum cg_setup_mode_t cgroup_setup_mode(void);
+
651
+
659int cgroup_get_controller_count(struct cgroup *cgrp);
+
660
+
667struct cgroup_controller *cgroup_get_controller_by_index(struct cgroup *cgrp, int index);
+
668
+
675char *cgroup_get_controller_name(struct cgroup_controller *controller);
+
676
+
681bool is_cgroup_mode_legacy(void);
+
682
+
687bool is_cgroup_mode_hybrid(void);
688
-
693bool is_cgroup_mode_legacy(void);
+
693bool is_cgroup_mode_unified(void);
694
-
699bool is_cgroup_mode_hybrid(void);
-
700
-
705bool is_cgroup_mode_unified(void);
-
706
-
713#ifdef __cplusplus
-
714} /* extern "C" */
-
715#endif
-
716
-
717#endif /* _LIBCGROUP_GROUPS_H */
-
int cgroup_get_uid_gid(struct cgroup *cgroup, uid_t *tasks_uid, gid_t *tasks_gid, uid_t *control_uid, gid_t *control_gid)
Definition wrapper.c:480
-
int cgroup_list_mount_points(const enum cg_version_t cgrp_version, char ***mount_paths)
Definition api.c:6558
+
701#ifdef __cplusplus
+
702} /* extern "C" */
+
703#endif
+
704
+
705#endif /* _LIBCGROUP_GROUPS_H */
+
int cgroup_list_mount_points(const enum cg_version_t cgrp_version, char ***mount_paths)
Definition api.c:6545
int cgroup_get_value_int64(struct cgroup_controller *controller, const char *name, int64_t *value)
Definition wrapper.c:558
bool is_cgroup_mode_hybrid(void)
Definition wrapper.c:815
-
int cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration)
Definition api.c:3470
int cgroup_get_value_name_count(struct cgroup_controller *controller)
Definition wrapper.c:769
-
int cgroup_modify_cgroup(struct cgroup *cgroup)
Definition api.c:2742
-
struct cgroup_controller * cgroup_add_controller(struct cgroup *cgroup, const char *name)
Definition wrapper.c:61
-
int cgroup_get_controller_version(const char *const controller, enum cg_version_t *const version)
Definition api.c:6490
+
int cgroup_get_cgroup(struct cgroup *cgrp)
Definition api.c:3767
+
int cgroup_get_uid_gid(struct cgroup *cgrp, uid_t *tasks_uid, gid_t *tasks_gid, uid_t *control_uid, gid_t *control_gid)
Definition wrapper.c:480
+
void cgroup_free_controllers(struct cgroup *cgrp)
Definition wrapper.c:243
+
int cgroup_get_controller_count(struct cgroup *cgrp)
Definition api.c:6691
+
int cgroup_get_controller_version(const char *const controller, enum cg_version_t *const version)
Definition api.c:6477
int cgroup_add_value_string(struct cgroup_controller *controller, const char *name, const char *value)
Definition wrapper.c:269
int cgroup_add_value_bool(struct cgroup_controller *controller, const char *name, bool value)
Definition wrapper.c:347
+
int cgroup_create_cgroup_from_parent(struct cgroup *cgrp, int ignore_ownership)
Definition api.c:3233
+
int cgroup_delete_cgroup(struct cgroup *cgrp, int ignore_migration)
Definition api.c:3462
bool is_cgroup_mode_legacy(void)
Definition wrapper.c:803
-
int cgroup_set_uid_gid(struct cgroup *cgroup, uid_t tasks_uid, gid_t tasks_gid, uid_t control_uid, gid_t control_gid)
Definition wrapper.c:466
-
int cgroup_get_threads(const char *name, const char *controller, pid_t **pids, int *size)
Definition api.c:6293
-
int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size)
Definition api.c:6283
-
struct cgroup_controller * cgroup_get_controller(struct cgroup *cgroup, const char *name)
Definition wrapper.c:494
+
int cgroup_set_uid_gid(struct cgroup *cgrp, uid_t tasks_uid, gid_t tasks_gid, uid_t control_uid, gid_t control_gid)
Definition wrapper.c:466
+
int cgroup_get_threads(const char *name, const char *controller, pid_t **pids, int *size)
Definition api.c:6279
+
int cgroup_get_procs(const char *name, const char *controller, pid_t **pids, int *size)
Definition api.c:6269
+
int cgroup_add_all_controllers(struct cgroup *cgrp)
Definition wrapper.c:111
int cgroup_add_value_int64(struct cgroup_controller *controller, const char *name, int64_t value)
Definition wrapper.c:312
+
int cgroup_create_cgroup(struct cgroup *cgrp, int ignore_ownership)
Definition api.c:3025
bool is_cgroup_mode_unified(void)
Definition wrapper.c:827
-
int cgroup_delete_cgroup_ext(struct cgroup *cgroup, int flags)
Definition api.c:3477
-
int cgroup_compare_cgroup(struct cgroup *cgroup_a, struct cgroup *cgroup_b)
Definition wrapper.c:417
-
int cgroup_create_cgroup_from_parent(struct cgroup *cgroup, int ignore_ownership)
Definition api.c:3239
-
void cgroup_free_controllers(struct cgroup *cgroup)
Definition wrapper.c:243
+
char * cgroup_get_cgroup_name(struct cgroup *cgrp)
Definition wrapper.c:790
+
void cgroup_free(struct cgroup **cgrp)
Definition wrapper.c:256
+
struct cgroup_controller * cgroup_add_controller(struct cgroup *cgrp, const char *name)
Definition wrapper.c:61
int cgroup_set_value_string(struct cgroup_controller *controller, const char *name, const char *value)
Definition wrapper.c:536
int cgroup_get_value_uint64(struct cgroup_controller *controller, const char *name, u_int64_t *value)
Definition wrapper.c:603
char * cgroup_get_value_name(struct cgroup_controller *controller, int index)
Definition wrapper.c:778
-
void cgroup_set_permissions(struct cgroup *cgroup, mode_t control_dperm, mode_t control_fperm, mode_t task_fperm)
Definition api.c:375
int cgroup_set_value_int64(struct cgroup_controller *controller, const char *name, int64_t value)
Definition wrapper.c:579
-
int cgroup_copy_cgroup(struct cgroup *dst, struct cgroup *src)
Definition api.c:2851
+
int cgroup_copy_cgroup(struct cgroup *dst, struct cgroup *src)
Definition api.c:2845
int cgroup_compare_controllers(struct cgroup_controller *cgca, struct cgroup_controller *cgcb)
Definition wrapper.c:390
-
void cgroup_free(struct cgroup **cgroup)
Definition wrapper.c:256
-
char * cgroup_get_cgroup_name(struct cgroup *cgroup)
Definition wrapper.c:790
+
int cgroup_delete_cgroup_ext(struct cgroup *cgrp, int flags)
Definition api.c:3469
int cgroup_get_value_bool(struct cgroup_controller *controller, const char *name, bool *value)
Definition wrapper.c:650
-
int cgroup_get_controller_count(struct cgroup *cgroup)
Definition api.c:6704
-
char * cgroup_get_controller_name(struct cgroup_controller *controller)
Definition api.c:6723
+
struct cgroup_controller * cgroup_get_controller_by_index(struct cgroup *cgrp, int index)
Definition api.c:6699
+
char * cgroup_get_controller_name(struct cgroup_controller *controller)
Definition api.c:6710
+
int cg_chmod_recursive(struct cgroup *cgrp, mode_t dir_mode, int dirm_change, mode_t file_mode, int filem_change)
Definition api.c:347
struct cgroup * cgroup_new_cgroup(const char *name)
Definition wrapper.c:43
-
int cgroup_get_cgroup(struct cgroup *cgroup)
Definition api.c:3779
int cgroup_add_value_uint64(struct cgroup_controller *controller, const char *name, u_int64_t value)
Definition wrapper.c:329
-
int cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership)
Definition api.c:3031
+
int cgroup_modify_cgroup(struct cgroup *cgrp)
Definition api.c:2736
int cgroup_set_value_uint64(struct cgroup_controller *controller, const char *name, u_int64_t value)
Definition wrapper.c:625
-
int cgroup_add_all_controllers(struct cgroup *cgroup)
Definition wrapper.c:111
-
enum cg_setup_mode_t cgroup_setup_mode(void)
Definition api.c:6659
-
int cg_chmod_recursive(struct cgroup *cgroup, mode_t dir_mode, int dirm_change, mode_t file_mode, int filem_change)
Definition api.c:347
-
struct cgroup_controller * cgroup_get_controller_by_index(struct cgroup *cgroup, int index)
Definition api.c:6712
+
void cgroup_set_permissions(struct cgroup *cgrp, mode_t control_dperm, mode_t control_fperm, mode_t task_fperm)
Definition api.c:375
+
enum cg_setup_mode_t cgroup_setup_mode(void)
Definition api.c:6646
+
int cgroup_compare_cgroup(struct cgroup *cgrp_a, struct cgroup *cgrp_b)
Definition wrapper.c:417
int cgroup_get_value_string(struct cgroup_controller *controller, const char *name, char **value)
Definition wrapper.c:512
int cgroup_set_value_bool(struct cgroup_controller *controller, const char *name, bool value)
Definition wrapper.c:678
+
struct cgroup_controller * cgroup_get_controller(struct cgroup *cgrp, const char *name)
Definition wrapper.c:494
Definition libcgroup-internal.h:113
Definition libcgroup-internal.h:121
diff --git a/iterators_8h_source.html b/iterators_8h_source.html index 6c593051..10e937e7 100644 --- a/iterators_8h_source.html +++ b/iterators_8h_source.html @@ -128,108 +128,104 @@ $(document).ready(function() { init_codefold(0); });
154 void **handle, struct cgroup_file_info *info,
155 int *base_level);
156
-
166int cgroup_walk_tree_next(int depth, void **handle,
-
167 struct cgroup_file_info *info, int base_level);
-
168
-
172int cgroup_walk_tree_end(void **handle);
-
173
-
180int cgroup_walk_tree_set_flags(void **handle, int flags);
-
181
-
197int cgroup_read_value_begin(const char * const controller, const char *path,
-
198 const char * const name, void **handle,
-
199 char *buffer, int max);
-
200
-
214int cgroup_read_value_next(void **handle, char *buffer, int max);
-
215
-
219int cgroup_read_value_end(void **handle);
-
220
-
233#define CG_VALUE_MAX 100
-
- -
238 char name[FILENAME_MAX];
-
239 char value[CG_VALUE_MAX];
-
240};
+
166int cgroup_walk_tree_next(int depth, void **handle, struct cgroup_file_info *info, int base_level);
+
167
+
171int cgroup_walk_tree_end(void **handle);
+
172
+
179int cgroup_walk_tree_set_flags(void **handle, int flags);
+
180
+
196int cgroup_read_value_begin(const char * const controller, const char *path,
+
197 const char * const name, void **handle,
+
198 char *buffer, int max);
+
199
+
213int cgroup_read_value_next(void **handle, char *buffer, int max);
+
214
+
218int cgroup_read_value_end(void **handle);
+
219
+
232#define CG_VALUE_MAX 100
+
+ +
237 char name[FILENAME_MAX];
+
238 char value[CG_VALUE_MAX];
+
239};
-
241
-
252int cgroup_read_stats_begin(const char *controller, const char *path, void **handle,
-
253 struct cgroup_stat *stat);
-
254
-
261int cgroup_read_stats_next(void **handle, struct cgroup_stat *stat);
-
262
-
266int cgroup_read_stats_end(void **handle);
-
267
-
284int cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle,
-
285 pid_t *pid);
-
286
-
294int cgroup_get_task_next(void **handle, pid_t *pid);
-
295
-
299int cgroup_get_task_end(void **handle);
-
300
-
- -
317 char name[FILENAME_MAX];
-
319 char path[FILENAME_MAX];
-
320};
+
240
+
251int cgroup_read_stats_begin(const char *controller, const char *path, void **handle,
+
252 struct cgroup_stat *stat);
+
253
+
260int cgroup_read_stats_next(void **handle, struct cgroup_stat *stat);
+
261
+
265int cgroup_read_stats_end(void **handle);
+
266
+
283int cgroup_get_task_begin(const char *cgrp, const char *controller, void **handle, pid_t *pid);
+
284
+
292int cgroup_get_task_next(void **handle, pid_t *pid);
+
293
+
297int cgroup_get_task_end(void **handle);
+
298
+
+ +
315 char name[FILENAME_MAX];
+
317 char path[FILENAME_MAX];
+
318};
-
321
-
329int cgroup_get_controller_begin(void **handle, struct cgroup_mount_point *info);
-
330
-
340int cgroup_get_controller_next(void **handle, struct cgroup_mount_point *info);
-
341
-
345int cgroup_get_controller_end(void **handle);
-
346
-
- -
361 char name[FILENAME_MAX];
- - - -
372};
+
319
+
327int cgroup_get_controller_begin(void **handle, struct cgroup_mount_point *info);
+
328
+
338int cgroup_get_controller_next(void **handle, struct cgroup_mount_point *info);
+
339
+
343int cgroup_get_controller_end(void **handle);
+
344
+
+ +
359 char name[FILENAME_MAX];
+ + + +
370};
-
373
-
379int cgroup_get_all_controller_begin(void **handle,
-
380 struct controller_data *info);
-
386int cgroup_get_all_controller_next(void **handle, struct controller_data *info);
-
387
-
391int cgroup_get_all_controller_end(void **handle);
-
392
-
410int cgroup_get_subsys_mount_point_begin(const char *controller, void **handle,
-
411 char *path);
-
412
-
419int cgroup_get_subsys_mount_point_next(void **handle, char *path);
-
420
-
424int cgroup_get_subsys_mount_point_end(void **handle);
-
425
-
431#ifdef __cplusplus
-
432} /* extern "C" */
-
433#endif
-
434
-
435#endif /* _LIBCGROUP_ITERATORS_H */
-
int cgroup_walk_tree_end(void **handle)
Definition api.c:5257
-
int cgroup_get_all_controller_end(void **handle)
Definition api.c:6131
-
int cgroup_read_stats_begin(const char *controller, const char *path, void **handle, struct cgroup_stat *stat)
Definition api.c:5512
-
int cgroup_get_subsys_mount_point_begin(const char *controller, void **handle, char *path)
Definition api.c:6425
+
371
+
377int cgroup_get_all_controller_begin(void **handle, struct controller_data *info);
+
383int cgroup_get_all_controller_next(void **handle, struct controller_data *info);
+
384
+
388int cgroup_get_all_controller_end(void **handle);
+
389
+
407int cgroup_get_subsys_mount_point_begin(const char *controller, void **handle, char *path);
+
408
+
415int cgroup_get_subsys_mount_point_next(void **handle, char *path);
+
416
+
420int cgroup_get_subsys_mount_point_end(void **handle);
+
421
+
427#ifdef __cplusplus
+
428} /* extern "C" */
+
429#endif
+
430
+
431#endif /* _LIBCGROUP_ITERATORS_H */
+
int cgroup_walk_tree_end(void **handle)
Definition api.c:5243
+
int cgroup_get_all_controller_end(void **handle)
Definition api.c:6117
+
int cgroup_read_stats_begin(const char *controller, const char *path, void **handle, struct cgroup_stat *stat)
Definition api.c:5497
+
int cgroup_get_subsys_mount_point_begin(const char *controller, void **handle, char *path)
Definition api.c:6411
cgroup_walk_type
Definition iterators.h:74
-
int cgroup_get_subsys_mount_point_next(void **handle, char *path)
Definition api.c:6455
-
int cgroup_get_all_controller_next(void **handle, struct controller_data *info)
Definition api.c:6144
-
int cgroup_walk_tree_next(int depth, void **handle, struct cgroup_file_info *info, int base_level)
Definition api.c:5231
-
#define CG_VALUE_MAX
Definition iterators.h:233
-
int cgroup_get_controller_begin(void **handle, struct cgroup_mount_point *info)
Definition api.c:5674
+
int cgroup_get_subsys_mount_point_next(void **handle, char *path)
Definition api.c:6441
+
int cgroup_get_all_controller_next(void **handle, struct controller_data *info)
Definition api.c:6130
+
int cgroup_walk_tree_next(int depth, void **handle, struct cgroup_file_info *info, int base_level)
Definition api.c:5217
+
#define CG_VALUE_MAX
Definition iterators.h:232
+
int cgroup_get_controller_begin(void **handle, struct cgroup_mount_point *info)
Definition api.c:5659
cgroup_file_type
Definition iterators.h:106
-
int cgroup_walk_tree_set_flags(void **handle, int flags)
Definition api.c:5340
-
int cgroup_walk_tree_begin(const char *controller, const char *base_path, int depth, void **handle, struct cgroup_file_info *info, int *base_level)
Definition api.c:5277
-
int cgroup_get_controller_next(void **handle, struct cgroup_mount_point *info)
Definition api.c:5626
-
int cgroup_read_value_begin(const char *const controller, const char *path, const char *const name, void **handle, char *buffer, int max)
Definition api.c:5437
-
int cgroup_get_subsys_mount_point_end(void **handle)
Definition api.c:6477
-
int cgroup_get_controller_end(void **handle)
Definition api.c:5610
-
int cgroup_read_stats_end(void **handle)
Definition api.c:5474
-
int cgroup_read_value_next(void **handle, char *buffer, int max)
Definition api.c:5417
-
int cgroup_read_value_end(void **handle)
Definition api.c:5400
-
int cgroup_get_all_controller_begin(void **handle, struct controller_data *info)
Definition api.c:6176
-
int cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle, pid_t *pid)
Definition api.c:5579
-
int cgroup_get_task_end(void **handle)
Definition api.c:5543
-
int cgroup_get_task_next(void **handle, pid_t *pid)
Definition api.c:5557
-
int cgroup_read_stats_next(void **handle, struct cgroup_stat *stat)
Definition api.c:5493
+
int cgroup_walk_tree_set_flags(void **handle, int flags)
Definition api.c:5326
+
int cgroup_walk_tree_begin(const char *controller, const char *base_path, int depth, void **handle, struct cgroup_file_info *info, int *base_level)
Definition api.c:5263
+
int cgroup_get_controller_next(void **handle, struct cgroup_mount_point *info)
Definition api.c:5611
+
int cgroup_read_value_begin(const char *const controller, const char *path, const char *const name, void **handle, char *buffer, int max)
Definition api.c:5423
+
int cgroup_get_subsys_mount_point_end(void **handle)
Definition api.c:6464
+
int cgroup_get_controller_end(void **handle)
Definition api.c:5595
+
int cgroup_read_stats_end(void **handle)
Definition api.c:5459
+
int cgroup_read_value_next(void **handle, char *buffer, int max)
Definition api.c:5403
+
int cgroup_get_task_begin(const char *cgrp, const char *controller, void **handle, pid_t *pid)
Definition api.c:5564
+
int cgroup_read_value_end(void **handle)
Definition api.c:5386
+
int cgroup_get_all_controller_begin(void **handle, struct controller_data *info)
Definition api.c:6162
+
int cgroup_get_task_end(void **handle)
Definition api.c:5528
+
int cgroup_get_task_next(void **handle, pid_t *pid)
Definition api.c:5542
+
int cgroup_read_stats_next(void **handle, struct cgroup_stat *stat)
Definition api.c:5478
@ CGROUP_WALK_TYPE_POST_DIR
Definition iterators.h:100
@ CGROUP_WALK_TYPE_PRE_DIR
Definition iterators.h:87
@ CGROUP_FILE_TYPE_OTHER
Definition iterators.h:109
@@ -241,16 +237,15 @@ $(document).ready(function() { init_codefold(0); });
const char * path
Definition iterators.h:119
enum cgroup_file_type type
Definition iterators.h:117
short depth
Definition iterators.h:132
-
Definition iterators.h:315
-
char name[FILENAME_MAX]
Definition iterators.h:317
-
char path[FILENAME_MAX]
Definition iterators.h:319
-
Definition iterators.h:237
-
Definition libcgroup-internal.h:121
-
Definition iterators.h:359
-
int enabled
Definition iterators.h:371
-
int hierarchy
Definition iterators.h:367
-
char name[FILENAME_MAX]
Definition iterators.h:361
-
int num_cgroups
Definition iterators.h:369
+
Definition iterators.h:313
+
char name[FILENAME_MAX]
Definition iterators.h:315
+
char path[FILENAME_MAX]
Definition iterators.h:317
+
Definition iterators.h:236
+
Definition iterators.h:357
+
int enabled
Definition iterators.h:369
+
int hierarchy
Definition iterators.h:365
+
char name[FILENAME_MAX]
Definition iterators.h:359
+
int num_cgroups
Definition iterators.h:367
diff --git a/todo.html b/todo.html index 09907bdb..3c12a845 100644 --- a/todo.html +++ b/todo.html @@ -79,20 +79,20 @@ $(function() {
should this function be really public?
Global cgroup_change_cgroup_uid_gid_flags (uid_t uid, gid_t gid, pid_t pid, int flags)
Determine thread-safeness and fix if not safe.
-
Global cgroup_create_cgroup (struct cgroup *cgroup, int ignore_ownership)
+
Global cgroup_create_cgroup (struct cgroup *cgrp, int ignore_ownership)
what is ignore_ownership good for?
-
Global cgroup_create_cgroup_from_parent (struct cgroup *cgroup, int ignore_ownership)
-

what is this good for? Why the list of controllers added by cgroup_add_controller() is not used, like in cgroup_create_cgroup()? I can't create subgroup of root group in just one hierarchy with this function!

+
Global cgroup_create_cgroup_from_parent (struct cgroup *cgrp, int ignore_ownership)
+

what is this good for? Why the list of controllers added by cgroup_add_controller() is not used, like in cgroup_create_cgroup()? I can't create subgroup of root group in just one hierarchy with this function!

what is ignore_ownership good for?

-
Global cgroup_delete_cgroup (struct cgroup *cgroup, int ignore_migration)
+
Global cgroup_delete_cgroup (struct cgroup *cgrp, int ignore_migration)
what is ignore_migration good for? rmdir() will fail if tasks were not moved.
Global CGROUP_FILE_TYPE_OTHER
really?
-
Global cgroup_free_controllers (struct cgroup *cgroup)
+
Global cgroup_free_controllers (struct cgroup *cgrp)
should this function be public???
-
Global cgroup_get_cgroup (struct cgroup *cgroup)
-
what is this function good for? Why is not considered only the list of controllers attached by cgroup_add_controller()? What owners will return cgroup_get_uid_gid() if the group is in multiple hierarchies, each with different owner of tasks file?
+
Global cgroup_get_cgroup (struct cgroup *cgrp)
+
what is this function good for? Why is not considered only the list of controllers attached by cgroup_add_controller()? What owners will return cgroup_get_uid_gid() if the group is in multiple hierarchies, each with different owner of tasks file?
Global cgroup_get_value_string (struct cgroup_controller *controller, const char *name, char **value)
rephrase, it's too vague... How big is the buffer actually?
Global cgroup_init_rules_cache (void)
diff --git a/tools_8h_source.html b/tools_8h_source.html index 2d5484c2..d7c5ac80 100644 --- a/tools_8h_source.html +++ b/tools_8h_source.html @@ -99,17 +99,16 @@ $(document).ready(function() { init_codefold(0); });
23extern "C" {
24#endif
25
-
41int cgroup_cgxget(struct cgroup **cg,
-
42 enum cg_version_t version, bool ignore_unmappable);
-
43
-
54int cgroup_cgxset(const struct cgroup * const cg,
-
55 enum cg_version_t version, bool ignore_unmappable);
-
56
-
57#ifdef __cplusplus
-
58} /* extern "C" */
-
59#endif
-
60
-
61#endif /* _LIBCGROUP_TOOLS_H */
+
41int cgroup_cgxget(struct cgroup **cgrp, enum cg_version_t version, bool ignore_unmappable);
+
42
+
53int cgroup_cgxset(const struct cgroup * const cgrp,
+
54 enum cg_version_t version, bool ignore_unmappable);
+
55
+
56#ifdef __cplusplus
+
57} /* extern "C" */
+
58#endif
+
59
+
60#endif /* _LIBCGROUP_TOOLS_H */
Definition libcgroup-internal.h:121