mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
`SystemdCgroup` takes a `parent`, which is the name of a slice, and a `unit`, which is the name of a slice or a scope unit, and provides methods to start, kill the unit, as well as set properties for the unit. The mods, `cpu`, `memory`, `cpuset`, and `pids`, are designed to generate properties quickly. It hides the difference between cgroups v1 and v2, and does simple checks for the systemd version and arguments. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
17 lines
409 B
Rust
17 lines
409 B
Rust
// Copyright (c) 2025 Ant Group
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0 or MIT
|
|
//
|
|
|
|
use zbus::blocking::Connection;
|
|
use zbus::Result;
|
|
|
|
use crate::systemd::dbus::systemd_manager_proxy::ManagerProxyBlocking as SystemManager;
|
|
|
|
pub(crate) fn systemd_manager_proxy<'a>() -> Result<SystemManager<'a>> {
|
|
let connection = Connection::system()?;
|
|
let proxy = SystemManager::new(&connection)?;
|
|
|
|
Ok(proxy)
|
|
}
|