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
08dc351a
Commit
08dc351a
authored
Sep 29, 2017
by
Serge Hallyn
Committed by
GitHub
Sep 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1836 from lifeng68/ns_share_pid
Add support share pid namespace
parents
943b4912
03df7ab5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
start.c
src/lxc/start.c
+6
-1
lxc_start.c
src/lxc/tools/lxc_start.c
+4
-1
No files found.
src/lxc/start.c
View file @
08dc351a
...
...
@@ -1126,7 +1126,7 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler)
void
resolve_clone_flags
(
struct
lxc_handler
*
handler
)
{
handler
->
clone_flags
=
CLONE_NEW
PID
|
CLONE_NEW
NS
;
handler
->
clone_flags
=
CLONE_NEWNS
;
if
(
!
lxc_list_empty
(
&
handler
->
conf
->
id_map
))
handler
->
clone_flags
|=
CLONE_NEWUSER
;
...
...
@@ -1147,6 +1147,11 @@ void resolve_clone_flags(struct lxc_handler *handler)
handler
->
clone_flags
|=
CLONE_NEWUTS
;
else
INFO
(
"Inheriting a UTS namespace."
);
if
(
handler
->
conf
->
inherit_ns_fd
[
LXC_NS_PID
]
==
-
1
)
handler
->
clone_flags
|=
CLONE_NEWPID
;
else
INFO
(
"Inheriting a PID namespace."
);
}
/* lxc_spawn() performs crucial setup tasks and clone()s the new process which
...
...
src/lxc/tools/lxc_start.c
View file @
08dc351a
...
...
@@ -53,6 +53,7 @@
#define OPT_SHARE_NET OPT_USAGE + 1
#define OPT_SHARE_IPC OPT_USAGE + 2
#define OPT_SHARE_UTS OPT_USAGE + 3
#define OPT_SHARE_PID OPT_USAGE + 4
lxc_log_define
(
lxc_start_ui
,
lxc
);
...
...
@@ -149,6 +150,7 @@ static int my_parser(struct lxc_arguments* args, int c, char* arg)
case
OPT_SHARE_NET
:
args
->
share_ns
[
LXC_NS_NET
]
=
arg
;
break
;
case
OPT_SHARE_IPC
:
args
->
share_ns
[
LXC_NS_IPC
]
=
arg
;
break
;
case
OPT_SHARE_UTS
:
args
->
share_ns
[
LXC_NS_UTS
]
=
arg
;
break
;
case
OPT_SHARE_PID
:
args
->
share_ns
[
LXC_NS_PID
]
=
arg
;
break
;
}
return
0
;
}
...
...
@@ -165,6 +167,7 @@ static const struct option my_longopts[] = {
{
"share-net"
,
required_argument
,
0
,
OPT_SHARE_NET
},
{
"share-ipc"
,
required_argument
,
0
,
OPT_SHARE_IPC
},
{
"share-uts"
,
required_argument
,
0
,
OPT_SHARE_UTS
},
{
"share-pid"
,
required_argument
,
0
,
OPT_SHARE_PID
},
LXC_COMMON_OPTIONS
};
...
...
@@ -187,7 +190,7 @@ Options :\n\
If not specified, exit with failure instead
\n
\
Note: --daemon implies --close-all-fds
\n
\
-s, --define KEY=VAL Assign VAL to configuration variable KEY
\n
\
--share-[net|ipc|uts]=NAME Share a namespace with another container or pid
\n
\
--share-[net|ipc|uts
|pid
]=NAME Share a namespace with another container or pid
\n
\
"
,
.
options
=
my_longopts
,
.
parser
=
my_parser
,
...
...
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