Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust 1.82.0 #3035

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/libcontainer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub struct YoukiConfig {
pub cgroup_path: PathBuf,
}

impl<'a> YoukiConfig {
pub fn from_spec(spec: &'a Spec, container_id: &str) -> Result<Self> {
impl YoukiConfig {
pub fn from_spec(spec: &Spec, container_id: &str) -> Result<Self> {
Ok(YoukiConfig {
hooks: spec.hooks().clone(),
cgroup_path: utils::get_cgroup_path(
Expand Down
1 change: 1 addition & 0 deletions crates/libcontainer/src/process/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub enum ChannelError {
OtherError(String),
}

#[allow(clippy::empty_line_after_doc_comments)]
/// Channel Design
///
/// Each of the main, intermediate, and init process will have a uni-directional
Expand Down
62 changes: 30 additions & 32 deletions crates/libcontainer/src/process/container_init_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,42 +795,40 @@ fn set_supplementary_gids(

/// set_io_priority set io priority
fn set_io_priority(syscall: &dyn Syscall, io_priority_op: &Option<LinuxIOPriority>) -> Result<()> {
match io_priority_op {
Some(io_priority) => {
let io_prio_class_mapping: HashMap<_, _> = [
(IOPriorityClass::IoprioClassRt, 1i64),
(IOPriorityClass::IoprioClassBe, 2i64),
(IOPriorityClass::IoprioClassIdle, 3i64),
]
.iter()
.filter_map(|(class, num)| match serde_json::to_string(&class) {
Ok(class_str) => Some((class_str, *num)),
Err(err) => {
tracing::error!(?err, "failed to parse io priority class");
None
}
})
.collect();
if let Some(io_priority) = io_priority_op {
let io_prio_class_mapping: HashMap<_, _> = [
(IOPriorityClass::IoprioClassRt, 1i64),
(IOPriorityClass::IoprioClassBe, 2i64),
(IOPriorityClass::IoprioClassIdle, 3i64),
]
.iter()
.filter_map(|(class, num)| match serde_json::to_string(&class) {
Ok(class_str) => Some((class_str, *num)),
Err(err) => {
tracing::error!(?err, "failed to parse io priority class");
None
}
})
.collect();

let iop_class = serde_json::to_string(&io_priority.class())
.map_err(|err| InitProcessError::IoPriorityClass(err.to_string()))?;

match io_prio_class_mapping.get(&iop_class) {
Some(value) => {
syscall
.set_io_priority(*value, io_priority.priority())
.map_err(|err| {
tracing::error!(?err, ?io_priority, "failed to set io_priority");
InitProcessError::SyscallOther(err)
})?;
}
None => {
return Err(InitProcessError::IoPriorityClass(iop_class));
}
let iop_class = serde_json::to_string(&io_priority.class())
.map_err(|err| InitProcessError::IoPriorityClass(err.to_string()))?;

match io_prio_class_mapping.get(&iop_class) {
Some(value) => {
syscall
.set_io_priority(*value, io_priority.priority())
.map_err(|err| {
tracing::error!(?err, ?io_priority, "failed to set io_priority");
InitProcessError::SyscallOther(err)
})?;
}
None => {
return Err(InitProcessError::IoPriorityClass(iop_class));
}
}
None => {}
}

Ok(())
}

Expand Down
5 changes: 1 addition & 4 deletions crates/libcontainer/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ pub fn parse_env(envs: &[String]) -> HashMap<String, String> {

/// Get a nix::unistd::User via UID. Potential errors will be ignored.
pub fn get_unix_user(uid: Uid) -> Option<User> {
match User::from_uid(uid) {
Ok(x) => x,
Err(_) => None,
}
User::from_uid(uid).unwrap_or_default()
}

/// Get home path of a User via UID.
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
profile="default"
channel="1.80.0"
channel="1.82.0"
1 change: 1 addition & 0 deletions tests/contest/contest/src/utils/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
.join("runtimetest"),
)
.unwrap();
#[allow(clippy::zombie_processes)]

Check failure on line 212 in tests/contest/contest/src/utils/test_utils.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, gnu)

unknown lint: `clippy::zombie_processes`

Check failure on line 212 in tests/contest/contest/src/utils/test_utils.rs

View workflow job for this annotation

GitHub Actions / check (x86_64, musl)

unknown lint: `clippy::zombie_processes`

Check failure on line 212 in tests/contest/contest/src/utils/test_utils.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, gnu)

unknown lint: `clippy::zombie_processes`

Check failure on line 212 in tests/contest/contest/src/utils/test_utils.rs

View workflow job for this annotation

GitHub Actions / check (aarch64, musl)

unknown lint: `clippy::zombie_processes`
let create_process = create_container(&id_str, &bundle, options).unwrap();
// here we do not wait for the process by calling wait() as in the test_outside_container
// function because we need the output of the runtimetest. If we call wait, it will return
Expand Down
Loading