mirror of
https://github.com/kata-containers/cgroups-rs.git
synced 2026-08-05 02:13:23 +00:00
fs: Move all files to fs subdirectory
Prepare to implement FsManager, which should be done in the following-up commits. Apart from that, no code is not modified. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This commit is contained in:
@@ -11,11 +11,11 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{read_string_from, read_u64_from};
|
use crate::fs::{read_string_from, read_u64_from};
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
BlkIoResources, ControllIdentifier, ControllerInternal, Controllers, CustomizedAttribute,
|
BlkIoResources, ControllIdentifier, ControllerInternal, Controllers, CustomizedAttribute,
|
||||||
Resources, Subsystem,
|
Resources, Subsystem,
|
||||||
};
|
};
|
||||||
@@ -829,9 +829,9 @@ impl BlkIoController {
|
|||||||
impl CustomizedAttribute for BlkIoController {}
|
impl CustomizedAttribute for BlkIoController {}
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
use crate::blkio::{parse_blkio_data, BlkIoData};
|
use crate::fs::blkio::{parse_blkio_data, BlkIoData};
|
||||||
use crate::blkio::{parse_io_service, parse_io_service_total, IoService};
|
use crate::fs::blkio::{parse_io_service, parse_io_service_total, IoService};
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
static TEST_VALUE: &str = "\
|
static TEST_VALUE: &str = "\
|
||||||
8:32 Read 4280320
|
8:32 Read 4280320
|
||||||
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
//! This module handles cgroup operations. Start here!
|
//! This module handles cgroup operations. Start here!
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::hierarchies::V1;
|
use crate::fs::hierarchies::V1;
|
||||||
use crate::{CgroupPid, ControllIdentifier, Controller, Hierarchy, Resources, Subsystem};
|
use crate::fs::{CgroupPid, ControllIdentifier, Controller, Hierarchy, Resources, Subsystem};
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::From;
|
use std::convert::From;
|
||||||
@@ -51,7 +51,7 @@ impl Clone for Cgroup {
|
|||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Cgroup {
|
Cgroup {
|
||||||
subsystems: self.subsystems.clone(),
|
subsystems: self.subsystems.clone(),
|
||||||
hier: crate::hierarchies::auto(),
|
hier: crate::fs::hierarchies::auto(),
|
||||||
path: self.path.clone(),
|
path: self.path.clone(),
|
||||||
specified_controllers: None,
|
specified_controllers: None,
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ impl Default for Cgroup {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Cgroup {
|
Cgroup {
|
||||||
subsystems: Vec::new(),
|
subsystems: Vec::new(),
|
||||||
hier: crate::hierarchies::auto(),
|
hier: crate::fs::hierarchies::auto(),
|
||||||
path: "".to_string(),
|
path: "".to_string(),
|
||||||
specified_controllers: None,
|
specified_controllers: None,
|
||||||
}
|
}
|
||||||
@@ -16,10 +16,10 @@
|
|||||||
//! by a call to `build()`.
|
//! by a call to `build()`.
|
||||||
//!
|
//!
|
||||||
//! ```rust,no_run
|
//! ```rust,no_run
|
||||||
//! # use cgroups_rs::*;
|
//! # use cgroups_rs::fs::*;
|
||||||
//! # use cgroups_rs::devices::*;
|
//! # use cgroups_rs::fs::devices::*;
|
||||||
//! # use cgroups_rs::cgroup_builder::*;
|
//! # use cgroups_rs::fs::cgroup_builder::*;
|
||||||
//! let h = cgroups_rs::hierarchies::auto();
|
//! let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
//! let cgroup: Cgroup = CgroupBuilder::new("hello")
|
//! let cgroup: Cgroup = CgroupBuilder::new("hello")
|
||||||
//! .memory()
|
//! .memory()
|
||||||
//! .kernel_memory_limit(1024 * 1024)
|
//! .kernel_memory_limit(1024 * 1024)
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
//! .build(h).unwrap();
|
//! .build(h).unwrap();
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
BlkIoDeviceResource, BlkIoDeviceThrottleResource, Cgroup, DeviceResource, Error, Hierarchy,
|
BlkIoDeviceResource, BlkIoDeviceThrottleResource, Cgroup, DeviceResource, Error, Hierarchy,
|
||||||
HugePageResource, MaxValue, NetworkPriority, Resources,
|
HugePageResource, MaxValue, NetworkPriority, Resources,
|
||||||
};
|
};
|
||||||
@@ -250,9 +250,9 @@ impl DeviceResourceBuilder {
|
|||||||
mut self,
|
mut self,
|
||||||
major: i64,
|
major: i64,
|
||||||
minor: i64,
|
minor: i64,
|
||||||
devtype: crate::devices::DeviceType,
|
devtype: crate::fs::devices::DeviceType,
|
||||||
allow: bool,
|
allow: bool,
|
||||||
access: Vec<crate::devices::DevicePermissions>,
|
access: Vec<crate::fs::devices::DevicePermissions>,
|
||||||
) -> DeviceResourceBuilder {
|
) -> DeviceResourceBuilder {
|
||||||
self.cgroup.resources.devices.devices.push(DeviceResource {
|
self.cgroup.resources.devices.devices.push(DeviceResource {
|
||||||
allow,
|
allow,
|
||||||
@@ -13,11 +13,11 @@ use std::fs::File;
|
|||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
use crate::{parse_max_value, read_i64_from, read_u64_from};
|
use crate::fs::{parse_max_value, read_i64_from, read_u64_from};
|
||||||
|
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, CpuResources, CustomizedAttribute,
|
ControllIdentifier, ControllerInternal, Controllers, CpuResources, CustomizedAttribute,
|
||||||
MaxValue, Resources, Subsystem,
|
MaxValue, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{read_string_from, read_u64_from};
|
use crate::fs::{read_string_from, read_u64_from};
|
||||||
use crate::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
use crate::fs::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
||||||
|
|
||||||
/// A controller that allows controlling the `cpuacct` subsystem of a Cgroup.
|
/// A controller that allows controlling the `cpuacct` subsystem of a Cgroup.
|
||||||
///
|
///
|
||||||
@@ -13,11 +13,11 @@ use log::*;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{read_string_from, read_u64_from};
|
use crate::fs::{read_string_from, read_u64_from};
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, CpuResources, Resources, Subsystem,
|
ControllIdentifier, ControllerInternal, Controllers, CpuResources, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -591,7 +591,7 @@ impl CpuSetController {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::cpuset;
|
use crate::fs::cpuset;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_range() {
|
fn test_parse_range() {
|
||||||
let test_cases = vec![
|
let test_cases = vec![
|
||||||
@@ -12,10 +12,10 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, DeviceResource, DeviceResources,
|
ControllIdentifier, ControllerInternal, Controllers, DeviceResource, DeviceResources,
|
||||||
Resources, Subsystem,
|
Resources, Subsystem,
|
||||||
};
|
};
|
||||||
@@ -12,8 +12,8 @@ use std::path::Path;
|
|||||||
use std::sync::mpsc::{self, Receiver};
|
use std::sync::mpsc::{self, Receiver};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
// notify_on_oom returns channel on which you can expect event about OOM,
|
// notify_on_oom returns channel on which you can expect event about OOM,
|
||||||
// if process died without OOM this channel will be closed.
|
// if process died without OOM this channel will be closed.
|
||||||
@@ -11,10 +11,10 @@
|
|||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
use crate::fs::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
||||||
|
|
||||||
/// A controller that allows controlling the `freezer` subsystem of a Cgroup.
|
/// A controller that allows controlling the `freezer` subsystem of a Cgroup.
|
||||||
///
|
///
|
||||||
@@ -11,23 +11,23 @@ use std::fs::File;
|
|||||||
use std::io::{BufRead, BufReader};
|
use std::io::{BufRead, BufReader};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use crate::blkio::BlkIoController;
|
use crate::fs::blkio::BlkIoController;
|
||||||
use crate::cpu::CpuController;
|
use crate::fs::cpu::CpuController;
|
||||||
use crate::cpuacct::CpuAcctController;
|
use crate::fs::cpuacct::CpuAcctController;
|
||||||
use crate::cpuset::CpuSetController;
|
use crate::fs::cpuset::CpuSetController;
|
||||||
use crate::devices::DevicesController;
|
use crate::fs::devices::DevicesController;
|
||||||
use crate::freezer::FreezerController;
|
use crate::fs::freezer::FreezerController;
|
||||||
use crate::hugetlb::HugeTlbController;
|
use crate::fs::hugetlb::HugeTlbController;
|
||||||
use crate::memory::MemController;
|
use crate::fs::memory::MemController;
|
||||||
use crate::net_cls::NetClsController;
|
use crate::fs::net_cls::NetClsController;
|
||||||
use crate::net_prio::NetPrioController;
|
use crate::fs::net_prio::NetPrioController;
|
||||||
use crate::perf_event::PerfEventController;
|
use crate::fs::perf_event::PerfEventController;
|
||||||
use crate::pid::PidController;
|
use crate::fs::pid::PidController;
|
||||||
use crate::rdma::RdmaController;
|
use crate::fs::rdma::RdmaController;
|
||||||
use crate::systemd::SystemdController;
|
use crate::fs::systemd::SystemdController;
|
||||||
use crate::{Controllers, Hierarchy, Subsystem};
|
use crate::fs::{Controllers, Hierarchy, Subsystem};
|
||||||
|
|
||||||
use crate::cgroup::Cgroup;
|
use crate::fs::cgroup::Cgroup;
|
||||||
|
|
||||||
/// Process mounts information.
|
/// Process mounts information.
|
||||||
///
|
///
|
||||||
@@ -12,11 +12,11 @@ use log::warn;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
use crate::{flat_keyed_to_vec, read_u64_from};
|
use crate::fs::{flat_keyed_to_vec, read_u64_from};
|
||||||
|
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, HugePageResources, Resources, Subsystem,
|
ControllIdentifier, ControllerInternal, Controllers, HugePageResources, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -14,14 +14,14 @@ use std::io::Write;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::mpsc::Receiver;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
use crate::events;
|
use crate::fs::events;
|
||||||
use crate::{read_i64_from, read_string_from, read_u64_from};
|
use crate::fs::{read_i64_from, read_string_from, read_u64_from};
|
||||||
|
|
||||||
use crate::flat_keyed_to_hashmap;
|
use crate::fs::flat_keyed_to_hashmap;
|
||||||
|
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, CustomizedAttribute, MaxValue,
|
ControllIdentifier, ControllerInternal, Controllers, CustomizedAttribute, MaxValue,
|
||||||
MemoryResources, Resources, Subsystem,
|
MemoryResources, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
@@ -1002,7 +1002,7 @@ impl<'a> From<&'a Subsystem> for &'a MemController {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::memory::{
|
use crate::fs::memory::{
|
||||||
parse_memory_stat, parse_numa_stat, parse_oom_control, MemoryStat, NumaStat, OomControl,
|
parse_memory_stat, parse_numa_stat, parse_oom_control, MemoryStat, NumaStat, OomControl,
|
||||||
};
|
};
|
||||||
|
|
||||||
1032
src/fs/mod.rs
Normal file
1032
src/fs/mod.rs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -10,11 +10,11 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::read_u64_from;
|
use crate::fs::read_u64_from;
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources, Subsystem,
|
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -11,11 +11,11 @@ use std::collections::HashMap;
|
|||||||
use std::io::{BufRead, BufReader, Write};
|
use std::io::{BufRead, BufReader, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::read_u64_from;
|
use crate::fs::read_u64_from;
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources, Subsystem,
|
ControllIdentifier, ControllerInternal, Controllers, NetworkResources, Resources, Subsystem,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
//! [tools/perf/Documentation/perf-record.txt](https://raw.githubusercontent.com/torvalds/linux/master/tools/perf/Documentation/perf-record.txt)
|
//! [tools/perf/Documentation/perf-record.txt](https://raw.githubusercontent.com/torvalds/linux/master/tools/perf/Documentation/perf-record.txt)
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
use crate::fs::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
||||||
|
|
||||||
/// A controller that allows controlling the `perf_event` subsystem of a Cgroup.
|
/// A controller that allows controlling the `perf_event` subsystem of a Cgroup.
|
||||||
///
|
///
|
||||||
@@ -11,11 +11,11 @@
|
|||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::read_u64_from;
|
use crate::fs::read_u64_from;
|
||||||
use crate::{
|
use crate::fs::{
|
||||||
parse_max_value, ControllIdentifier, ControllerInternal, Controllers, MaxValue, PidResources,
|
parse_max_value, ControllIdentifier, ControllerInternal, Controllers, MaxValue, PidResources,
|
||||||
Resources, Subsystem,
|
Resources, Subsystem,
|
||||||
};
|
};
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::ErrorKind::*;
|
use crate::fs::error::ErrorKind::*;
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::read_string_from;
|
use crate::fs::read_string_from;
|
||||||
use crate::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
use crate::fs::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
||||||
|
|
||||||
/// A controller that allows controlling the `rdma` subsystem of a Cgroup.
|
/// A controller that allows controlling the `rdma` subsystem of a Cgroup.
|
||||||
///
|
///
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
//!
|
//!
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::error::*;
|
use crate::fs::error::*;
|
||||||
|
|
||||||
use crate::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
use crate::fs::{ControllIdentifier, ControllerInternal, Controllers, Resources, Subsystem};
|
||||||
|
|
||||||
/// A controller that allows controlling the `systemd` subsystem of a Cgroup.
|
/// A controller that allows controlling the `systemd` subsystem of a Cgroup.
|
||||||
///
|
///
|
||||||
1029
src/lib.rs
1029
src/lib.rs
File diff suppressed because it is too large
Load Diff
@@ -5,19 +5,19 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Some simple tests covering the builder pattern for control groups.
|
//! Some simple tests covering the builder pattern for control groups.
|
||||||
use cgroups_rs::blkio::*;
|
use cgroups_rs::fs::blkio::*;
|
||||||
use cgroups_rs::cgroup_builder::*;
|
use cgroups_rs::fs::cgroup_builder::*;
|
||||||
use cgroups_rs::cpu::*;
|
use cgroups_rs::fs::cpu::*;
|
||||||
use cgroups_rs::devices::*;
|
use cgroups_rs::fs::devices::*;
|
||||||
use cgroups_rs::hugetlb::*;
|
use cgroups_rs::fs::hugetlb::*;
|
||||||
use cgroups_rs::memory::*;
|
use cgroups_rs::fs::memory::*;
|
||||||
use cgroups_rs::net_cls::*;
|
use cgroups_rs::fs::net_cls::*;
|
||||||
use cgroups_rs::pid::*;
|
use cgroups_rs::fs::pid::*;
|
||||||
use cgroups_rs::*;
|
use cgroups_rs::fs::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_cpu_res_build() {
|
pub fn test_cpu_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg: Cgroup = CgroupBuilder::new("test_cpu_res_build")
|
let cg: Cgroup = CgroupBuilder::new("test_cpu_res_build")
|
||||||
.cpu()
|
.cpu()
|
||||||
.shares(85)
|
.shares(85)
|
||||||
@@ -36,7 +36,7 @@ pub fn test_cpu_res_build() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_memory_res_build() {
|
pub fn test_memory_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg: Cgroup = CgroupBuilder::new("test_memory_res_build")
|
let cg: Cgroup = CgroupBuilder::new("test_memory_res_build")
|
||||||
.memory()
|
.memory()
|
||||||
.kernel_memory_limit(128 * 1024 * 1024)
|
.kernel_memory_limit(128 * 1024 * 1024)
|
||||||
@@ -61,7 +61,7 @@ pub fn test_memory_res_build() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_pid_res_build() {
|
pub fn test_pid_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg: Cgroup = CgroupBuilder::new("test_pid_res_build")
|
let cg: Cgroup = CgroupBuilder::new("test_pid_res_build")
|
||||||
.pid()
|
.pid()
|
||||||
.maximum_number_of_processes(MaxValue::Value(123))
|
.maximum_number_of_processes(MaxValue::Value(123))
|
||||||
@@ -81,7 +81,7 @@ pub fn test_pid_res_build() {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore] // ignore this test for now, not sure why my kernel doesn't like it
|
#[ignore] // ignore this test for now, not sure why my kernel doesn't like it
|
||||||
pub fn test_devices_res_build() {
|
pub fn test_devices_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg: Cgroup = CgroupBuilder::new("test_devices_res_build")
|
let cg: Cgroup = CgroupBuilder::new("test_devices_res_build")
|
||||||
.devices()
|
.devices()
|
||||||
.device(1, 6, DeviceType::Char, true, vec![DevicePermissions::Read])
|
.device(1, 6, DeviceType::Char, true, vec![DevicePermissions::Read])
|
||||||
@@ -108,7 +108,7 @@ pub fn test_devices_res_build() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_network_res_build() {
|
pub fn test_network_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
if h.v2() {
|
if h.v2() {
|
||||||
// FIXME add cases for v2
|
// FIXME add cases for v2
|
||||||
return;
|
return;
|
||||||
@@ -130,7 +130,7 @@ pub fn test_network_res_build() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn test_hugepages_res_build() {
|
pub fn test_hugepages_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
if h.v2() {
|
if h.v2() {
|
||||||
// FIXME add cases for v2
|
// FIXME add cases for v2
|
||||||
return;
|
return;
|
||||||
@@ -153,7 +153,7 @@ pub fn test_hugepages_res_build() {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore] // high version kernel not support `blkio.weight`
|
#[ignore] // high version kernel not support `blkio.weight`
|
||||||
pub fn test_blkio_res_build() {
|
pub fn test_blkio_res_build() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg: Cgroup = CgroupBuilder::new("test_blkio_res_build")
|
let cg: Cgroup = CgroupBuilder::new("test_blkio_res_build")
|
||||||
.blkio()
|
.blkio()
|
||||||
.weight(100)
|
.weight(100)
|
||||||
|
|||||||
@@ -5,20 +5,22 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Simple unit tests about the control groups system.
|
//! Simple unit tests about the control groups system.
|
||||||
use cgroups_rs::cgroup::{
|
|
||||||
CGROUP_MODE_DOMAIN, CGROUP_MODE_DOMAIN_INVALID, CGROUP_MODE_DOMAIN_THREADED,
|
|
||||||
CGROUP_MODE_THREADED,
|
|
||||||
};
|
|
||||||
use cgroups_rs::memory::MemController;
|
|
||||||
use cgroups_rs::Controller;
|
|
||||||
use cgroups_rs::{Cgroup, CgroupPid, Subsystem};
|
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
use cgroups_rs::fs::cgroup::{
|
||||||
|
CGROUP_MODE_DOMAIN, CGROUP_MODE_DOMAIN_INVALID, CGROUP_MODE_DOMAIN_THREADED,
|
||||||
|
CGROUP_MODE_THREADED,
|
||||||
|
};
|
||||||
|
use cgroups_rs::fs::memory::MemController;
|
||||||
|
use cgroups_rs::fs::Controller;
|
||||||
|
use cgroups_rs::fs::{Cgroup, Subsystem};
|
||||||
|
use cgroups_rs::CgroupPid;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_procs_iterator_cgroup() {
|
fn test_procs_iterator_cgroup() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
||||||
let cg = Cgroup::new(h, String::from("test_procs_iterator_cgroup")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_procs_iterator_cgroup")).unwrap();
|
||||||
{
|
{
|
||||||
@@ -42,10 +44,10 @@ fn test_procs_iterator_cgroup() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tasks_iterator_cgroup_v1() {
|
fn test_tasks_iterator_cgroup_v1() {
|
||||||
if cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
||||||
let cg = Cgroup::new(h, String::from("test_tasks_iterator_cgroup_v1")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_tasks_iterator_cgroup_v1")).unwrap();
|
||||||
{
|
{
|
||||||
@@ -69,23 +71,23 @@ fn test_tasks_iterator_cgroup_v1() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_tasks_iterator_cgroup_threaded_mode() {
|
fn test_tasks_iterator_cgroup_threaded_mode() {
|
||||||
if !cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if !cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
let pid = libc::pid_t::from(nix::unistd::getpid()) as u64;
|
||||||
let cg = Cgroup::new(
|
let cg = Cgroup::new(
|
||||||
cgroups_rs::hierarchies::auto(),
|
cgroups_rs::fs::hierarchies::auto(),
|
||||||
String::from("test_tasks_iterator_cgroup_threaded_mode"),
|
String::from("test_tasks_iterator_cgroup_threaded_mode"),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let cg_threaded_sub1 = Cgroup::new_with_specified_controllers(
|
let cg_threaded_sub1 = Cgroup::new_with_specified_controllers(
|
||||||
cgroups_rs::hierarchies::auto(),
|
cgroups_rs::fs::hierarchies::auto(),
|
||||||
String::from("test_tasks_iterator_cgroup_threaded_mode/threaded_sub1"),
|
String::from("test_tasks_iterator_cgroup_threaded_mode/threaded_sub1"),
|
||||||
Some(vec![String::from("cpuset"), String::from("cpu")]),
|
Some(vec![String::from("cpuset"), String::from("cpu")]),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let cg_threaded_sub2 = Cgroup::new_with_specified_controllers(
|
let cg_threaded_sub2 = Cgroup::new_with_specified_controllers(
|
||||||
cgroups_rs::hierarchies::auto(),
|
cgroups_rs::fs::hierarchies::auto(),
|
||||||
String::from("test_tasks_iterator_cgroup_threaded_mode/threaded_sub2"),
|
String::from("test_tasks_iterator_cgroup_threaded_mode/threaded_sub2"),
|
||||||
Some(vec![String::from("cpuset"), String::from("cpu")]),
|
Some(vec![String::from("cpuset"), String::from("cpu")]),
|
||||||
)
|
)
|
||||||
@@ -163,10 +165,10 @@ fn test_tasks_iterator_cgroup_threaded_mode() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_kill_cgroup() {
|
fn test_kill_cgroup() {
|
||||||
if !cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if !cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_kill_cgroup")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_kill_cgroup")).unwrap();
|
||||||
{
|
{
|
||||||
// Spawn a proc, don't want to getpid(2) here.
|
// Spawn a proc, don't want to getpid(2) here.
|
||||||
@@ -206,10 +208,10 @@ fn test_kill_cgroup() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cgroup_with_relative_paths() {
|
fn test_cgroup_with_relative_paths() {
|
||||||
if cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cgroup_root = h.root();
|
let cgroup_root = h.root();
|
||||||
let cgroup_name = "test_cgroup_with_relative_paths";
|
let cgroup_name = "test_cgroup_with_relative_paths";
|
||||||
|
|
||||||
@@ -247,10 +249,10 @@ fn test_cgroup_with_relative_paths() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cgroup_v2() {
|
fn test_cgroup_v2() {
|
||||||
if !cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if !cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_v2")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_v2")).unwrap();
|
||||||
|
|
||||||
let mem_controller: &MemController = cg.controller_of().unwrap();
|
let mem_controller: &MemController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Simple unit tests about the CPU control groups system.
|
//! Simple unit tests about the CPU control groups system.
|
||||||
use cgroups_rs::cpu::CpuController;
|
use cgroups_rs::fs::cpu::CpuController;
|
||||||
use cgroups_rs::Cgroup;
|
use cgroups_rs::fs::Cgroup;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cfs_quota_and_periods() {
|
fn test_cfs_quota_and_periods() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_cfs_quota_and_periods")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_cfs_quota_and_periods")).unwrap();
|
||||||
|
|
||||||
let cpu_controller: &CpuController = cg.controller_of().unwrap();
|
let cpu_controller: &CpuController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -3,16 +3,16 @@
|
|||||||
//
|
//
|
||||||
// SPDX-License-Identifier: Apache-2.0 or MIT
|
// SPDX-License-Identifier: Apache-2.0 or MIT
|
||||||
//
|
//
|
||||||
|
|
||||||
use cgroups_rs::cpuset::CpuSetController;
|
|
||||||
use cgroups_rs::error::ErrorKind;
|
|
||||||
use cgroups_rs::{Cgroup, CgroupPid};
|
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
|
use cgroups_rs::fs::cpuset::CpuSetController;
|
||||||
|
use cgroups_rs::fs::error::ErrorKind;
|
||||||
|
use cgroups_rs::fs::Cgroup;
|
||||||
|
use cgroups_rs::CgroupPid;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cpuset_memory_pressure_root_cg() {
|
fn test_cpuset_memory_pressure_root_cg() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_cpuset_memory_pressure_root_cg")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_cpuset_memory_pressure_root_cg")).unwrap();
|
||||||
{
|
{
|
||||||
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
||||||
@@ -26,7 +26,7 @@ fn test_cpuset_memory_pressure_root_cg() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cpuset_set_cpus() {
|
fn test_cpuset_set_cpus() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_cpuset_set_cpus")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_cpuset_set_cpus")).unwrap();
|
||||||
{
|
{
|
||||||
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
||||||
@@ -63,7 +63,7 @@ fn test_cpuset_set_cpus() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_cpuset_set_cpus_add_task() {
|
fn test_cpuset_set_cpus_add_task() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_cpuset_set_cpus_add_task/sub-dir")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_cpuset_set_cpus_add_task/sub-dir")).unwrap();
|
||||||
|
|
||||||
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
let cpuset: &CpuSetController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -6,17 +6,17 @@
|
|||||||
|
|
||||||
//! Integration tests about the devices subsystem
|
//! Integration tests about the devices subsystem
|
||||||
|
|
||||||
use cgroups_rs::devices::{DevicePermissions, DeviceType, DevicesController};
|
use cgroups_rs::fs::devices::{DevicePermissions, DeviceType, DevicesController};
|
||||||
use cgroups_rs::{Cgroup, DeviceResource};
|
use cgroups_rs::fs::{Cgroup, DeviceResource};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_devices_parsing() {
|
fn test_devices_parsing() {
|
||||||
// now only v2
|
// now only v2
|
||||||
if cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_devices_parsing")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_devices_parsing")).unwrap();
|
||||||
{
|
{
|
||||||
let devices: &DevicesController = cg.controller_of().unwrap();
|
let devices: &DevicesController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Integration tests about the hugetlb subsystem
|
//! Integration tests about the hugetlb subsystem
|
||||||
use cgroups_rs::error::*;
|
use cgroups_rs::fs::error::*;
|
||||||
use cgroups_rs::hugetlb::{self, HugeTlbController};
|
use cgroups_rs::fs::hugetlb::{self, HugeTlbController};
|
||||||
use cgroups_rs::Cgroup;
|
use cgroups_rs::fs::Cgroup;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hugetlb_sizes() {
|
fn test_hugetlb_sizes() {
|
||||||
// now only v2
|
// now only v2
|
||||||
if cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
|
if cgroups_rs::fs::hierarchies::is_cgroup2_unified_mode() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_hugetlb_sizes")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_hugetlb_sizes")).unwrap();
|
||||||
{
|
{
|
||||||
let hugetlb_controller: &HugeTlbController = cg.controller_of().unwrap();
|
let hugetlb_controller: &HugeTlbController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -4,13 +4,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Integration tests about the hugetlb subsystem
|
//! Integration tests about the hugetlb subsystem
|
||||||
use cgroups_rs::memory::{MemController, SetMemory};
|
use cgroups_rs::fs::memory::{MemController, SetMemory};
|
||||||
use cgroups_rs::Controller;
|
use cgroups_rs::fs::{Cgroup, Controller, MaxValue};
|
||||||
use cgroups_rs::{Cgroup, MaxValue};
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_disable_oom_killer() {
|
fn test_disable_oom_killer() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_disable_oom_killer")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_disable_oom_killer")).unwrap();
|
||||||
{
|
{
|
||||||
let mem_controller: &MemController = cg.controller_of().unwrap();
|
let mem_controller: &MemController = cg.controller_of().unwrap();
|
||||||
@@ -35,7 +34,7 @@ fn test_disable_oom_killer() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_kmem_limit_v1() {
|
fn set_kmem_limit_v1() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
if h.v2() {
|
if h.v2() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -50,7 +49,7 @@ fn set_kmem_limit_v1() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_mem_v2() {
|
fn set_mem_v2() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
if !h.v2() {
|
if !h.v2() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,18 +5,15 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Integration tests about the pids subsystem
|
//! Integration tests about the pids subsystem
|
||||||
use cgroups_rs::pid::PidController;
|
use cgroups_rs::fs::pid::PidController;
|
||||||
use cgroups_rs::Controller;
|
use cgroups_rs::fs::{Cgroup, Controller, MaxValue};
|
||||||
use cgroups_rs::{Cgroup, MaxValue};
|
use libc::pid_t;
|
||||||
|
|
||||||
use nix::sys::wait::{waitpid, WaitStatus};
|
use nix::sys::wait::{waitpid, WaitStatus};
|
||||||
use nix::unistd::{fork, ForkResult};
|
use nix::unistd::{fork, ForkResult};
|
||||||
|
|
||||||
use libc::pid_t;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_and_delete_cgroup() {
|
fn create_and_delete_cgroup() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("create_and_delete_cgroup")).unwrap();
|
let cg = Cgroup::new(h, String::from("create_and_delete_cgroup")).unwrap();
|
||||||
{
|
{
|
||||||
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
||||||
@@ -30,7 +27,7 @@ fn create_and_delete_cgroup() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pids_current_is_zero() {
|
fn test_pids_current_is_zero() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_pids_current_is_zero")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_pids_current_is_zero")).unwrap();
|
||||||
{
|
{
|
||||||
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
||||||
@@ -42,7 +39,7 @@ fn test_pids_current_is_zero() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pids_events_is_zero() {
|
fn test_pids_events_is_zero() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_pids_events_is_zero")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_pids_events_is_zero")).unwrap();
|
||||||
{
|
{
|
||||||
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
let pidcontroller: &PidController = cg.controller_of().unwrap();
|
||||||
@@ -55,7 +52,7 @@ fn test_pids_events_is_zero() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pid_events_is_not_zero() {
|
fn test_pid_events_is_not_zero() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("test_pid_events_is_not_zero")).unwrap();
|
let cg = Cgroup::new(h, String::from("test_pid_events_is_not_zero")).unwrap();
|
||||||
{
|
{
|
||||||
let pids: &PidController = cg.controller_of().unwrap();
|
let pids: &PidController = cg.controller_of().unwrap();
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
//! Integration test about setting resources using `apply()`
|
//! Integration test about setting resources using `apply()`
|
||||||
use cgroups_rs::pid::PidController;
|
use cgroups_rs::fs::pid::PidController;
|
||||||
use cgroups_rs::{Cgroup, MaxValue, PidResources, Resources};
|
use cgroups_rs::fs::{Cgroup, MaxValue, PidResources, Resources};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pid_resources() {
|
fn pid_resources() {
|
||||||
let h = cgroups_rs::hierarchies::auto();
|
let h = cgroups_rs::fs::hierarchies::auto();
|
||||||
let cg = Cgroup::new(h, String::from("pid_resources")).unwrap();
|
let cg = Cgroup::new(h, String::from("pid_resources")).unwrap();
|
||||||
{
|
{
|
||||||
let res = Resources {
|
let res = Resources {
|
||||||
|
|||||||
Reference in New Issue
Block a user