1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-07 08:06:18 +02:00
youki/crates/libcontainer/src/process/mod.rs
utam0k ec2f58d4b2
Add easy way to test with K8s
Signed-off-by: utam0k <k0ma@utam0k.jp>
2023-05-06 12:03:36 +00:00

52 lines
1.5 KiB
Rust

//! Provides a thin wrapper around fork syscall,
//! with enums and functions specific to youki implemented
use crate::syscall::SyscallError;
pub mod args;
pub mod channel;
pub mod container_init_process;
pub mod container_intermediate_process;
pub mod container_main_process;
pub mod fork;
pub mod intel_rdt;
pub mod message;
type Result<T> = std::result::Result<T, ProcessError>;
#[derive(Debug, thiserror::Error)]
pub enum ProcessError {
#[error("unknown fatal error")]
Unknown,
#[error("failed to clone process using clone3")]
CloneFailed {
errno: nix::errno::Errno,
child_name: String,
},
#[error("failed init process")]
InitProcessFailed { msg: String },
#[error("failed intermediate process")]
IntermediateProcessFailed,
#[error("io error: {0}")]
UnixIo(#[from] nix::errno::Errno),
#[error("failed to add task {pid} to cgroup manager")]
CgroupAdd { pid: nix::unistd::Pid, msg: String },
#[error("failed to apply resource limits to cgroup")]
CgroupApply { msg: String },
#[error("failed to get proc state")]
Procfs(#[from] procfs::ProcError),
#[error("missing linux in spec")]
NoLinuxSpec,
#[error("missing process in spec")]
NoProcessSpec,
#[error("channel error")]
ChannelError {
msg: String,
source: channel::ChannelError,
},
#[error("syscall failed")]
SyscallFailed(#[from] SyscallError),
#[error("failed to enter namespace")]
NamespaceError(#[from] crate::namespaces::NamespaceError),
}