Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
46926165
Commit
46926165
authored
Nov 12, 2013
by
Marek Majkowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring - make the option parsing code generic
parent
f8059880
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
18 deletions
+10
-18
arguments.h
src/lxc/arguments.h
+1
-2
lxc_start.c
src/lxc/lxc_start.c
+9
-16
No files found.
src/lxc/arguments.h
View file @
46926165
...
@@ -54,8 +54,7 @@ struct lxc_arguments {
...
@@ -54,8 +54,7 @@ struct lxc_arguments {
int
lxcpath_additional
;
int
lxcpath_additional
;
/* for lxc-start */
/* for lxc-start */
const
char
*
share_net
;
const
char
*
share_ns
[
32
];
// size must be greater than LXC_NS_MAX
const
char
*
share_ipc
;
/* for lxc-checkpoint/restart */
/* for lxc-checkpoint/restart */
const
char
*
statefile
;
const
char
*
statefile
;
...
...
src/lxc/lxc_start.c
View file @
46926165
...
@@ -151,8 +151,8 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
...
@@ -151,8 +151,8 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
case
'C'
:
args
->
close_all_fds
=
1
;
break
;
case
'C'
:
args
->
close_all_fds
=
1
;
break
;
case
's'
:
return
lxc_config_define_add
(
&
defines
,
arg
);
case
's'
:
return
lxc_config_define_add
(
&
defines
,
arg
);
case
'p'
:
args
->
pidfile
=
arg
;
break
;
case
'p'
:
args
->
pidfile
=
arg
;
break
;
case
OPT_SHARE_NET
:
args
->
share_n
et
=
arg
;
break
;
case
OPT_SHARE_NET
:
args
->
share_n
s
[
LXC_NS_NET
]
=
arg
;
break
;
case
OPT_SHARE_IPC
:
args
->
share_
ipc
=
arg
;
break
;
case
OPT_SHARE_IPC
:
args
->
share_
ns
[
LXC_NS_IPC
]
=
arg
;
break
;
}
}
return
0
;
return
0
;
}
}
...
@@ -306,26 +306,19 @@ int main(int argc, char *argv[])
...
@@ -306,26 +306,19 @@ int main(int argc, char *argv[])
}
}
}
}
if
(
my_args
.
share_net
!=
NULL
)
{
int
i
;
int
pid
=
pid_from_lxcname
(
my_args
.
share_net
,
lxcpath
);
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
{
if
(
pid
<
1
)
if
(
my_args
.
share_ns
[
i
]
==
NULL
)
goto
out
;
continue
;
int
fd
=
open_ns
(
pid
,
"net"
);
if
(
fd
<
0
)
goto
out
;
conf
->
inherit_ns_fd
[
LXC_NS_NET
]
=
fd
;
}
if
(
my_args
.
share_ipc
!=
NULL
)
{
int
pid
=
pid_from_lxcname
(
my_args
.
share_ns
[
i
],
lxcpath
);
int
pid
=
pid_from_lxcname
(
my_args
.
share_ipc
,
lxcpath
);
if
(
pid
<
1
)
if
(
pid
<
1
)
goto
out
;
goto
out
;
int
fd
=
open_ns
(
pid
,
"ipc"
);
int
fd
=
open_ns
(
pid
,
ns_info
[
i
].
proc_name
);
if
(
fd
<
0
)
if
(
fd
<
0
)
goto
out
;
goto
out
;
conf
->
inherit_ns_fd
[
LXC_NS_IPC
]
=
fd
;
conf
->
inherit_ns_fd
[
i
]
=
fd
;
}
}
if
(
my_args
.
daemonize
)
{
if
(
my_args
.
daemonize
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment