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
fc7de561
Commit
fc7de561
authored
Mar 12, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroup: try to set clone_children
Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
parent
251d0d2a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
cgroup.c
src/lxc/cgroup.c
+26
-0
No files found.
src/lxc/cgroup.c
View file @
fc7de561
...
@@ -558,6 +558,31 @@ out:
...
@@ -558,6 +558,31 @@ out:
}
}
/*
/*
* If first creating the /sys/fs/cgroup/$subsys/lxc container, then
* try to set clone_children to 1. Some kernels don't support
* clone_children, and cgroup maintainer wants to deprecate it. So
* XXX TODO we should instead after each cgroup mkdir (here and in
* hooks/mountcgroup) check if cpuset is in the subsystems, and if so
* manually copy over mems and cpus.
*/
static
void
set_clone_children
(
const
char
*
mntdir
,
const
char
*
init
)
{
char
path
[
MAXPATHLEN
];
FILE
*
fout
;
int
ret
;
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s%s/cgroup.clone_children"
,
mntdir
,
init
);
INFO
(
"writing to %s
\n
"
,
path
);
if
(
ret
<
0
||
ret
>
MAXPATHLEN
)
return
;
fout
=
fopen
(
path
,
"w"
);
if
(
!
fout
)
return
;
fprintf
(
fout
,
"1
\n
"
);
fclose
(
fout
);
}
/*
* Make sure the 'cgroup group' exists, so that we don't have to worry about
* Make sure the 'cgroup group' exists, so that we don't have to worry about
* that later.
* that later.
*
*
...
@@ -597,6 +622,7 @@ static int create_lxcgroups(const char *lxcgroup)
...
@@ -597,6 +622,7 @@ static int create_lxcgroups(const char *lxcgroup)
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
goto
fail
;
goto
fail
;
if
(
access
(
path
,
F_OK
))
{
if
(
access
(
path
,
F_OK
))
{
set_clone_children
(
mntent
->
mnt_dir
,
init
);
ret
=
mkdir
(
path
,
0755
);
ret
=
mkdir
(
path
,
0755
);
if
(
ret
==
-
1
&&
errno
!=
EEXIST
)
{
if
(
ret
==
-
1
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"failed to create '%s' directory"
,
path
);
SYSERROR
(
"failed to create '%s' directory"
,
path
);
...
...
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