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
pub use lxc_sys::lxc_attach_exec_t as ExecFn;
pub use lxc_sys::lxc_attach_options_t as Options;
bitflags::bitflags! {
pub struct EnvPolicy: i32 {
const KEEP_ENV = lxc_sys::lxc_attach_env_policy_t_LXC_ATTACH_KEEP_ENV as i32;
const CLEAR_ENV = lxc_sys::lxc_attach_env_policy_t_LXC_ATTACH_CLEAR_ENV as i32;
}
}
pub fn run_command(payload: &mut std::os::raw::c_void) -> Result<i32, ()> {
let result = unsafe { lxc_sys::lxc_attach_run_command(payload) };
if result == -1 {
Err(())
} else {
Ok(result)
}
}
pub fn run_shell(_payload: &mut std::os::raw::c_void) -> i32 {
unsafe { lxc_sys::lxc_attach_run_shell(_payload) }
}