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
e3b4a126
Unverified
Commit
e3b4a126
authored
Feb 17, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgfsng: cg_hybrid_init()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
d8b45633
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
8 deletions
+7
-8
cgfsng.c
src/lxc/cgroups/cgfsng.c
+7
-8
No files found.
src/lxc/cgroups/cgfsng.c
View file @
e3b4a126
...
@@ -1186,9 +1186,8 @@ static void lxc_cgfsng_print_debuginfo(const struct cgfsng_handler_data *d)
...
@@ -1186,9 +1186,8 @@ static void lxc_cgfsng_print_debuginfo(const struct cgfsng_handler_data *d)
lxc_cgfsng_print_hierarchies
();
lxc_cgfsng_print_hierarchies
();
}
}
/*
/* At startup, parse_hierarchies finds all the info we need about cgroup
* At startup, parse_hierarchies finds all the info we need about
* mountpoints and current cgroups, and stores it in @d.
* cgroup mountpoints and current cgroups, and stores it in @d.
*/
*/
static
bool
cg_hybrid_init
(
void
)
static
bool
cg_hybrid_init
(
void
)
{
{
...
@@ -1200,8 +1199,7 @@ static bool cg_hybrid_init(void)
...
@@ -1200,8 +1199,7 @@ static bool cg_hybrid_init(void)
char
*
line
=
NULL
;
char
*
line
=
NULL
;
char
**
klist
=
NULL
,
**
nlist
=
NULL
;
char
**
klist
=
NULL
,
**
nlist
=
NULL
;
/*
/* Root spawned containers escape the current cgroup, so use init's
* Root spawned containers escape the current cgroup, so use init's
* cgroups as our base in that case.
* cgroups as our base in that case.
*/
*/
will_escape
=
(
geteuid
()
==
0
);
will_escape
=
(
geteuid
()
==
0
);
...
@@ -1214,7 +1212,7 @@ static bool cg_hybrid_init(void)
...
@@ -1214,7 +1212,7 @@ static bool cg_hybrid_init(void)
ret
=
get_existing_subsystems
(
&
klist
,
&
nlist
);
ret
=
get_existing_subsystems
(
&
klist
,
&
nlist
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
CGFSNG_DEBUG
(
"Failed to retrieve available
cgroup v1
controllers
\n
"
);
CGFSNG_DEBUG
(
"Failed to retrieve available
legacy cgroup
controllers
\n
"
);
free
(
basecginfo
);
free
(
basecginfo
);
return
false
;
return
false
;
}
}
...
@@ -1233,7 +1231,7 @@ static bool cg_hybrid_init(void)
...
@@ -1233,7 +1231,7 @@ static bool cg_hybrid_init(void)
int
type
;
int
type
;
bool
writeable
;
bool
writeable
;
struct
hierarchy
*
new
;
struct
hierarchy
*
new
;
char
*
mountpoint
=
NULL
,
*
base_cgroup
=
NULL
;
char
*
base_cgroup
=
NULL
,
*
mountpoint
=
NULL
;
char
**
controller_list
=
NULL
;
char
**
controller_list
=
NULL
;
type
=
get_cgroup_version
(
line
);
type
=
get_cgroup_version
(
line
);
...
@@ -1300,6 +1298,7 @@ static bool cg_hybrid_init(void)
...
@@ -1300,6 +1298,7 @@ static bool cg_hybrid_init(void)
if
(
!
controller_list
)
if
(
!
controller_list
)
controller_list
=
cg_unified_make_empty_controller
();
controller_list
=
cg_unified_make_empty_controller
();
}
}
new
=
add_hierarchy
(
controller_list
,
mountpoint
,
base_cgroup
,
type
);
new
=
add_hierarchy
(
controller_list
,
mountpoint
,
base_cgroup
,
type
);
if
(
type
==
CGROUP2_SUPER_MAGIC
&&
!
unified
)
if
(
type
==
CGROUP2_SUPER_MAGIC
&&
!
unified
)
unified
=
new
;
unified
=
new
;
...
@@ -1321,7 +1320,7 @@ static bool cg_hybrid_init(void)
...
@@ -1321,7 +1320,7 @@ static bool cg_hybrid_init(void)
free
(
line
);
free
(
line
);
if
(
lxc_cgfsng_debug
)
{
if
(
lxc_cgfsng_debug
)
{
printf
(
"
writeable subsystem
s:
\n
"
);
printf
(
"
Writable cgroup hierarchie
s:
\n
"
);
lxc_cgfsng_print_hierarchies
();
lxc_cgfsng_print_hierarchies
();
}
}
...
...
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