1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-20 14:36:17 +02:00
youki/crates/libcgroups/src/stub/systemd/manager.rs
Eric Fang f4e7e300e6
Fix the feature test and turn on in CI (#2060)
* reworked the justfile to be explicit with path

Signed-off-by: yihuaf <yihuaf@unkies.org>

* fix the feature tests

Signed-off-by: yihuaf <yihuaf@unkies.org>

* add the musl test

Signed-off-by: yihuaf <yihuaf@unkies.org>

* moving all stub into a single dir

Signed-off-by: yihuaf <yihuaf@unkies.org>

---------

Signed-off-by: yihuaf <yihuaf@unkies.org>
2023-06-19 21:21:18 +09:00

44 lines
1.2 KiB
Rust

use crate::common::{AnyCgroupManager, CgroupManager};
#[derive(thiserror::Error, Debug)]
pub enum SystemdManagerError {
#[error("systemd cgroup feature is required, but was not enabled during compile time")]
NotEnabled,
}
pub struct Manager {}
impl Manager {
pub fn any(self) -> AnyCgroupManager {
AnyCgroupManager::Systemd(self)
}
}
impl CgroupManager for Manager {
type Error = SystemdManagerError;
fn add_task(&self, _pid: nix::unistd::Pid) -> Result<(), Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
fn apply(&self, _controller_opt: &crate::common::ControllerOpt) -> Result<(), Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
fn remove(&self) -> Result<(), Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
fn freeze(&self, _state: crate::common::FreezerState) -> Result<(), Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
fn stats(&self) -> Result<crate::stats::Stats, Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
fn get_all_pids(&self) -> Result<Vec<nix::unistd::Pid>, Self::Error> {
Err(SystemdManagerError::NotEnabled)
}
}