Skip to content

Commit

Permalink
Update nc dependency to 0.9.2 (#2884)
Browse files Browse the repository at this point in the history
* Update Cargo.toml in libcontainer and runtimetest

Signed-off-by: posutsai <[email protected]>

* Fix libc version to 0.2.158

Signed-off-by: posutsai <[email protected]>

---------

Signed-off-by: posutsai <[email protected]>
  • Loading branch information
posutsai authored Aug 20, 2024
1 parent 13e9fc0 commit 1749ef3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/libcontainer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ regex = { version = "1.10.6", default-features = false, features = ["std", "unic
thiserror = "1.0.63"
tracing = { version = "0.1.40", features = ["attributes"] }
safe-path = "0.1.0"
nc = "0.8.23"
nc = "0.9.2"

[dev-dependencies]
oci-spec = { version = "~0.6.8", features = ["proptests", "runtime"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/libcontainer/src/process/container_init_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ fn setup_scheduler(sc_op: &Option<Scheduler>) -> Result<()> {
}
}
}
let mut a = nc::sched_attr_t {
let a = nc::sched_attr_t {
// size of the structure should always be within u32 bounds,
// so this unwrap should never fail
size: mem::size_of::<nc::sched_attr_t>().try_into().unwrap(),
Expand All @@ -798,7 +798,7 @@ fn setup_scheduler(sc_op: &Option<Scheduler>) -> Result<()> {
};
// TODO when nix or libc support this function, replace nx crates.
unsafe {
let result = nc::sched_setattr(0, &mut a, 0);
let result = nc::sched_setattr(0, &a, 0);
match result {
Ok(_) => {}
Err(err) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/contest/runtimetest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ oci-spec = { version = "0.6.8", features = ["runtime"] }
nix = "0.28.0"
anyhow = "1.0"
libc = "0.2.158" # TODO (YJDoc2) upgrade to latest
nc = "0.8.23"
nc = "0.9.2"
4 changes: 1 addition & 3 deletions tests/contest/runtimetest/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::fs::{self, read_dir};
use std::mem;
use std::os::linux::fs::MetadataExt;
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
use std::path::Path;
Expand Down Expand Up @@ -340,7 +339,6 @@ pub fn validate_scheduler_policy(spec: &Spec) {
let proc = spec.process().as_ref().unwrap();
let sc = proc.scheduler().as_ref().unwrap();
println!("schedule is {:?}", spec);
let size = mem::size_of::<nc::sched_attr_t>().try_into().unwrap();
let mut get_sched_attr = nc::sched_attr_t {
size: 0,
sched_policy: 0,
Expand All @@ -354,7 +352,7 @@ pub fn validate_scheduler_policy(spec: &Spec) {
sched_util_max: 0,
};
unsafe {
match nc::sched_getattr(0, &mut get_sched_attr, size, 0) {
match nc::sched_getattr(0, &mut get_sched_attr, 0) {
Ok(_) => {
println!("sched_getattr get success");
}
Expand Down

0 comments on commit 1749ef3

Please sign in to comment.