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
c72e7cb5
Unverified
Commit
c72e7cb5
authored
Feb 16, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: rework add_hierarchy()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
008ccca9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
cgfsng.c
src/lxc/cgroups/cgfsng.c
+7
-5
No files found.
src/lxc/cgroups/cgfsng.c
View file @
c72e7cb5
...
@@ -691,7 +691,8 @@ static char **cg_unified_get_controllers(int dfd, const char *file)
...
@@ -691,7 +691,8 @@ static char **cg_unified_get_controllers(int dfd, const char *file)
return
move_ptr
(
aret
);
return
move_ptr
(
aret
);
}
}
static
struct
hierarchy
*
add_hierarchy
(
struct
hierarchy
***
h
,
char
**
clist
,
char
*
mountpoint
,
static
struct
hierarchy
*
add_hierarchy
(
struct
cgroup_ops
*
ops
,
char
**
clist
,
char
*
mountpoint
,
char
*
container_base_path
,
int
type
)
char
*
container_base_path
,
int
type
)
{
{
struct
hierarchy
*
new
;
struct
hierarchy
*
new
;
...
@@ -700,6 +701,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
...
@@ -700,6 +701,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
new
=
zalloc
(
sizeof
(
*
new
));
new
=
zalloc
(
sizeof
(
*
new
));
if
(
!
new
)
if
(
!
new
)
return
ret_set_errno
(
NULL
,
ENOMEM
);
return
ret_set_errno
(
NULL
,
ENOMEM
);
new
->
controllers
=
clist
;
new
->
controllers
=
clist
;
new
->
mountpoint
=
mountpoint
;
new
->
mountpoint
=
mountpoint
;
new
->
container_base_path
=
container_base_path
;
new
->
container_base_path
=
container_base_path
;
...
@@ -708,8 +710,8 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
...
@@ -708,8 +710,8 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
new
->
cgfd_limit
=
-
EBADF
;
new
->
cgfd_limit
=
-
EBADF
;
new
->
cgfd_mon
=
-
EBADF
;
new
->
cgfd_mon
=
-
EBADF
;
newentry
=
append_null_to_list
((
void
***
)
h
);
newentry
=
append_null_to_list
((
void
***
)
&
ops
->
hierarchies
);
(
*
h
)[
newentry
]
=
new
;
(
ops
->
hierarchies
)[
newentry
]
=
new
;
return
new
;
return
new
;
}
}
...
@@ -3423,7 +3425,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops, bool relative, bool unprivileg
...
@@ -3423,7 +3425,7 @@ static int cg_hybrid_init(struct cgroup_ops *ops, bool relative, bool unprivileg
continue
;
continue
;
}
}
new
=
add_hierarchy
(
&
ops
->
hierarchie
s
,
move_ptr
(
controller_list
),
move_ptr
(
mountpoint
),
move_ptr
(
base_cgroup
),
type
);
new
=
add_hierarchy
(
op
s
,
move_ptr
(
controller_list
),
move_ptr
(
mountpoint
),
move_ptr
(
base_cgroup
),
type
);
if
(
!
new
)
if
(
!
new
)
return
log_error_errno
(
-
1
,
errno
,
"Failed to add cgroup hierarchy"
);
return
log_error_errno
(
-
1
,
errno
,
"Failed to add cgroup hierarchy"
);
if
(
type
==
CGROUP2_SUPER_MAGIC
&&
!
ops
->
unified
)
{
if
(
type
==
CGROUP2_SUPER_MAGIC
&&
!
ops
->
unified
)
{
...
@@ -3503,7 +3505,7 @@ static int cg_unified_init(struct cgroup_ops *ops, bool relative,
...
@@ -3503,7 +3505,7 @@ static int cg_unified_init(struct cgroup_ops *ops, bool relative,
* controllers per container.
* controllers per container.
*/
*/
new
=
add_hierarchy
(
&
ops
->
hierarchie
s
,
new
=
add_hierarchy
(
op
s
,
move_ptr
(
delegatable
),
move_ptr
(
delegatable
),
must_copy_string
(
DEFAULT_CGROUP_MOUNTPOINT
),
must_copy_string
(
DEFAULT_CGROUP_MOUNTPOINT
),
move_ptr
(
base_cgroup
),
move_ptr
(
base_cgroup
),
...
...
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