This is an automated email from the ASF dual-hosted git repository.
bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
The following commit(s) were added to refs/heads/master by this push:
new bd23c513d [cgroups2] Introduce read() and write() utilities to read
and write to cgroup controls.
bd23c513d is described below
commit bd23c513d555fcb8f981f37c8cd5f97bd30eaacd
Author: Devin Leamy <[email protected]>
AuthorDate: Wed Feb 28 12:16:46 2024 -0500
[cgroups2] Introduce read() and write() utilities to read and write to
cgroup controls.
Introduces:
- `cgroups2::read()`: Read a control file to a string.
- `cgroups2::write()`: Write a string to a control file.
reading and writing primitives for controls.
Review: https://reviews.apache.org/r/74874/
---
src/linux/cgroups2.cpp | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/linux/cgroups2.cpp b/src/linux/cgroups2.cpp
index ec7ba9e40..0a1da2cb4 100644
--- a/src/linux/cgroups2.cpp
+++ b/src/linux/cgroups2.cpp
@@ -54,6 +54,29 @@ const std::string TYPE = "cgroup.type";
} // namespace control {
+
+Try<string> read(const string& cgroup, const string& control)
+{
+ return os::read(path::join(
+ cgroups2::MOUNT_POINT,
+ cgroup,
+ control));
+}
+
+
+Try<Nothing> write(
+ const string& cgroup,
+ const string& control,
+ const string& value)
+{
+ return os::write(path::join(
+ cgroups2::MOUNT_POINT,
+ cgroup,
+ control
+ ), value);
+}
+
+
bool enabled()
{
Try<bool> supported = mesos::internal::fs::supported(cgroups2::FILE_SYSTEM);