@@ -20,8 +20,7 @@ use crate::tty;
20
20
use crate :: utils;
21
21
use crate :: { capabilities, command:: Command } ;
22
22
23
-
24
- /// This is the main structure which stores various commandline options given by
23
+ /// This is the main structure which stores various commandline options given by
25
24
/// high-level container runtime
26
25
#[ derive( Clap , Debug ) ]
27
26
pub struct Create {
@@ -41,7 +40,7 @@ pub struct Create {
41
40
42
41
// One thing to note is that in the end, container is just another process in Linux
43
42
// it has specific/different control group, namespace, using which program executing in it
44
- // can be given impression that is is running on a complete system, but on the system which
43
+ // can be given impression that is is running on a complete system, but on the system which
45
44
// it is running, it is just another process, and has attributes such as pid, file descriptors, etc.
46
45
// associated with it like any other process.
47
46
impl Create {
@@ -66,7 +65,8 @@ impl Create {
66
65
fs:: copy ( "config.json" , container_dir. join ( "config.json" ) ) ?;
67
66
log:: debug!( "spec: {:?}" , spec) ;
68
67
69
- // convert path to absolute path
68
+ // convert path to absolute path, as relative path will be evaluated
69
+ // relative to where youki command is executed, and will be difficult to manipulate
70
70
let container_dir = fs:: canonicalize ( container_dir) ?;
71
71
unistd:: chdir ( & * container_dir) ?;
72
72
@@ -82,10 +82,8 @@ impl Create {
82
82
container. save ( ) ?;
83
83
84
84
let mut notify_socket: NotifyListener = NotifyListener :: new ( & container_dir) ?;
85
-
86
85
// convert path of root file system of the container to absolute path
87
86
let rootfs = fs:: canonicalize ( & spec. root . path ) ?;
88
-
89
87
// if socket file path is given in commandline options,
90
88
// get file descriptors of console and console socket
91
89
let ( csocketfd, _consolefd) = {
@@ -126,11 +124,10 @@ fn run_container<P: AsRef<Path>>(
126
124
container : Container ,
127
125
command : impl Command ,
128
126
) -> Result < Process > {
129
-
130
127
// disable core dump for the process, check https://man7.org/linux/man-pages/man2/prctl.2.html for more information
131
128
prctl:: set_dumpable ( false ) . unwrap ( ) ;
132
129
133
- // get Linux specific section of OCI spec,
130
+ // get Linux specific section of OCI spec,
134
131
// refer https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md for more information
135
132
let linux = spec. linux . as_ref ( ) . unwrap ( ) ;
136
133
let namespaces: Namespaces = linux. namespaces . clone ( ) . into ( ) ;
@@ -171,7 +168,7 @@ fn run_container<P: AsRef<Path>>(
171
168
172
169
// fork second time, which will later create container
173
170
match fork:: fork_init ( child) ? {
174
- Process :: Child ( child ) => unreachable ! ( ) ,
171
+ Process :: Child ( _child ) => unreachable ! ( ) ,
175
172
// This is actually the child process after fork
176
173
Process :: Init ( mut init) => {
177
174
// setup args and env vars as in the spec
0 commit comments