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

Dev/clone2 #133

Merged
merged 2 commits into from
Nov 4, 2024
Merged
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
51 changes: 4 additions & 47 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions core/src/cgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::io::BufRead;
use std::path::{Path, PathBuf};
use std::time::{Duration, Instant};

use anyhow::{anyhow, bail, Ok};
use anyhow::{bail, Context, Ok};
use itertools::Itertools;
use nix::sys::statfs;
use nix::unistd::Pid;
Expand Down Expand Up @@ -278,7 +278,7 @@ pub fn mount_point() -> anyhow::Result<PathBuf> {
.mountinfo()?
.into_iter()
.find(|m| m.fs_type.eq("cgroup2")) // TODO A process can have several cgroup mounts
.ok_or_else(|| anyhow!("no cgroup2 mount found"))
.context("no cgroup2 mount found")
.map(|m| m.mount_point.clone())
}

Expand All @@ -289,7 +289,7 @@ pub fn current_cgroup() -> anyhow::Result<PathBuf> {
.cgroups()?
.into_iter()
.next()
.ok_or(anyhow!("cannot obtain cgroup"))?
.context("cannot obtain cgroup")?
.pathname
.clone();
let path = &path[1..path.len()]; // Remove the leading '/'
Expand Down
4 changes: 2 additions & 2 deletions core/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::marker::PhantomData;
use std::mem::{size_of, MaybeUninit};
use std::os::unix::prelude::{AsRawFd, FileExt, IntoRawFd, RawFd};

use anyhow::{anyhow, Result};
use anyhow::{anyhow, Context, Result};
use memfd::{FileSeal, Memfd, MemfdOptions};
use memmap2::{Mmap, MmapMut};
use nix::unistd::{close, dup};
Expand Down Expand Up @@ -183,6 +183,6 @@ pub fn get_memfd(name: &str) -> TypedResult<i32> {
None
}
})
.ok_or_else(|| anyhow!("No File Descriptor with Name: {name}"))
.with_context(|| format!("No File Descriptor with Name: {name}"))
.typ(SystemError::Panic)
}
1 change: 0 additions & 1 deletion hypervisor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ bytesize.workspace = true
anyhow.workspace = true

tempfile = "3.3"
clone3 = "0.2"
serde = { version = "1.0", features = ["derive"] }
libc = "0.2"
clap = { version = "4", features = [ "derive" ] }
Expand Down
4 changes: 2 additions & 2 deletions hypervisor/src/hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use a653rs_linux_core::error::{ErrorLevel, LeveledResult, ResultExt, SystemError
use a653rs_linux_core::file::TempFile;
use a653rs_linux_core::queuing::Queuing;
use a653rs_linux_core::sampling::Sampling;
use anyhow::anyhow;
use anyhow::{anyhow, Context};
use config::{Channel, Config};
use once_cell::sync::OnceCell;
use partition::Partition;
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Hypervisor {

let sys_time = SYSTEM_START_TIME
.get()
.ok_or_else(|| anyhow!("SystemTime was not set"))
.context("SystemTime was not set")
.lev_typ(SystemError::Panic, ErrorLevel::ModuleInit)?;
sys_time.write(&frame_start).lev(ErrorLevel::ModuleInit)?;
sys_time.seal_read_only().lev(ErrorLevel::ModuleInit)?;
Expand Down
Loading
Loading