libcgroup
|
Configuration file | |
| |
int | cgroup_config_load_config (const char *pathname) |
int | cgroup_unload_cgroups (void) |
int | cgroup_config_unload_config (const char *pathname, int flags) |
int | cgroup_config_set_default (struct cgroup *new_default) |
int | cgroup_init_templates_cache (char *pathname) |
int | cgroup_reload_cached_templates (char *pathname) |
int | cgroup_load_templates_cache_from_files (int *file_index) |
void | cgroup_templates_cache_set_source_files (struct cgroup_string_list *tmpl_files) |
int | cgroup_config_create_template_group (struct cgroup *cgrp, char *template_name, int flags) |
int cgroup_config_create_template_group | ( | struct cgroup * | cgrp, |
char * | template_name, | ||
int | flags ) |
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
pathname | Name of the configuration file with template definitions |
cgroup | Wanted control group - contains substitute name and wanted controllers. |
template_name | Template name used for cgroup setting |
flags | Bit flags to change the behavior |
int cgroup_config_load_config | ( | const char * | pathname | ) |
Load configuration file and mount and create control groups described there. See cgconfig.conf man page for format of the file.
pathname | Name of the configuration file to load. |
int cgroup_config_set_default | ( | struct cgroup * | new_default | ) |
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.
new_default | New default permissions from this group are copied to libcgroup internal structures. I.e., this group can be freed immediately after this function returns. |
int cgroup_config_unload_config | ( | const char * | pathname, |
int | flags ) |
Delete all cgroups and unmount all mount points defined in specified config file.
The groups are either removed recursively or only the empty ones, based on given flags. Mount point are always umounted only if they are empty, regardless of any flags.
The groups are sorted before they are removed, so the removal of empty ones actually works (i.e. subgroups are removed first).
pathname | Name of the configuration file to unload. |
flags | Combination of CGFLAG_DELETE_* flags, which indicate what and how to delete. |
int cgroup_init_templates_cache | ( | char * | pathname | ) |
Initializes the templates cache and load it from file pathname.
Initializes the templates cache.
int cgroup_load_templates_cache_from_files | ( | int * | file_index | ) |
Load the templates cache from files. Before calling this function, cgroup_templates_cache_set_source_files has to be called first.
file_index | index of file which was unable to be parsed |
int cgroup_reload_cached_templates | ( | char * | pathname | ) |
Reloads the templates list from file pathname.
Reloads the templates list, using the given configuration file.
void cgroup_templates_cache_set_source_files | ( | struct cgroup_string_list * | tmpl_files | ) |
Setting source files of templates. This function has to be called before any call of cgroup_load_templates_cache_from_files.
tmpl_files |
int cgroup_unload_cgroups | ( | void | ) |
Delete all control groups and unmount all hierarchies.