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
dcf6a5c7
Unverified
Commit
dcf6a5c7
authored
Feb 17, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: remove obsolote cgroup_tree handling
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c55fe36d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
26 deletions
+16
-26
cgfsng.c
src/lxc/cgroups/cgfsng.c
+16
-26
No files found.
src/lxc/cgroups/cgfsng.c
View file @
dcf6a5c7
...
@@ -1095,9 +1095,8 @@ static int __cgroup_tree_create(int dfd_base, const char *path, mode_t mode,
...
@@ -1095,9 +1095,8 @@ static int __cgroup_tree_create(int dfd_base, const char *path, mode_t mode,
}
}
static
bool
cgroup_tree_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
,
static
bool
cgroup_tree_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_conf
*
conf
,
struct
hierarchy
*
h
,
const
char
*
cgroup_tree
,
struct
hierarchy
*
h
,
const
char
*
cgroup_leaf
,
const
char
*
cgroup_leaf
,
bool
payload
,
bool
payload
,
const
char
*
cgroup_limit_dir
)
const
char
*
cgroup_limit_dir
)
{
{
__do_close
int
fd_limit
=
-
EBADF
,
fd_final
=
-
EBADF
;
__do_close
int
fd_limit
=
-
EBADF
,
fd_final
=
-
EBADF
;
__do_free
char
*
path
=
NULL
,
*
limit_path
=
NULL
;
__do_free
char
*
path
=
NULL
,
*
limit_path
=
NULL
;
...
@@ -1290,8 +1289,7 @@ static bool check_cgroup_dir_config(struct lxc_conf *conf)
...
@@ -1290,8 +1289,7 @@ static bool check_cgroup_dir_config(struct lxc_conf *conf)
__cgfsng_ops
static
bool
cgfsng_monitor_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
)
__cgfsng_ops
static
bool
cgfsng_monitor_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
)
{
{
__do_free
char
*
monitor_cgroup
=
NULL
,
*
__cgroup_tree
=
NULL
;
__do_free
char
*
monitor_cgroup
=
NULL
;
const
char
*
cgroup_tree
;
int
idx
=
0
;
int
idx
=
0
;
int
i
;
int
i
;
size_t
len
;
size_t
len
;
...
@@ -1316,25 +1314,23 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
...
@@ -1316,25 +1314,23 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
return
false
;
return
false
;
if
(
conf
->
cgroup_meta
.
monitor_dir
)
{
if
(
conf
->
cgroup_meta
.
monitor_dir
)
{
cgroup_tree
=
NULL
;
monitor_cgroup
=
strdup
(
conf
->
cgroup_meta
.
monitor_dir
);
monitor_cgroup
=
strdup
(
conf
->
cgroup_meta
.
monitor_dir
);
}
else
if
(
conf
->
cgroup_meta
.
dir
)
{
}
else
if
(
conf
->
cgroup_meta
.
dir
)
{
cgroup_tree
=
conf
->
cgroup_meta
.
dir
;
monitor_cgroup
=
must_concat
(
&
len
,
conf
->
cgroup_meta
.
dir
,
"/"
,
monitor_cgroup
=
must_concat
(
&
len
,
conf
->
cgroup_meta
.
dir
,
"/"
,
DEFAULT_MONITOR_CGROUP_PREFIX
,
DEFAULT_MONITOR_CGROUP_PREFIX
,
handler
->
name
,
handler
->
name
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
}
else
if
(
ops
->
cgroup_pattern
)
{
}
else
if
(
ops
->
cgroup_pattern
)
{
__cgroup_tree
=
lxc_string_replace
(
"%n"
,
handler
->
name
,
ops
->
cgroup_pattern
);
__do_free
char
*
cgroup_tree
=
NULL
;
if
(
!
__cgroup_tree
)
cgroup_tree
=
lxc_string_replace
(
"%n"
,
handler
->
name
,
ops
->
cgroup_pattern
);
if
(
!
cgroup_tree
)
return
ret_set_errno
(
false
,
ENOMEM
);
return
ret_set_errno
(
false
,
ENOMEM
);
cgroup_tree
=
__cgroup_tree
;
monitor_cgroup
=
must_concat
(
&
len
,
cgroup_tree
,
"/"
,
monitor_cgroup
=
must_concat
(
&
len
,
cgroup_tree
,
"/"
,
DEFAULT_MONITOR_CGROUP
,
DEFAULT_MONITOR_CGROUP
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
}
else
{
}
else
{
cgroup_tree
=
NULL
;
monitor_cgroup
=
must_concat
(
&
len
,
DEFAULT_MONITOR_CGROUP_PREFIX
,
monitor_cgroup
=
must_concat
(
&
len
,
DEFAULT_MONITOR_CGROUP_PREFIX
,
handler
->
name
,
handler
->
name
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
...
@@ -1352,8 +1348,8 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
...
@@ -1352,8 +1348,8 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
if
(
cgroup_tree_create
(
ops
,
handler
->
conf
,
if
(
cgroup_tree_create
(
ops
,
handler
->
conf
,
ops
->
hierarchies
[
i
],
cgroup_tree
,
ops
->
hierarchies
[
i
]
,
monitor_cgroup
,
false
,
NULL
))
monitor_cgroup
,
false
,
NULL
))
continue
;
continue
;
DEBUG
(
"Failed to create cgroup
\"
%s
\"
"
,
maybe_empty
(
ops
->
hierarchies
[
i
]
->
monitor_full_path
));
DEBUG
(
"Failed to create cgroup
\"
%s
\"
"
,
maybe_empty
(
ops
->
hierarchies
[
i
]
->
monitor_full_path
));
...
@@ -1378,10 +1374,7 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
...
@@ -1378,10 +1374,7 @@ __cgfsng_ops static bool cgfsng_monitor_create(struct cgroup_ops *ops, struct lx
*/
*/
__cgfsng_ops
static
bool
cgfsng_payload_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
)
__cgfsng_ops
static
bool
cgfsng_payload_create
(
struct
cgroup_ops
*
ops
,
struct
lxc_handler
*
handler
)
{
{
__do_free
char
*
container_cgroup
=
NULL
,
__do_free
char
*
container_cgroup
=
NULL
,
*
limiting_cgroup
=
NULL
;
*
__cgroup_tree
=
NULL
,
*
limiting_cgroup
=
NULL
;
const
char
*
cgroup_tree
;
int
idx
=
0
;
int
idx
=
0
;
int
i
;
int
i
;
size_t
len
;
size_t
len
;
...
@@ -1406,8 +1399,6 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
...
@@ -1406,8 +1399,6 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
return
false
;
return
false
;
if
(
conf
->
cgroup_meta
.
container_dir
)
{
if
(
conf
->
cgroup_meta
.
container_dir
)
{
cgroup_tree
=
NULL
;
limiting_cgroup
=
strdup
(
conf
->
cgroup_meta
.
container_dir
);
limiting_cgroup
=
strdup
(
conf
->
cgroup_meta
.
container_dir
);
if
(
!
limiting_cgroup
)
if
(
!
limiting_cgroup
)
return
ret_set_errno
(
false
,
ENOMEM
);
return
ret_set_errno
(
false
,
ENOMEM
);
...
@@ -1421,22 +1412,21 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
...
@@ -1421,22 +1412,21 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
container_cgroup
=
move_ptr
(
limiting_cgroup
);
container_cgroup
=
move_ptr
(
limiting_cgroup
);
}
}
}
else
if
(
conf
->
cgroup_meta
.
dir
)
{
}
else
if
(
conf
->
cgroup_meta
.
dir
)
{
cgroup_tree
=
conf
->
cgroup_meta
.
dir
;
container_cgroup
=
must_concat
(
&
len
,
conf
->
cgroup_meta
.
dir
,
"/"
,
container_cgroup
=
must_concat
(
&
len
,
cgroup_tree
,
"/"
,
DEFAULT_PAYLOAD_CGROUP_PREFIX
,
DEFAULT_PAYLOAD_CGROUP_PREFIX
,
handler
->
name
,
handler
->
name
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
}
else
if
(
ops
->
cgroup_pattern
)
{
}
else
if
(
ops
->
cgroup_pattern
)
{
__cgroup_tree
=
lxc_string_replace
(
"%n"
,
handler
->
name
,
ops
->
cgroup_pattern
);
__do_free
char
*
cgroup_tree
=
NULL
;
if
(
!
__cgroup_tree
)
cgroup_tree
=
lxc_string_replace
(
"%n"
,
handler
->
name
,
ops
->
cgroup_pattern
);
if
(
!
cgroup_tree
)
return
ret_set_errno
(
false
,
ENOMEM
);
return
ret_set_errno
(
false
,
ENOMEM
);
cgroup_tree
=
__cgroup_tree
;
container_cgroup
=
must_concat
(
&
len
,
cgroup_tree
,
"/"
,
container_cgroup
=
must_concat
(
&
len
,
cgroup_tree
,
"/"
,
DEFAULT_PAYLOAD_CGROUP
,
DEFAULT_PAYLOAD_CGROUP
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
}
else
{
}
else
{
cgroup_tree
=
NULL
;
container_cgroup
=
must_concat
(
&
len
,
DEFAULT_PAYLOAD_CGROUP_PREFIX
,
container_cgroup
=
must_concat
(
&
len
,
DEFAULT_PAYLOAD_CGROUP_PREFIX
,
handler
->
name
,
handler
->
name
,
CGROUP_CREATE_RETRY
,
NULL
);
CGROUP_CREATE_RETRY
,
NULL
);
...
@@ -1454,7 +1444,7 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
...
@@ -1454,7 +1444,7 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
for
(
i
=
0
;
ops
->
hierarchies
[
i
];
i
++
)
{
if
(
cgroup_tree_create
(
ops
,
handler
->
conf
,
if
(
cgroup_tree_create
(
ops
,
handler
->
conf
,
ops
->
hierarchies
[
i
],
cgroup_tree
,
ops
->
hierarchies
[
i
],
container_cgroup
,
true
,
container_cgroup
,
true
,
limiting_cgroup
))
limiting_cgroup
))
continue
;
continue
;
...
...
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