summaryrefslogtreecommitdiff
path: root/src/core/manager.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-01-15 20:08:42 +0100
committerDaniel Mack <daniel@zonque.org>2015-09-16 00:21:55 +0200
commit32ee7d3309816994a02b3ff000e9734120d71214 (patch)
tree1c36747a33ddbeac78e72ea1fdafd807afbc98a7 /src/core/manager.h
parent0d9f6d4f615077a948af220e18d1b257ab466ba6 (diff)
cgroup: add support for net_cls controllers
Add a new config directive called NetClass= to CGroup enabled units. Allowed values are positive numbers for fix assignments and "auto" for picking a free value automatically, for which we need to keep track of dynamically assigned net class IDs of units. Introduce a hash table for this, and also record the last ID that was given out, so the allocator can start its search for the next 'hole' from there. This could eventually be optimized with something like an irb. The class IDs up to 65536 are considered reserved and won't be assigned automatically by systemd. This barrier can be made a config directive in the future. Values set in unit files are stored in the CGroupContext of the unit and considered read-only. The actually assigned number (which may have been chosen dynamically) is stored in the unit itself and is guaranteed to remain stable as long as the unit is active. In the CGroup controller, set the configured CGroup net class to net_cls.classid. Multiple unit may share the same net class ID, and those which do are linked together.
Diffstat (limited to 'src/core/manager.h')
-rw-r--r--src/core/manager.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/manager.h b/src/core/manager.h
index 5cf0dbd508..b955982100 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -303,6 +303,10 @@ struct Manager {
const char *unit_log_format_string;
int first_boot;
+
+ /* Used for NetClass=auto units */
+ Hashmap *cgroup_netclass_registry;
+ uint32_t cgroup_netclass_registry_last;
};
int manager_new(ManagerRunningAs running_as, bool test_run, Manager **m);