# Module cgroups

- Description
- Data Types
- Function Index
- Function Details

### cgroups Manipulation Functions

.

Copyright © 2016-2020 Michael Truog

Version: 2.0.1 Nov 26 2020 14:26:58 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### cgroups Manipulation Functions

## Data Types

### new_error_reasons()

`new_error_reasons() = {version_default, Version::pos_integer()} | {path_mounts, Status::pos_integer(), Output::[binary()]} | {path_v1, Status::pos_integer(), Output::[binary()]} | {path_v2, Status::pos_integer(), Output::[binary()]}`

### options()

`options() = [{version_default, pos_integer()} | {version_default_required, boolean()} | {path_v1, string()} | {path_v2, string()} | {path_mounts, string() | undefined}]`

## Function Index

create/4 | #### Create a specific cgroup. With cgroups v1, files cpuset.cpus and cpuset.mems are set if they are not initialized due to cgroup.clone_children (using the root values).
delete/2 | #### Delete a specific cgroup. The cgroup must not contain any OS processes for this function to succeed.
delete_recursive/2 | #### Delete a specific cgroup and as many non-leaf cgroups as possible. The cgroup must not contain any OS processes for this function to succeed.
destroy/1 | #### Destroy cgroups state data. .
new/0 | #### Create new cgroups state data. .
new/1 | #### Create new cgroups state data with local options. .
shell/2 | #### Execute a command with the default shell. .
update/4 | #### Update a cgroup path. May be used on the cgroup root path.
update_or_create/4 | #### Update or create a specific cgroup. .
version/1 | #### The cgroup version used. .

## Function Details

### create/4

`create(CGroupPath::nonempty_string(), OSPids::[pos_integer()], CGroupParameters::[{string(), string()}], State::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok | {error, any()}`

#### Create a specific cgroup.

With cgroups v1, files cpuset.cpus and cpuset.mems are set if they are not initialized due to cgroup.clone_children (using the root values).

### delete/2

`delete(CGroupPath::nonempty_string(), State::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok | {error, any()}`

#### Delete a specific cgroup.

The cgroup must not contain any OS processes for this function to succeed.

### delete_recursive/2

`delete_recursive(CGroupPath::nonempty_string(), State::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok | {error, any()}`

#### Delete a specific cgroup and as many non-leaf cgroups as possible.

The cgroup must not contain any OS processes for this function to succeed.

### destroy/1

`destroy(Cgroups::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok`

#### Destroy cgroups state data.

### new/0

`new() -> {ok, #cgroups{version = pos_integer(), path = string(), mounted = boolean()}} | {error, new_error_reasons()}`

#### Create new cgroups state data.

### new/1

`new(Options0::options()) -> {ok, #cgroups{version = pos_integer(), path = string(), mounted = boolean()}} | {error, new_error_reasons()}`

#### Create new cgroups state data with local options.

### shell/2

`shell(Command::string(), Arguments::list()) -> {non_neg_integer(), [binary()]}`

#### Execute a command with the default shell.

### update/4

`update(CGroupPath::string(), OSPids::[pos_integer()], CGroupParameters::[{string(), string()}], State::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok | {error, any()}`

#### Update a cgroup path.

May be used on the cgroup root path.

### update_or_create/4

`update_or_create(CGroupPath::nonempty_string(), OSPids::[pos_integer()], CGroupParameters::[{string(), string()}], State::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> ok | {error, any()}`

#### Update or create a specific cgroup.

### version/1

`version(Cgroups::#cgroups{version = pos_integer(), path = string(), mounted = boolean()}) -> pos_integer()`

#### The cgroup version used.

Generated by EDoc