1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::os::unix::prelude::RawFd;
use std::path::PathBuf;
use std::rc::Rc;
use libcgroups::common::CgroupConfig;
use oci_spec::runtime::Spec;
use crate::container::Container;
use crate::notify_socket::NotifyListener;
use crate::syscall::syscall::SyscallType;
use crate::user_ns::UserNamespaceConfig;
use crate::workload::Executor;
#[derive(Debug, Copy, Clone)]
pub enum ContainerType {
InitContainer,
TenantContainer { exec_notify_fd: RawFd },
}
#[derive(Clone)]
pub struct ContainerArgs {
/// Indicates if an init or a tenant container should be created
pub container_type: ContainerType,
/// Interface to operating system primitives
pub syscall: SyscallType,
/// OCI compliant runtime spec
pub spec: Rc<Spec>,
/// Root filesystem of the container
pub rootfs: PathBuf,
/// Socket to communicate the file descriptor of the ptty
pub console_socket: Option<RawFd>,
/// The Unix Domain Socket to communicate container start
pub notify_listener: NotifyListener,
/// File descriptors preserved/passed to the container init process.
pub preserve_fds: i32,
/// Container state
pub container: Option<Container>,
/// Options for new namespace creation
pub user_ns_config: Option<UserNamespaceConfig>,
/// Cgroup Manager Config
pub cgroup_config: CgroupConfig,
/// If the container is to be run in detached mode
pub detached: bool,
/// Manage the functions that actually run on the container
pub executor: Box<dyn Executor>,
/// If do not use pivot root to jail process inside rootfs
pub no_pivot: bool,
// RawFd set to stdin of the container init process.
pub stdin: Option<RawFd>,
// RawFd set to stdout of the container init process.
pub stdout: Option<RawFd>,
// RawFd set to stderr of the container init process.
pub stderr: Option<RawFd>,
// Indicate if the init process should be a sibling of the main process.
pub as_sibling: bool,
/// File path used to communicate the PID of the
/// container process to the higher-level runtime.
pub pid_file: Option<PathBuf>,
}